Beginning Anomaly Detection Using



Download 26,57 Mb.
Pdf ko'rish
bet84/283
Sana12.07.2021
Hajmi26,57 Mb.
#116397
1   ...   80   81   82   83   84   85   86   87   ...   283
Bog'liq
Beginning Anomaly Detection Using Python-Based Deep Learning

Figure 3-42.  A graph showing the ReLU function

Figure 3-43.  Formula for the softmax activation function

Chapter 3   IntroduCtIon to deep LearnIng




104

Figure 3-44.  The output for the code in Figure 

3-33

. Note how it tells you the 

output shapes of each layer and the number of parameters; this can be useful when 

creating custom models and finding out that there is a mismatch between the 

dimensionality of what a layer expects and what it actually receives

Chapter 3   IntroduCtIon to deep LearnIng




105

Now let’s move on to training the data. Depending on your setup, this can take 

anywhere from a few seconds to several minutes. Without cuda, expect that this will take 

much longer.

Run the code in Figure 

3-45


.

FKHFNSRLQW 0RGHO&KHFNSRLQW ILOHSDWK NHUDVB01,67B&11K

YHUERVH 

VDYHBEHVWBRQO\ 7UXH

PRGHOILW [BWUDLQ\BWUDLQ

EDWFKBVL]H EDWFKBVL]H

HSRFKV QBHSRFKV

YHUERVH 

YDOLGDWLRQBGDWD [BWHVW\BWHVW 

FDOOEDFNV >FKHFNSRLQW@

VFRUH PRGHOHYDOXDWH [BWHVW\BWHVWYHUERVH 

SULQW 7HVWORVV VFRUH>@

SULQW 7HVWDFFXUDF\ VFRUH>@

Figure 3-45.  Code to train the model and print accuracy and loss values for the 

test set

Chapter 3   IntroduCtIon to deep LearnIng




106

PRGHOILW [BWUDLQ\BWUDLQ

EDWFKBVL]H EDWFKBVL]H

HSRFKV QBHSRFKV

YHUERVH 

YDOLGDWLRQBGDWD [BWHVW\BWHVW

VFRUH PRGHOHYDOXDWH [BWHVW\BWHVWYHUERVH 

SULQW 7HVWORVV VFRUH>@

SULQW 7HVWDFFXUDF\ VFRUH>@

Figure 3-46.  Run this code if you don’t want to save the model

The variable checkpoint will store the model in the same folder as this code with 

the name keras_MNIST_CNN.h5. If you don’t want to save the model, run the code in 

Figure 


3-46

 instead.

Chapter 3   IntroduCtIon to deep LearnIng



107

Figure 3-47.  The output of running the training function, accompanied by the loss 

and accuracy values for the test set

If successful, you should see something like Figure 

3-47

.

Let’s check the AUC score for this. Run the code in Figure 



3-48

.

Chapter 3   IntroduCtIon to deep LearnIng




108

Basically, the variable predictions are a list of arrays with 10 elements, each containing 

the probability values for class predictions for each of the x_test data samples.

To check the values for the predictions before doing np.round(), run the code in 

Figure 

3-49


 and see the results in Figure 

3-50


.

IURPVNOHDUQPHWULFVLPSRUWURFBDXFBVFRUH

SUHGV PRGHOSUHGLFW [BWHVW

DXF URFBDXFBVFRUH QSURXQG SUHGV \BWHVW

SULQW $8&^`IRUPDW DXF


Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   80   81   82   83   84   85   86   87   ...   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