Skip to content

Fix sklearn API breakage when using search models with groups#286

Open
detrin wants to merge 1 commit into
ing-bank:mainfrom
detrin:fix/sklearn-groups-routing
Open

Fix sklearn API breakage when using search models with groups#286
detrin wants to merge 1 commit into
ing-bank:mainfrom
detrin:fix/sklearn-groups-routing

Conversation

@detrin

@detrin detrin commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #278.

PR #275 added groups=groups to the search model's .fit() call (line 457). This breaks on sklearn 1.7+ where metadata routing is enabled by default - RandomizedSearchCV.fit and GridSearchCV.fit reject groups as an unexpected argument.

The fix reverts that call to clone(self.model).fit(current_X, self.y). The groups parameter is only needed for the outer CV splits (lines 475/489), not for the inner hyperparameter search which runs its own internal CV.

Tested with sklearn 1.6.1 + metadata routing enabled manually, and all 25 feature_elimination tests pass.

@detrin detrin force-pushed the fix/sklearn-groups-routing branch from 387f3df to 36f5c90 Compare April 4, 2026 22:42
Reverts the search model .fit() call to not pass groups directly,
which breaks on sklearn 1.7+ with metadata routing enabled.
@detrin detrin force-pushed the fix/sklearn-groups-routing branch 2 times, most recently from c708064 to 66be0d6 Compare April 4, 2026 23:17
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.

Sklearn API Changes

1 participant