2018-07-12

在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í)率曲線:


fixed.jpeg

step

參數(shù):

base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 30
max_iter: 100

學(xué)習(xí)率曲線:


step.jpeg

exp

參數(shù):

base_lr: 0.01
lr_policy: "exp"
gamma: 0.1
max_iter: 100

學(xué)習(xí)率曲線:


image.png

參數(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í)率曲線:


inv.jpeg

由上圖可以看出,參數(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í)率曲線:


multistep.jpeg

每一次學(xué)習(xí)率下降到之前的 gamma 倍。

poly

參數(shù):

base_lr: 0.01
lr_policy: "poly"
power: 0.5
max_iter: 10000

學(xué)習(xí)率曲線:


poly.jpeg

學(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í)率曲線:


sigmoid.jpeg

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 為什么長(zhǎng)大后的我們,越來越難交到知心朋友? 「 1 」 我們以前聊過很多次 社會(huì)交換理論(Social Excha...
    鞋說歪道閱讀 370評(píng)論 0 0
  • 我的妻子是一位內(nèi)向,勤勞,樸實(shí),稍有點(diǎn)遠(yuǎn)見的農(nóng)村婦女。 她家的親戚曾和我聊起她的事,結(jié)婚前,有一次,一位...
    香自苦寒閱讀 620評(píng)論 1 1
  • 錯(cuò)誤的記憶方式讓你的效率止步不前 在中國(guó)的應(yīng)試教育下,記憶量成為了大部分中國(guó)學(xué)生想要逃避的問題,想要解決這個(gè)問題,...
    不行雞閱讀 688評(píng)論 0 2
  • 下午第一節(jié)課間,昨天那位同學(xué)再一次坐到了讀書吧的固定位置。下午的陽光直射在他所在的書桌,我建議他坐到我的對(duì)面來,我...
    青眸m閱讀 482評(píng)論 0 6
  • 一天如果沒有坐下來做冥想,似乎缺少了什么,實(shí)際上,一天也沒什么事情要做,但時(shí)間似乎就在不經(jīng)意間流逝,被誰偷走了呢?...
    春雨_373c閱讀 139評(píng)論 0 0

友情鏈接更多精彩內(nèi)容