Beginning Anomaly Detection Using



Download 26,57 Mb.
Pdf ko'rish
bet77/283
Sana12.07.2021
Hajmi26,57 Mb.
#116397
1   ...   73   74   75   76   77   78   79   80   ...   283
Bog'liq
Beginning Anomaly Detection Using Python-Based Deep Learning

mean normalizationstandardization (z-score 

normalization), and unit length scaling.

The formulas for each method are as follows:



Mean normalization (Figure 

3-25


)

This formula is similar to min-max normalization, except you use x



average

 in the 


numerator over x

min

.

Standardization (Figure 

3-26

)

You basically find z-score values for each x and use those instead of the original x values.



Unit length scaling (Figure 

3-27


)

Figure 3-24.  Formula for min-max normalization

Figure 3-25.  Formula for mean normalization

Figure 3-26.  Formula for standardization

Figure 3-27.  Formula for unit length scaling

Chapter 3   IntroduCtIon to deep LearnIng




92

You find the unit vector for x and use that instead. Unit vectors have a magnitude of 1.

The next block of code is shown in Figure 

3-28


.

What keras.utils.to_categorical() does is take the vector of classes and create a 

binary class matrix of the number of classes. Assume that you have a vector representing 

y_train with 6 classes at most, going from 0-5 (Figure 

3-29

).

After running keras.utils.to_categorical(y_train, n_classes) where  



n_classes = 5, Figure 

3-30


 shows what you would now get for y_train.

[BWUDLQ [BWUDLQDVW\SH IORDW

[BWHVW [BWHVWDVW\SH IORDW

[BWUDLQ 

[BWHVW 

\BWUDLQ NHUDVXWLOVWRBFDWHJRULFDO \BWUDLQQBFODVVHV

\BWHVW NHUDVXWLOVWRBFDWHJRULFDO \BWHVWQBFODVVHV

Figure 3-28.  Converting x_train and x_test to float32 and applying min-max 

normalization by dividing by 255. For y_train and y_test, you convert them to a 

one-hot encoded format

Figure 3-29.  A vector representing y_train that has 6 classes with values ranging 

from 0-5

Chapter 3   IntroduCtIon to deep LearnIng




93

The classes are still the same, but this time you have to get the class by their index 

and not by direct value. At index 1 (row 1 if you think of this as a matrix with 1 column) 

of the original vector, you see that the class label is 5. In your transformed y_train data 

(which is now a matrix), at row 1 (previously index 1 before the transformation), you see 

that everything is a 0 in the vector at that index except for the value at column 5. And so, 

y_train is still 5 at index 1, but it’s formatted differently.

Now let’s check the shapes of your transformed data in Figure 

3-31

 and Figure 



3-32

.

Figure 3-30.  A one-hot encoded representation of the y_train vector in Figure 



3-39

SULQW


[BWUDLQ^`?Q[BWHVW^`?QLQSXWBVKDSH^`?QRIWUDLQLQJ

VDPSOHV^`?QRIWHVWLQJVDPSOHV^`IRUPDW 

[BWUDLQVKDSH[BWHVWVKDSHLQSXWBVKDSH[BWUDLQVKDSH>@

[BWHVWVKDSH>@




Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   73   74   75   76   77   78   79   80   ...   283




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