Beginning Anomaly Detection Using



Download 26,57 Mb.
Pdf ko'rish
bet43/283
Sana12.07.2021
Hajmi26,57 Mb.
#116397
1   ...   39   40   41   42   43   44   45   46   ...   283
Bog'liq
Beginning Anomaly Detection Using Python-Based Deep Learning

Figure 2-14.  The dimensionality of the filtered df

Figure 2-15.  The unique labels in df along with the number of instances of data 

points in df with that specific label

Chapter 2   traditional Methods of anoMaly deteCtion




43

You can also run print(df.head(5)), but it prints in a text format (Figure 

2-17

).

To resolve this issue, the 



label encoder takes the unique (meaning one entry per 

categorical value instead of multiple) list of categorical values and assigns a number 

representing each of them. If you had an array like

[ "John", "Bob", "Robert"],

the label encoder would create a numerical representation like

[0, 1, 2], where 0 represents "John", 1 represents "Bob", and 2 represents 

"Robert."

Figure 2-16.  A line of code to display the top five entries in the table. In this case

the image has been cropped to show the first few columns

Figure 2-17.  The same function as in Figure 

2-16

, but in text format

Chapter 2   traditional Methods of anoMaly deteCtion




44

Now do the same with the labels in your data frame.

Run the code in Figure 

2-18


.

encoded.fit(df[col]) gives the label encoder all of the data in the column from 

which it extracts the unique categorical values from. When you run

df[col] = encoded.transform(df[col])

you are assigning the encoded representation of each categorical value to df[col].

Let’s check the data frame now (Figure 

2-19

).

Good, all the categorical values have been replaced with numerical equivalents.



Now run the code in Figure 

2-20


.


Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   39   40   41   42   43   44   45   46   ...   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