我只是試圖找出如何使用Caffe。爲此,我只查看了示例文件夾中不同的.prototxt
文件。有一個選項,我不明白:Caffe中的lr_policy是什麼?
# The learning rate policy
lr_policy: "inv"
可能值似乎是:
"fixed"
"inv"
"step"
"multistep"
"stepearly"
"poly"
有人請解釋這些選項嗎?
我只是試圖找出如何使用Caffe。爲此,我只查看了示例文件夾中不同的.prototxt
文件。有一個選項,我不明白:Caffe中的lr_policy是什麼?
# The learning rate policy
lr_policy: "inv"
可能值似乎是:
"fixed"
"inv"
"step"
"multistep"
"stepearly"
"poly"
有人請解釋這些選項嗎?
如果你看看/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.
隨着優化/學習過程的進展,降低學習率(lr)是一種常見的做法。然而,目前尚不清楚學習率應該如何作爲迭代次數的函數而降低。
如果您使用DIGITS作爲Caffe的界面,您將可以直觀地看到不同選擇對學習率的影響。
fixed:學習率在整個學習過程中保持不變。
INV:學習率被衰減爲〜1/T
步驟:學習速率是分段常數,滴每X次迭代
多步:以任意的間隔
分段常可以看到學習率究竟是如何在功能SGDSolver<Dtype>::GetLearningRate
計算(求解/sgd_solver.cpp線〜30)。
最近,我遇到了一個有趣的和非常規的方法來學習率調整:Leslie N. Smith's work "No More Pesky Learning Rate Guessing Games"。在他的報告中,萊斯利建議使用lr_policy
,其遞減率和之間交替增加的學習率。他的工作還建議如何在Caffe中實施這項政策。
沒有更多麻煩的......在性能上採用adadelta明顯相似。 Caffe現在有多種自適應方案。 –