Hands-On Machine Learning with Scikit-Learn and TensorFlow



Download 26,57 Mb.
Pdf ko'rish
bet104/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   100   101   102   103   104   105   106   107   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

X
T
Xθ − y
Notice that this formula involves calculations over the full training
set X, at each Gradient Descent step! This is why the algorithm is
called 
Batch Gradient Descent
: it uses the whole batch of training
data at every step. As a result it is terribly slow on very large train‐
ing sets (but we will see much faster Gradient Descent algorithms
shortly). However, Gradient Descent scales well with the number of
features; training a Linear Regression model when there are hun‐
dreds of thousands of features is much faster using Gradient
Descent than using the Normal Equation or SVD decomposition.
Once you have the gradient vector, which points uphill, just go in the opposite direc‐
tion to go downhill. This means subtracting 

θ
MSE(θ) from θ. This is where the 
learning rate 
η
comes into play:
6
multiply the gradient vector by 
η
to determine the
size of the downhill step (
Equation 4-7
).
Equation 4-7. Gradient Descent step
θ
next step
θ 
η

θ
MSE θ
Let’s look at a quick implementation of this algorithm:
eta
=
0.1
# learning rate
n_iterations
=
1000
m
=
100
theta
=
np
.
random
.
randn
(
2
,
1
)
# random initialization
for
iteration
in 
range
(
n_iterations
):
gradients
=
2
/
m
*
X_b
.
T
.
dot
(
X_b
.
dot
(
theta

-
y
)
theta
=
theta
-
eta
*
gradients

Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   100   101   102   103   104   105   106   107   ...   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