【機(jī)器學(xué)習(xí)】-Week5.5 Gradient Checking

Gradient Checking

Gradient checking will assure that our backpropagation works as intended. We can approximate the derivative of our cost function with:

With multiple theta matrices, we can approximate the derivative?with respect to?Θj?as follows:

A small value for???(epsilon) such as??=10^?4, guarantees that the math works out properly. If the value for???is too small, we can end up with numerical problems.

Hence, we are only adding or subtracting epsilon to the?Θj?matrix. In octave we can do it as follows:

We previously saw how to calculate the deltaVector. So once we compute our gradApprox vector, we can check that gradApprox ≈ deltaVector.

Once you have verified?once?that your backpropagation algorithm is correct, you don't need to compute gradApprox again. The code to compute gradApprox can be very slow.

來(lái)源:coursera 斯坦福 吳恩達(dá) 機(jī)器學(xué)習(xí)

?著作權(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)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

  • 參數(shù)展開(kāi) 在Octave中,若我們需要使用fminuc函數(shù)來(lái)計(jì)算使得代價(jià)函數(shù)最小化的權(quán)重矩陣,我們需要將參數(shù)矩陣展...
    SmallRookie閱讀 530評(píng)論 0 0
  • 國(guó)飲黔茶閱讀 371評(píng)論 0 0
  • 做一件事兒肯定是有原因,我來(lái)做這個(gè)事兒的原因,是因?yàn)槲淫i哥思考需要在,路漫漫其修遠(yuǎn)兮,上下求索。 然后...鑫哥覺(jué)...
    TsingQue閱讀 2,248評(píng)論 0 3
  • 昨天剛在網(wǎng)上說(shuō)了自學(xué)考試的事,今天簡(jiǎn)書(shū)就出現(xiàn)了自學(xué)考試的考生在某機(jī)構(gòu)受騙的事 其實(shí)說(shuō)實(shí)話,那也不能叫上當(dāng)受騙 有好...
    鉤鉤手閱讀 548評(píng)論 0 2
  • “男神,等我!老娘自由啦!”犟驢昨晚發(fā)朋友圈向全世界宣告。 犟驢,原名江瑜茹,性格倔強(qiáng),認(rèn)準(zhǔn)的事九頭牛也拉不回來(lái),...
    貪禪閱讀 745評(píng)論 0 3

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