Repository navigation
Fixed 21895, GridSearchCV and RandomizedSearchCV Ranking Issue - #9
Merged
Merged
Conversation
…t lexicographic order when there are multiple rank 1 params.
…t lexicographic order when there are multiple rank 1 params.
Fix/search cv
pasaaliaslan
requested review from
VKo232,
ciaran-h,
jwoodger,
lialber2 and
trinhcon
March 20, 2022 20:43
lialber2
approved these changes
Mar 20, 2022
trinhcon
approved these changes
Mar 20, 2022
ciaran-h
approved these changes
Mar 20, 2022
VKo232
approved these changes
Mar 20, 2022
jwoodger
approved these changes
Mar 20, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.