using learning rate schedules for deep learning models in python with keras

来源:互联网 发布:泛伊斯兰主义知乎 编辑:程序博客网 时间:2024/05/29 16:12

训练神经网络或深度学习模型是一个非常困难的优化任务。

训练神经网络最经典的算法是随机梯度下降法。

通过在训练中对学习率的调整,可以获得更好的性能,更快的训练速度。

下面学习使用keras的深度学习库来调整神经网络模型的学习率。
how to configure and evaluate a time-based learning rate schedule
how to configure and evaluate a drop-based learning rate schedule

在随机梯度下降的优化过程中,调整学习率能够提高性能和减少训练时间。
有时候,这个称之为学习率的磨炼。默认的方法是设置学习率为常数,然后在每次epoch训练时更新网络的权重。

最简单或许也是常用的方法是随机时间的消耗,降低学习率。这样的好处是可以在最开始的时候可以做很大的调整。

两个比较流行和简单的方法是:
decrease the learning rate gradually based on the epoch
decrease the learning rate using punctuated large drops at specific epochs

基于时间的学习率调整:随机时间的过去,学习率会降低

drop-based 学习率:在训练期间的某些特殊时刻里,系统的drop the learning rate。比如,初始学习率设为0.1,每10个epochs就减半,因此前10次epochs的学习率是0.1,从第11次epoch开始,学习率就是0.05了,依此类推。这个在keras中的实现就是使用LearningRateScheduler这个回调函数。

调整学习率的一些小技巧:
increase the initial learning rate,设置得大一点,后面才有下降的空间啊,有更多的调整。
use a large momentum,可以持续的进行更新啥的
experiment with different schedules

阅读全文
0 0
原创粉丝点击