machine learning(15) --Regularization:Regularized logistic regression
生活随笔
收集整理的這篇文章主要介紹了
machine learning(15) --Regularization:Regularized logistic regression
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Regularization:Regularized logistic regression
without regularization
?
-
- 當features很多時會出現(xiàn)overfitting現(xiàn)象,圖上的cost function是沒有使用regularization時的costfunction的計算公式
?
with regularization
?
-
- 當使用了regularization后,使θ1到n不那么大(因為要使J(θ)最小,θ12+θ22.....θn2->0這時θj要趨向于0),這樣可以避免overfitting出現(xiàn),如上圖中的粉色線的decision boundary.
- 注意不用對θ0使用regularization
Gradient descent
- without regularization
? ? ? ? ? ?
- with regularization
? ? ? ? ? ?
-
- 與linear regression在形式上相似,但是它們的hθ(x)不一樣
Advanced optimization method
-
- 在matlab和octave中,index都是從1開始的
-
[theta, cost] = ...
fminunc(@(t)(costFunction(t, X, y)), initial_theta, options);?%調(diào)用matlab的自帶的函數(shù)fminunc, @(t)(costFunction(t, X, y))創(chuàng)建一個function,參數(shù)為t,調(diào)用前面寫的 costFunction函數(shù),?返回求得最優(yōu)解后的theta和cost
轉(zhuǎn)載于:https://www.cnblogs.com/yan2015/p/4849471.html
總結(jié)
以上是生活随笔為你收集整理的machine learning(15) --Regularization:Regularized logistic regression的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#动态属性(.NET Framewor
- 下一篇: vs2015使用GIt连接git.osc