machine-learning - Hyperopt 更改 Trials() 对象的值;热启动 Hyperopt
问题描述
我正在寻找一种可能来启动 Hyperopt。一种方法是用超参数手动填充列表Trials.trials
这实际上是可能的,但我想知道这是否真的影响优化,或者这个 Trials.trials 是否只是 Trials 对象和 Hyperopt 的可见部分。
解决方案
trial.trials 列表不包含所有信息!由于baye.py 中的resfresh 函数,还必须更改试验。
一般来说,热启动应该是可能的。我通过在具有一些任意搜索空间和目标函数的新试验对象上调用 fmin,创建了一个与我的热启动状态大小相同的假试验对象。在此之后,可以通过迭代 trial.trials 的长度并设置如下值来更改试验对象:
list_of_coldstart_dict = [one_possible_and_evaluation,second_possible_and_evaluation,...]
fake_space = {
'test': 2-hp.loguniform('test_02',0.001, 0.1)
}
def Objective(params):
return {"loss":0, 'status': STATUS_OK}
trials = Trials()
fmin(Objective,fake_space,
algo=partial(tpe.suggest, n_startup_jobs=len(list_of_coldstart_dict)), max_evals=len(list_of_coldstart_dicts),
trials=new_trials,verbose=1)
for in in range(len(trials.trials):
trials.trials[i] = list_of_coldstart_dict[i]
trials._dynamic_trials[i] = list_of_coldstart_dict[i]
trials.results[i] = trials.trials[i]['result']
注意在 trial.trials[i] 中维护 dict of dicts 的 neccecary 结构
推荐阅读
- c# - 使用 SSIS 使用合并列取消透视数据 excel
- mysql - Mysql更新日期相对于特定列更新
- rx-java - 仅发送通知之类的事件而不一定是对象 [RxJava] 的主题
- javascript - 如何在警报()框打开并且在一段时间内未单击“确定”时重定向页面
- javascript - Create React App 使用 react-router 和 firebase 构建空文档(空白屏幕)?
- pyqt5 - 如何使复制粘贴遵循相同的模式
- python - 绘制某些值时,matplotlib 图的轴不按数字顺序排列
- java - 无法解析 Vaadin 的符号
- sql-server - NOT IN 语句正在减慢我的查询速度
- python - ctypes、GetErrorCode 6、LoadLibrary 和 Modulehandle 返回 None?