Skip to content

Fixed 21895, GridSearchCV and RandomizedSearchCV Ranking Issue - #9

Merged
pasaaliaslan merged 13 commits into
mainfrom
dev
Mar 20, 2022
Merged

pasaaliaslan merged 13 commits into
mainfrom
dev

Conversation

@pasaaliaslan

Copy link
Copy Markdown
Collaborator

Reference Issues/PRs

Fixes scikit-learn#21895

What does this implement/fix? Explain your changes.

When there are multiple params with rank=1, GridSearchCV and RandomizedSearchCV fit.best_params_ would return the first one in the order params appear in the list. However, when given the exact same params in different order, fit.best_params_ might return a different param, creating an ambiguity.

To solve this issue, lexicographical order of the params are considered instead of the order they appear in the list. In this way, independent from the order params are given, fit.best_params_ will return exactly the same output.

Lexicographical order is decided with the attributes of the estimators being used and order is calculated with _hash_param_values method.

@pasaaliaslan
pasaaliaslan merged commit 54e8e9e into main Mar 20, 2022
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.

GridSearchCV & RandomizedSearchCV has a ranking issue when test scores are same.

7 participants