Beginning Anomaly Detection Using


Anomaly Detection with the RBM - Credit Card Data Set



Download 26,57 Mb.
Pdf ko'rish
bet129/283
Sana12.07.2021
Hajmi26,57 Mb.
#116397
1   ...   125   126   127   128   129   130   131   132   ...   283
Bog'liq
Beginning Anomaly Detection Using Python-Based Deep Learning

 Anomaly Detection with the RBM - Credit Card Data Set

Now that you know more about the complex mechanisms of the RBM, let’s apply the RBM 

to a data set and see how it performs. For your application, let’s use the credit card data set, 

which can be found at 

www.kaggle.com/mlg-ulb/creditcardfraud/version/3

.

Begin by importing all of your packages. For this application, you will only explore 



how an RBM can be applied to the code, since the source code is quite large. However, 

you can access the source code through the GitHub link at 

https://github.com/

aaxwaz/Fraud-detection-using-deep-learning

.

Simply download the folder titled rbm and place it in your working directory 



(wherever you have your notebook file or Python file). In this case, we placed in a folder 

named boltzmann_machines.

Now, import your modules (see Figure 

5-18


).

Figure 5-18.  Importing all the modules you need. %matplotlib inline is to save the 

graph within the Jupyter notebook itself

Chapter 5   Boltzmann maChines




188

Next, import the data set.

Run the following (refer to Figure 

5-19


 for the output):

df = pd.read_csv("datasets/creditcardfraud/creditcard.csv", sep=",",  

index_col=None, encoding="utf-8-sig")

Figure 5-19.  Visualizing the data set you just loaded. This figure is scrolled right to 

show the classes

Looking at the data, it seems that the values in the columns Amount and especially 

Time need to be normalized. Take a look at how large the values for time get  

(see Figure 

5-20

).

Figure 5-20.  Looking at the tail end of the data frame (bottom five entries), the 



values for time clearly become massive. You must address this in order to train the 

RBM and ensure that the training process goes smoothly and works properly. Large 

values like this can ruin the whole process and even lead to no convergence

Chapter 5   Boltzmann maChines




189

To avoid numbers like these from potentially ruining the training process, you should  

standardize the values for both columns. Everything else seems to already be standardized, 

so you should only worry about these columns. Run the code in Figure 

5- 21

.

Figure 5-21.  Standardizing the values in the columns Amount and Time



Now let’s take a look at the values to see how they were transformed (see Figure 

5-22


 

and Figure 

5-23

).


Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   125   126   127   128   129   130   131   132   ...   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