Hands-On Machine Learning with Scikit-Learn and TensorFlow


| Chapter 4: Training Models



Download 26,57 Mb.
Pdf ko'rish
bet126/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   122   123   124   125   126   127   128   129   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

152 | Chapter 4: Training Models


well a set of estimated class probabilities match the target classes (we will use it again
several times in the following chapters).
Equation 4-22. Cross entropy cost function
J
Θ = −
1
m

i
= 1
m

k
= 1
K
y
k
i
log
p
k
i

y
k
i
is the target probability that the i
th
instance belongs to class 
k
. In general, it is
either equal to 1 or 0, depending on whether the instance belongs to the class or
not.
Notice that when there are just two classes (
K
= 2), this cost function is equivalent to
the Logistic Regression’s cost function (log loss; see 
Equation 4-17
).
Cross Entropy
Cross entropy originated from information theory. Suppose you want to efficiently
transmit information about the weather every day. If there are eight options (sunny,
rainy, etc.), you could encode each option using 3 bits since 2
3
= 8. However, if you
think it will be sunny almost every day, it would be much more efficient to code
“sunny” on just one bit (0) and the other seven options on 4 bits (starting with a 1).
Cross entropy measures the average number of bits you actually send per option. If
your assumption about the weather is perfect, cross entropy will just be equal to the
entropy of the weather itself (i.e., its intrinsic unpredictability). But if your assump‐
tions are wrong (e.g., if it rains often), cross entropy will be greater by an amount 
called the 
Kullback–Leibler divergence
.
The cross entropy between two probability distributions 
p
and 
q
is defined as
H p
,
q
= − ∑
x
p x
log
q x
(at least when the distributions are discrete). For more
details, check out 
this video
.
The gradient vector of this cost function with regards to θ
(k)
is given by 
Equation
4-23
:
Equation 4-23. Cross entropy gradient vector for class k


Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   122   123   124   125   126   127   128   129   ...   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