Skip to content

fix: handle scoring=None in GridSearchCV._fit to avoid AttributeError (#1009)#1014

Open
ekkoitac wants to merge 1 commit intosktime:mainfrom
ekkoitac:fix/1009-scoring-none-attrerror
Open

fix: handle scoring=None in GridSearchCV._fit to avoid AttributeError (#1009)#1014
ekkoitac wants to merge 1 commit intosktime:mainfrom
ekkoitac:fix/1009-scoring-none-attrerror

Conversation

@ekkoitac
Copy link
Copy Markdown

Fix Issue #1009: GridSearchCV scoring=None gives AttributeError

Problem: When scoring=None is passed to GridSearchCV.fit(), line 111 crashes with AttributeError: 'NoneType' object has no attribute 'name' because scoring.name is called without checking if scoring is None.

Fix: Check if scoring is not None before accessing scoring.name. When None, use "test_CPRS" as the scoring name, matching the documented behavior that scoring=None defaults to CRPS.

# Before
scoring_name = f"test_{scoring.name}"  # crashes when scoring is None

# After
scoring_name = f"test_{scoring.name}" if scoring is not None else "test_CPRS"  # safe fallback

…sktime#1009)

When scoring=None is passed to GridSearchCV.fit(), line 111 crashes with
AttributeError: 'NoneType' object has no attribute 'name'.

Fix: use 'test_CPRS' as scoring_name when scoring is None.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant