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

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

Dynamic learning rate in training - 培训中的动态学习率的更多相关文章

  1. A novel multi-swarm particle swarm optimization with dynamic learning strategy(一种新颖的具有动态学习策略的多种群粒子群优化算法)

    1.核心 在每个子种群的粒子被划分为普通粒子(ordinary particles)和交流粒子(communication particles),在每次迭代过程中,不同的粒子执行不同的进化操作.普通粒 ...

  2. TensorFlow使用记录 (三): Learning Rate Scheduling

    file: tensorflow/python/training/learning_rate_decay.py 参考:tensorflow中常用学习率更新策略 神经网络中通过超参数 learning ...

  3. 权重衰减(weight decay)与学习率衰减(learning rate decay)

    本文链接:https://blog.csdn.net/program_developer/article/details/80867468“微信公众号” 1. 权重衰减(weight decay)L2 ...

  4. Keras 自适应Learning Rate (LearningRateScheduler)

    When training deep neural networks, it is often useful to reduce learning rate as the training progr ...

  5. Deep Learning 32: 自己写的keras的一个callbacks函数,解决keras中不能在每个epoch实时显示学习速率learning rate的问题

    一.问题: keras中不能在每个epoch实时显示学习速率learning rate,从而方便调试,实际上也是为了调试解决这个问题:Deep Learning 31: 不同版本的keras,对同样的 ...

  6. 1506.01186-Cyclical Learning Rates for Training Neural Networks

    1506.01186-Cyclical Learning Rates for Training Neural Networks 论文中提出了一种循环调整学习率来训练模型的方式. 如下图: 通过循环的线 ...

  7. 学习率 Learning Rate

    本文从梯度学习算法的角度中看学习率对于学习算法性能的影响,以及介绍如何调整学习率的一般经验和技巧. 在机器学习中,监督式学习(Supervised Learning)通过定义一个模型,并根据训练集上的 ...

  8. 学习率(Learning rate)的理解以及如何调整学习率

    1. 什么是学习率(Learning rate)?   学习率(Learning rate)作为监督学习以及深度学习中重要的超参,其决定着目标函数能否收敛到局部最小值以及何时收敛到最小值.合适的学习率 ...

  9. 深度学习: 学习率 (learning rate)

    Introduction 学习率 (learning rate),控制 模型的 学习进度 : lr 即 stride (步长) ,即反向传播算法中的 ηη : ωn←ωn−η∂L∂ωnωn←ωn−η∂ ...

随机推荐

  1. webmagic爬虫抓取工作室成员博客

    一.导入依赖 <!--webmagic依赖--> <dependency> <groupId>us.codecraft</groupId> <ar ...

  2. java代码块,静态代码块,静态变量,构造方法执行顺序

    一个类中执行顺序: 静态变量静态代码块代码块构造方法 子类和父类执行顺序: 父类静态变量父类静态代码块子类静态变量子类静态代码块父类代码块父类构造方法子类代码块子类构造方法 直接看代码,一目了然. p ...

  3. Linux下复制文件

    命令: cp -Rf /文件名1/*               /文件名2 把文件夹1下的文件复制到文件2中(/* 表示复制文件夹1下的文件,不复制文件夹1)

  4. CF786B Legacy

    思路 线段树优化建图 基本思想就是要把一个区间连边拆成log个节点连边, 然后一颗入线段树,一颗出线段树,出线段树都由子节点向父节点连边(可以从子区间出发),入线段树从父节点向子节点连边(可以到达子区 ...

  5. git Remote: HTTP Basic: Access denied Git failed with a fatal error.

    解决方案: git clone 项目失败,报下面的错误信息: $ git clone http://192.168.0.141/xxxx.git Cloning into 'appEnterprise ...

  6. Numpy 基础

    Numpy 基础 参考https://www.jianshu.com/p/83c8ef18a1e8 import numpy as np 简单创建数组 # 创建简单列表 a = [1, 2, 3, 4 ...

  7. css3常用动效以及总结

    (迁移自旧博客2017 08 06) CSS3 文本效果: box-shadow:盒子阴影,可以给卡片添加提高美化效果.可广泛应用于内容展示页面. <div class="card&q ...

  8. python程序—士兵出击

    class Gun: def __init__(self,gun_type): self.gun_type=gun_type self.bullet_count= def add_bullet(sel ...

  9. 使用SpringMVC框架实现文件上传和下载功能

    使用SpringMVC框架实现文件上传和下载功能 (一)单个文件上传 ①配置文件上传解释器 <!—配置文件上传解释器 --> <mvc:annotation-driven>&l ...

  10. 三、原子变量与CAS算法

    原子变量:jdk1.5 后 java.util.concurrent.atomic 包下提供了常用的原子变量: - AtomicBoolean - AtomicInteger - AtomicLong ...