當前位置:
首頁 >
machine learning(15) --Regularization:Regularized logistic regression
發布時間:2025/7/25
41
豆豆
生活随笔
收集整理的這篇文章主要介紹了
machine learning(15) --Regularization:Regularized logistic regression
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Regularization:Regularized logistic regression
without regularization
?
-
- 當features很多時會出現overfitting現象,圖上的cost function是沒有使用regularization時的costfunction的計算公式
?
with regularization
?
-
- 當使用了regularization后,使θ1到n不那么大(因為要使J(θ)最小,θ12+θ22.....θn2->0這時θj要趨向于0),這樣可以避免overfitting出現,如上圖中的粉色線的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);?%調用matlab的自帶的函數fminunc, @(t)(costFunction(t, X, y))創建一個function,參數為t,調用前面寫的 costFunction函數,?返回求得最優解后的theta和cost
轉載于:https://www.cnblogs.com/yan2015/p/4849471.html
總結
以上是生活随笔為你收集整理的machine learning(15) --Regularization:Regularized logistic regression的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#动态属性(.NET Framewor
- 下一篇: vs2015使用GIt连接git.osc