[BUG] Fix TypeError in BaseProbaMetric._evaluate_by_index
Reference Issues/PRs
Fixes #809
What does this implement/fix? Explain your changes.
This PR fixes a bug in BaseProbaMetric._evaluate_by_index where the method evaluate() was called with an extra positional argument self.multioutput.
The evaluate() method signature only accepts y_true and y_pred as positional arguments, with additional parameters passed through **kwargs. Passing self.multioutput as a positional argument caused the following error:
TypeError: evaluate() takes 3 positional arguments but 4 were given
To resolve this issue, the unnecessary positional argument self.multioutput was removed from the evaluate() calls in _evaluate_by_index.
This aligns the method calls with the correct evaluate() function signature and prevents the TypeError.
Does your contribution introduce a new dependency? If yes, which one?
No. This change does not introduce any new dependencies.
What should a reviewer concentrate their feedback on?
- Correctness of the fix in
_evaluate_by_index - Ensuring the behavior of the jackknife fallback remains unchanged
- Consistency with existing code style
Did you add any tests for the change?
No new tests were added. The change corrects a method call without altering the expected behavior of the metric. All existing tests pass locally.
Any other comments?
Local test results after applying the fix:
653 passed, 317 skipped
PR checklist
For all contributions
- [ ] I've added myself to the list of contributors
- [x] The PR title starts with either [ENH], [MNT], [DOC], or [BUG]
For new estimators
- [ ] Not applicable
Hi! I’ve implemented the fix for issue #809 by removing the extra positional argument self.multioutput from the evaluate() calls in _evaluate_by_index.
All tests pass locally. Please let me know if any changes are needed.
Thanks for the suggestion!
I updated _evaluate_by_index to remove the extra positional argument passed to evaluate() and replaced the previous np.vstack logic with pandas drop() so the DataFrame structure is preserved.
I also added a regression test in test_probabilistic_metrics.py to ensure that evaluate_by_index runs without raising a TypeError for all probabilistic metrics.
I compared the implementation with sktime’s BaseForecastingErrorMetric._evaluate_by_index. In sktime, the implementation operates directly on forecasting data structures, whereas in skpro the predictions are probabilistic DataFrames with additional column levels. Using drop() instead of numpy stacking preserves the DataFrame structure expected by evaluate() and avoids breaking the validation logic.
All tests pass locally (661 passed, 317 skipped).
@fkiraly @felipeangelimvieira Hi! Just checking if any additional changes or tests are needed for this PR. Happy to update it if required. Thanks!