scikit-learn / scikit-learn/scikit-learn
Ensure RandomizedSearchCV (and other optimizers) skips duplicated hyperparameter combinations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 67.3k
- Forks
- 27.4k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 58
Description
Describe the workflow you want to enable
RandomizedSearchCV and similar hyperparameter tuners need to handle duplicate hyperparameter combinations. This issue is particularly noticeable when a user has a small number of hyperparameters, especially when they are integers or categorical values.
Describe your proposed solution
A set of frozendict objects representing previously tried combinations should be maintained. When a new combination is generated (or retrieved), it should be skipped if it exists in this set, as running cross-validation on the same hyperparameters would be redundant.
Describe alternatives you've considered, if relevant
There are no such alternatives.
Additional context
I was surprised to learn that RandomizedSearchCV in sklearn 1.5.1 allows duplicate hyperparameters combinations.
model.cv_results_['params']
[{'binningprocess__max_n_prebins': 7},
{'binningprocess__max_n_prebins': 14},
{'binningprocess__max_n_prebins': 22},
{'binningprocess__max_n_prebins': 14},
{'binningprocess__max_n_prebins': 22},
{'binningprocess__max_n_prebins': 11},
{'binningprocess__max_n_prebins': 13},
{'binningprocess__max_n_prebins': 22},
{'binningprocess__max_n_prebins': 20},
{'binningprocess__max_n_prebins': 20}]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at RandomizedSearchCV and the related hyperparameter optimizer entry points; trace where sampled combinations are generated and represented in cv_results_['params']. Determine how duplicate combinations should be skipped, including integer and categorical spaces, and verify that the reported parameter combinations contain no repeats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100