在caffe源碼的caffe-master/sec/caffe/proto/caffe.proto下記錄了不同的學(xué)習(xí)策略的計(jì)算方法:
// 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.
fixed
參數(shù):
base_lr: 0.01
lr_policy: "fixed"
max_iter: 400000
學(xué)習(xí)率曲線:

step
參數(shù):
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 30
max_iter: 100
學(xué)習(xí)率曲線:

exp
參數(shù):
base_lr: 0.01
lr_policy: "exp"
gamma: 0.1
max_iter: 100
學(xué)習(xí)率曲線:

參數(shù) gamma 的值要小于1。當(dāng)?shù)扔?的時(shí)候,學(xué)習(xí)策略變?yōu)榱?fixed。由exp的學(xué)習(xí)率計(jì)算方式可以看出,在 gamma = 0.1 的情況下,學(xué)習(xí)率每迭代一次變?yōu)樯弦淮蔚?.1倍。
inv
參數(shù):
base_lr: 0.01
lr_policy: "inv"
gamma: 0.1
power: 0.75
max_iter: 10000
學(xué)習(xí)率曲線:

由上圖可以看出,參數(shù) gamma 控制曲線下降的速率,而參數(shù) power 控制曲線在飽和狀態(tài)下學(xué)習(xí)率達(dá)到的最低值。
multistep
參數(shù):
base_lr: 0.01
lr_policy: "multistep"
gamma: 0.5
stepvalue: 1000
stepvalue: 3000
stepvalue: 4000
stepvalue: 4500
stepvalue: 5000
max_iter: 6000
學(xué)習(xí)率曲線:

每一次學(xué)習(xí)率下降到之前的 gamma 倍。
poly
參數(shù):
base_lr: 0.01
lr_policy: "poly"
power: 0.5
max_iter: 10000
學(xué)習(xí)率曲線:

學(xué)習(xí)率曲線的形狀主要由參數(shù) power 的值來控制。當(dāng) power = 1 的時(shí)候,學(xué)習(xí)率曲線為一條直線。當(dāng) power < 1 的時(shí)候,學(xué)習(xí)率曲線是凸的,且下降速率由慢到快。當(dāng) power > 1 的時(shí)候,學(xué)習(xí)率曲線是凹的,且下降速率由快到慢。
sigmoid
參數(shù):
base_lr: 0.01
lr_policy: "sigmoid"
gamma: -0.001
stepsize: 5000
max_iter: 10000
學(xué)習(xí)率曲線:

參數(shù) gamma 控制曲線的變化速率。當(dāng) gamma < 0 時(shí),才能控制學(xué)習(xí)率曲線呈下降趨勢(shì),而且 gamma 的值越小,學(xué)習(xí)率在兩頭變化越慢,在中間區(qū)域變化越快。