I'm using keras 2.1.* and want to change the learning rate during training. I know about the schedule callback, but I don't use fit function and I don't have callbacks. I use train_on_batch. Is it possible in keras ?

Solution 1

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

If you use other functions like train_on_batch, you can change the learning rate with this way

From keras import backend as K
 Old_lr = K.get_value(model.optimizer.lr) New_lr = old_lr * 0.1 # change however you want K.set_value(model.optimizer.lr, new_lr)

github issue: https://github.com/keras-team/keras/issues/898

aipool discussion: https://ai-pool.com/d/dynamic_learning_rate_in_training

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄