sklearn中超参数的代理自适应随机搜索。
sklearn-surrogatesearchcv的Python项目详细描述
代理搜索简历
这个包实现了对sklearn的随机超参数搜索(类似于RandomizedSearchCV
),但是使用了来自pysot的代理自适应采样。使用这个类似于gridsearchcv的几个额外参数。
用法
pip install sklearn-surrogatesearchcv
这个界面缺乏想象力,在风格上类似于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
"""
运行后,可以在类实例的以下属性中找到结果。
params_history_
score_history_
best_params_
best_score_
有关完整的示例,请参阅src/test/test_basic.py
。
资源
关于代理项优化在ml中的作用的幻灯片。link