[BUG] - bugfix, GridSearchCV scoring=None defaults to CRPS#1010
[BUG] - bugfix, GridSearchCV scoring=None defaults to CRPS#1010MaazAli8460 wants to merge 2 commits intosktime:mainfrom
Conversation
If scoring= None, set it to CRPS().
There was a problem hiding this comment.
Pull request overview
Fixes GridSearchCV crashing when scoring=None by applying the documented default metric (CRPS) during fitting.
Changes:
- Import
CRPSintoskpro.model_selection._tuning. - In
BaseGridSearch._fit, replacescoring=NonewithCRPS()before usingscoring.name/scoring.get_tag.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # scoring = check_scoring(self.scoring, obj=self) | ||
| scoring = self.scoring | ||
| if scoring is None: | ||
| scoring = CRPS() | ||
| scoring_name = f"test_{scoring.name}" |
There was a problem hiding this comment.
Add a regression test to cover the scoring=None path (issue #1009). Without a test, this bug is likely to reappear since BaseGridSearch._fit relies on scoring.name/get_tag and will crash if scoring is ever left as None again. A minimal test can instantiate GridSearchCV with scoring=None, run fit, and assert that cv_results_ contains the expected CRPS-derived score column (e.g., mean_test_CRPS) and that no AttributeError is raised.
fkiraly
left a comment
There was a problem hiding this comment.
What exactly does this fix?
If it fixes a bug, please describe it - possibly in an issue, if it is longer - and also add a test for the bug being fixed.
|
@fkiraly Thanks for the review. Test Code: In skpro\model_selection\ _tuning.py Raises error After fix On same test code |
…ring= None, should default to CRPS()
If scoring= None, set it to CRPS().
Reference Issues/PRs
Fixes #1009.
What does this implement/fix? Explain your changes.
If scoring= None, set it to CRPS(). in _tuning.py
Does your contribution introduce a new dependency? If yes, which one?
No.
What should a reviewer concentrate their feedback on?
Did you add any tests for the change?
No. I don't think a separate test is necessary here.
PR checklist
For all contributions
How to: add yourself to the all-contributors file in the
skproroot directory (not theCONTRIBUTORS.md). Common badges:code- fixing a bug, or adding code logic.doc- writing or improving documentation or docstrings.bug- reporting or diagnosing a bug (get this pluscodeif you also fixed the bug in the PR).maintenance- CI, test framework, release.See here for full badge reference
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensureddependency isolation, see the estimator dependencies guide.