for i, suggestion in enumerate(running_suggestions): n_history = len(suggestion['reward']) if n_history == CONFIDENCE_N_ITERATION: # 当前配置已完整验证 , 无需早停 print('full observatio...
for i, suggestion in enumerate(running_suggestions):
n_history = len(suggestion['reward'])
if n_history == CONFIDENCE_N_ITERATION:
# 当前配置已完整验证 , 无需早停
print('full observation. pass', i)
continue
if n_history not in self.hps['prune_iters']:
# 当前配置不处于需要早停的阶段
print('n_history: %d not in prune_iters: %s. pass %d.'
% (n_history, self.hps['prune_iters'], i))
continue
rank = bracket[n_history].index(suggestion['reward'][-1]['value'])
total_cnt = len(bracket[n_history])
# 判断当前配置性能是否处于前1/eta , 否则早停
if rank / total_cnt >= 1 / self.hps['prune_eta']:
print('n_history: %d, rank: %d/%d, eta: 1/%s. PRUNE %d!'
% (n_history, rank, total_cnt, self.hps['prune_eta'], i))
stop_list[i] = True
else:
print('n_history: %d, rank: %d/%d, eta: 1/%s. continue %d.'
% (n_history, rank, total_cnt, self.hps['prune_eta'], i))
return stop_list
文章图片
代码以图示为准
基于置信区间的早停方法可见我们的比赛开源代码库 。
数据建模方法
对于贝叶斯优化的数据建模 , 我们尝试了多精度集成代理模型 MFES-HB[6]拟合多精度观测数据 。 该方法虽然能应对低精度噪声场景 , 但在决赛极其有限的优化时间限制内 , 可能无法快速排除噪声的干扰 , 导致效果不如仅使用最高精度数据建模 。
我们最终选择只利用最高精度数据进行建模 。 为了弥补早停造成的高精度数据损失 , 我们引入插值方法 , 增加用于模型训练的数据量 , 具体来说 , 就是对早停的配置 , 设置一个完整验证时的性能均值 , 插入优化历史执行建模 。 对于插入值的选取 , 我们使用已完整验证配置的最终均值中位数进行插值 。
以下为插值代码示例:
def set_impute_value(self, running_suggestions, suggestion_history):
value_list = []
for suggestion in running_suggestions + suggestion_history:
n_history = len(suggestion['reward'])
if n_history != CONFIDENCE_N_ITERATION:
continue
value_list.append(suggestion['reward'][-1]['value'])
self.impute_value = https://www.sohu.com/a/np.median(value_list).item()
文章图片
代码以图示为准
总结
本文介绍了自动化超参数优化赛道的冠军方案 , 包括贝叶斯优化算法和早停方法 。 很幸运能够拿到此次比赛的冠军 。 感谢赛事主办方为我们提供了富有现实意义的比赛场景 , 让我们积累了宝贵的比赛经验和超参数优化实际经验 。 希望我们的分享能够对大家有所帮助 。
引用
[1] 黑盒优化系统 OpenBox
https://github.com/PKU-DAIR/open-box
[2] 自动化机器学习系统 MindWare
https://github.com/PKU-DAIR/mindware
[3] 比赛冠军源码
https://github.com/PKU-DAIR/2021_AIAC_Task2_1st
[4] https://github.com/automl/ConfigSpace
[5] Liam Li, Kevin Jamieson, Afshin Rostamizadeh, Ekaterina Gonina, Jonathan Bentzur, Moritz Hardt, Benjamin Recht, and Ameet Talwalkar. 2020. A System for Massively Parallel Hyperparameter Tuning. Proceedings of Machine Learning and Systems 2 (2020), 230–246.
[6] Yang Li, Yu Shen, Jiawei Jiang, Jinyang Gao, Ce Zhang, and Bin Cui. 2021. MFES-HB: Efficient Hyperband with Multi-Fidelity Quality Measurements. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 35. 8491–8500.
[7] Yang Li, Yu Shen, Wentao Zhang, Yuanwei Chen, Huaijun Jiang, Mingchao Liu, Jiawei Jiang, Jinyang Gao, Wentao Wu, Zhi Yang, Ce Zhang, and Bin Cui. 2021. OpenBox: A Generalized Black-box Optimization Service. Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining (2021).
特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
