【问题标题】:What is `lr_policy` in Caffe?Caffe 中的“lr_policy”是什么?
【发布时间】:2015-07-14 00:19:57
【问题描述】:

我只是想了解如何使用Caffe。为此,我只是查看了示例文件夹中不同的.prototxt 文件。有一个选项我不明白:

# The learning rate policy
lr_policy: "inv"

可能的值似乎是:

  • "fixed"
  • "inv"
  • "step"
  • "multistep"
  • "stepearly"
  • "poly"

有人可以解释一下这些选项吗?

【问题讨论】:

    标签: machine-learning neural-network deep-learning caffe gradient-descent


    【解决方案1】:

    随着优化/学习过程的进行,降低学习率 (lr) 是一种常见的做法。然而,目前尚不清楚学习率应该如何作为迭代次数的函数而降低。

    如果您使用 DIGITS 作为 Caffe 的接口,您将能够直观地看到不同的选择如何影响学习率。

    固定:学习率在整个学习过程中保持固定。


    inv:学习率正在衰减为 ~1/T


    步骤:学习率是分段常数,每 X 次迭代下降一次


    多步:以任意间隔分段常数


    您可以在函数 SGDSolver<Dtype>::GetLearningRatesolvers/sgd_solver.cpp 第 ~30 行)中准确查看学习率是如何计算的。


    最近,我发现了一种有趣且非常规的学习率调整方法:Leslie N. Smith's work "No More Pesky Learning Rate Guessing Games"。在他的报告中,Leslie 建议使用lr_policy 交替降低和增加学习率。他的工作还提出了如何在 Caffe 中实施此策略。

    【讨论】:

    • No More Pesky ... 在性能上显然与使用 adadelta 相似。 Caffe 现在有多种自适应方案。
    【解决方案2】:

    如果您查看/caffe-master/src/caffe/proto/caffe.proto 文件(您可以在网上找到它here),您将看到以下描述:

    // The learning rate decay policy. The currently implemented learning rate
    // policies are as follows:
    //    - fixed: always return base_lr.
    //    - step: return base_lr * gamma ^ (floor(iter / step))
    //    - exp: return base_lr * gamma ^ iter
    //    - inv: return base_lr * (1 + gamma * iter) ^ (- power)
    //    - multistep: similar to step but it allows non uniform steps defined by
    //      stepvalue
    //    - poly: the effective learning rate follows a polynomial decay, to be
    //      zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power)
    //    - sigmoid: the effective learning rate follows a sigmod decay
    //      return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize))))
    //
    // where base_lr, max_iter, gamma, step, stepvalue and power are defined
    // in the solver parameter protocol buffer, and iter is the current iteration.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-11
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 2018-09-30
      • 2018-09-22
      • 2017-06-05
      相关资源
      最近更新 更多