模型调参
9.1 模型调参【斯坦福21秋季:实用机器学习中文版】_哔哩哔哩_bilibili
-
Start with a good baseline,e.g.default settings in high-quality toolkits,values reported in papers.
- 参考其他论文中的一些超参数
-
turn a value,retrain the model to see the changes
- 如果一次调整太多值,则无法确定是什么值在做贡献
-
Repeat multiple times to gain insights about
-
Which hyperparameters are important
-
How sensitive the model to hyperparameters
-
What are the good ranges
-
多次调整去得到一些相关的见解:
-
什么参数敏感,什么参数不敏感
-
大家经常在优化模型里面使用Adam算法,但是这个算法不见得比SGD优秀,SGD在调参调好的时候,通常在收敛速度以及精度上优与Adam。
Adam对于学习率没有那么敏感,所以调起来比较方便。
-
-
-
-
Needs careful experiment management
- 实验很多,调整的情况复杂,时间一长就容易忘记,需要详细的记录
-
Save your training logs and hyperparameters to compare ,share and reproduce later
- The simplest way is saving logs in text and put key metrics in Excel
- Better options exist, e.g. tensorboard and weights&bias
-
Reproducing is hard,it relates to
- Environment(hardware & library(不同版本python,可能不兼容))
- Code
- Randomness(seed)
- 受随机情况影响大:
- 用多个模型做Ensemble,将其融合起来
- 加权平均
- 受随机情况影响大:
-
Computation costs decrease exponentially,while human costs increase
-
Cost per training for a typical ML task:
- E.g. 1M user logs,10K images
-
Use algorithms if it outperforms human after 1000 trials
-
Typically beat 90% data scientists
-
大多数情况下,机器调参由于人:
- 在小任务上很多时候已经可以用机器来做了
- 训练树模型在CPU上花10min 大概花$0.4
- 训练神经网络在GPU花1h左右 大概花$5
- 跟人比(人大概花十天左右),算法训练1000次调参数,很有可能会打败人类(90%)
-
-
Automatic Machine Learning (AutoML)
- 解决真实问题:模型清理,特征提取,模型选择
- Hyperparameter optimization(HPO):
- 通过搜索的方法找到一个很好的超参数集合
- Neural architecture search(NAS):
HPO):- 通过搜索的方法找到一个很好的超参数集合
- Neural architecture search(NAS):
- construct a good neural network model(在已有的神经网络模型上构造出一个可以fit到现有任务的模型)