Hands-On Machine Learning with Scikit-Learn and TensorFlow


Regularized Linear Models | 141



Download 26,57 Mb.
Pdf ko'rish
bet118/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   114   115   116   117   118   119   120   121   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

Regularized Linear Models | 141


15
You can think of a subgradient vector at a nondifferentiable point as an intermediate vector between the gra‐
dient vectors around that point.
global minimum is on the 
θ
2
= 0 axis. BGD first reaches 
θ
2
= 0, then rolls down the
gutter until it reaches the global minimum. The two bottom plots show the same
thing but uses an ℓ
2
penalty instead. The regularized minimum is closer to θ = 0 than
the unregularized minimum, but the weights do not get fully eliminated.
Figure 4-19. Lasso versus Ridge regularization
On the Lasso cost function, the BGD path tends to bounce across
the gutter toward the end. This is because the slope changes
abruptly at 
θ
2
= 0. You need to gradually reduce the learning rate in
order to actually converge to the global minimum.
The Lasso cost function is not differentiable at 
θ
i
= 0 (for 
i
= 1, 2, 


n
), but Gradient
Descent still works fine if you use a 
subgradient vector
g
15
instead when any 
θ
i
= 0.
142 | Chapter 4: Training Models


Equation 4-11
 shows a subgradient vector equation you can use for Gradient Descent
with the Lasso cost function.
Equation 4-11. Lasso Regression subgradient vector
g
θ,
J
=

θ
MSE θ +
α
sign
θ
1
sign
θ
2

sign
θ
n
where sign
θ
i
=
−1 if 
θ
i
< 0
0 if 
θ
i
= 0
+1 if 
θ
i
> 0
Here is a small Scikit-Learn example using the 
Lasso
class. Note that you could
instead use an 
SGDRegressor(penalty="l1")
.

Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   114   115   116   117   118   119   120   121   ...   225




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish