https://github.com/bettercallshao/sklearn_surrogatesearchcv
Surrogate adaptive randomized search for hyper-parameters tuning in sklearn.
https://github.com/bettercallshao/sklearn_surrogatesearchcv
cross-validation data-science hyper-parameter-tuning machine-learning optimization pysot python sklearn surrogate-based-optimization
Last synced: about 2 months ago
JSON representation
Surrogate adaptive randomized search for hyper-parameters tuning in sklearn.
- Host: GitHub
- URL: https://github.com/bettercallshao/sklearn_surrogatesearchcv
- Owner: bettercallshao
- License: mit
- Created: 2018-12-10T01:19:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-13T06:55:38.000Z (over 5 years ago)
- Last Synced: 2025-03-07T21:16:43.680Z (3 months ago)
- Topics: cross-validation, data-science, hyper-parameter-tuning, machine-learning, optimization, pysot, python, sklearn, surrogate-based-optimization
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Surrogate Search CV
[](https://circleci.com/gh/bettercallshao/sklearn_surrogatesearchcv)
[](https://badge.fury.io/py/sklearn-surrogatesearchcv)This package implements a randomized hyper parameter search for sklearn (similar to `RandomizedSearchCV`) but utilizes surrogate adaptive sampling from pySOT. Use this similarly to GridSearchCV with a few extra paramters.
## Usage
```
pip install sklearn-surrogatesearchcv
```The interface is unimaginative, stylistically similar to `RandomizedSearchCV`.
```
class SurrogateSearchCV(object):
"""Surrogate search with cross validation for hyper parameter tuning.
"""def __init__(self, estimator, n_iter=10, param_def=None, refit=False,
**kwargs):
"""
:param estimator: estimator
:param n_iter: number of iterations to run (default 10)
:param param_def: list of dictionaries, e.g.
[
{
'name': 'alpha',
'integer': False,
'lb': 0.1,
'ub': 0.9,
},
{
'name': 'max_depth',
'integer': True,
'lb': 3,
'ub': 12,
}
]
:param **: every other parameter is the same as GridSearchCV
"""
```The result can be found in the following properties of the class instance after running.
```
params_history_
score_history_
best_params_
best_score_
```For a complete example, please refer to `src/test/test_basic.py`.
## Resources
A slide about role of surrogate optimization in ml. [link](https://www.slideshare.net/TimTan2/machine-learning-vs-traditional-optimization)