10. Advice for applying machine learning

Advice for applying machine learning

Deciding what to try next

Debugging a learining algorithm:

  • Get more training set. (Sometimes doesn't actrully help)
  • Try smaller sets of features. ()
  • Try getting additional features
  • Try adding polynomial features
  • Try decreasing or increasing \lambda

Machine learning diagnostic: save your time.

Evaluating a hypothesis

Test your hypothesis whether overfitting or not:

  • Split your training into 2 part.one is Training set (70%),another is Test set(30%).

Training/testing procedure for logistic regression

  • Learn parameter \theta from training data
  • Compute test set error (liner/logistic regression)
  • Misclassification error (logistic regression)

Model selection and training/validation/test sets

when using J(\Theta) to select which model to choose, overfitting may be happen and the result the model perform best isn't generlized.
J_{test}(\theta^{(5)} is likely to be an optimistic estimate of generalization error.

Split the dataset into 3 pieces.

  • training set (60%)
  • cross validation set (20%)
  • testing set (20%)

Use the cross validation to select model.
Use the testing set to test the generlazation error.

Diagnosing bias vs. variance

underfitting overfitting

Bias (underfit): J_{train}(\Theta) will be high; J_{cv}(\Theta)\approx J_{train}(\Theta)
Variance(overfit): J_{trian} will be low; J_{cv}(\Theta)\gg J_{train}(\Theta)

Regularization and bias/variance

To find a good \lambda
Try 0 0.01 0.02 0.04 0.08 ...10.24
Get many \Theta.
Use cross validation set to compute J_{cv}(\Theta), pick the minium of these J_{cv}(\Theta)

There are two figure in the two videos before, it's very useful to help to understand how the cross validation set helps to get best model and best \lambda

Learing curves

  • J_{train}(\theta)
  • J_{cv}(\theta)

error to m (training set size)

If a learing algorithe is suffering from high bies, getting more training data will not help much.

If a learning algorithm is suffering from high variance, getting more training data is likely to help .

Deciding what to try next (revisited)

bias: underfit
varaance: overfit

  • Get more training examples: fix high variance
  • Try smaller sets of features: fix high variance
  • Try getting additional features: fix high bias
  • Try adding polynomial features: fix high bias
  • Try decreasiong \lambda: fix high bias
  • Try increasing \lambda: fix high variance
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末绪妹,一起剝皮案震驚了整個濱河市渡紫,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌蘸炸,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,590評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異墩朦,居然都是意外死亡烟号,警方通過查閱死者的電腦和手機绊谭,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,157評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來汪拥,“玉大人达传,你說我怎么就攤上這事。” “怎么了宪赶?”我有些...
    開封第一講書人閱讀 169,301評論 0 362
  • 文/不壞的土叔 我叫張陵宗弯,是天一觀的道長。 經常有香客問我搂妻,道長蒙保,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,078評論 1 300
  • 正文 為了忘掉前任欲主,我火速辦了婚禮邓厕,結果婚禮上,老公的妹妹穿的比我還像新娘扁瓢。我一直安慰自己详恼,他們只是感情好,可當我...
    茶點故事閱讀 69,082評論 6 398
  • 文/花漫 我一把揭開白布引几。 她就那樣靜靜地躺著昧互,像睡著了一般。 火紅的嫁衣襯著肌膚如雪伟桅。 梳的紋絲不亂的頭發(fā)上敞掘,一...
    開封第一講書人閱讀 52,682評論 1 312
  • 那天,我揣著相機與錄音楣铁,去河邊找鬼渐逃。 笑死,一個胖子當著我的面吹牛民褂,可吹牛的內容都是我干的茄菊。 我是一名探鬼主播,決...
    沈念sama閱讀 41,155評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼赊堪,長吁一口氣:“原來是場噩夢啊……” “哼面殖!你這毒婦竟也來了?” 一聲冷哼從身側響起哭廉,我...
    開封第一講書人閱讀 40,098評論 0 277
  • 序言:老撾萬榮一對情侶失蹤脊僚,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后遵绰,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體辽幌,經...
    沈念sama閱讀 46,638評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,701評論 3 342
  • 正文 我和宋清朗相戀三年椿访,在試婚紗的時候發(fā)現(xiàn)自己被綠了乌企。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,852評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡成玫,死狀恐怖加酵,靈堂內的尸體忽然破棺而出拳喻,到底是詐尸還是另有隱情,我是刑警寧澤猪腕,帶...
    沈念sama閱讀 36,520評論 5 351
  • 正文 年R本政府宣布冗澈,位于F島的核電站,受9級特大地震影響陋葡,放射性物質發(fā)生泄漏亚亲。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 42,181評論 3 335
  • 文/蒙蒙 一腐缤、第九天 我趴在偏房一處隱蔽的房頂上張望朵栖。 院中可真熱鬧,春花似錦柴梆、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,674評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至雹有,卻和暖如春偿渡,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背霸奕。 一陣腳步聲響...
    開封第一講書人閱讀 33,788評論 1 274
  • 我被黑心中介騙來泰國打工溜宽, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人质帅。 一個月前我還...
    沈念sama閱讀 49,279評論 3 379
  • 正文 我出身青樓适揉,卻偏偏與公主長得像,于是被迫代替她去往敵國和親煤惩。 傳聞我的和親對象是個殘疾皇子嫉嘀,可洞房花燭夜當晚...
    茶點故事閱讀 45,851評論 2 361