0% found this document useful (0 votes)
24 views23 pages

Fraud Detection Using Supervised Learning Algorithms: March 2024

This document discusses using machine learning algorithms to detect online payment fraud. It describes how credit card fraud has increased with the rise of online payments. The author evaluates the performance of random forest, decision tree, logistic regression, and AdaBoost models on a dataset of online transactions to determine the best algorithm for fraud detection.

Uploaded by

Sandra Parara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views23 pages

Fraud Detection Using Supervised Learning Algorithms: March 2024

This document discusses using machine learning algorithms to detect online payment fraud. It describes how credit card fraud has increased with the rise of online payments. The author evaluates the performance of random forest, decision tree, logistic regression, and AdaBoost models on a dataset of online transactions to determine the best algorithm for fraud detection.

Uploaded by

Sandra Parara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/378680090

Fraud detection using supervised learning Algorithms

Preprint · March 2024


DOI: 10.13140/RG.2.2.17772.54409

CITATIONS READS

0 44

1 author:

Daniel Ihotu Abutu


Bournemouth University
3 PUBLICATIONS 0 CITATIONS

SEE PROFILE

All content following this page was uploaded by Daniel Ihotu Abutu on 02 March 2024.

The user has requested enhancement of the downloaded file.


Bournemouth University
MSc Data Science and Artificial
Intelligence
ARTIFICIAL INTELLIGENCE
(Fraud detection using supervised learning Algorithms)

Project on:
“Online payment Fraud detection”

Submitted By
Daniel Ihotu Abutu (S5549478)

Submitted On
12th May 2023

1
Table of Content

Page

ABSTRACT 3

CHAPTER ONE
1.1. Introduction 5
1.2. Real world problem 5
1.3. Aim and objectives 6

CHAPTER TWO
2.1. Adopted artificial intelligence approach 7
2.2. Artificial intelligence approach implementation 7
2.2.2. Random forest 8
2.2.3. Ada boost classifier 8
2.2.4. Logistic regression 8
2.2.5. Decision tree classifier 8

CHAPTER THREE
3.1. Evaluation 9
3.1.1. Feature engineering and data cleaning 10
3.1.2. Model selection and performance analysis 10

CHAPTER FOUR
4.1. Results and discussion 12

CHAPTER FIVE
5.1. Conclusion and future work 15
References 16
Appendices 18

LIST OF ABBREVATIONS

DT Decision Tree
RF Random Forest
LR Logistic Regression
AB AdaBoost
AUC-ROC Area under the curve - Receiver Operating Characteristic
EDA Exploratory Data Analysis

2
LIST OF FIGURES
Page

Figure 1 Architecture of the online payment fraud detection system 8


Figure 2 Count of Fraud transaction 9
Figure 3 Fraud Distribution on type column 9
Figure 4 Count of type transaction distribution 10

LIST OF TABLES

Table 1 Confusion matrix before Random undersampling (unbalanced data) 12


Table 2 Classification report before Random undersampling (unbalanced data) 13
Table 3 Confusion matrix after Random undersampling (balanced data) 13
Table 4 Classification report after Random undersampling (balanced data) 13
Table 5 AUC before and after Random undersampling 14
Table 6 Confusion matrix after feature selection 14
Table 7 Classification report for Random Forest after feature selection 14
Table 8 AUC after feature selection 14

3
ABSTRACT

The rise of online payment systems has led to an increase in payment fraud, particularly in
credit card fraud. Credit card fraud involves theft or fraud using or during payment with a credit
card. Online payment fraud is a significant concern for financial institutions as it affects
customer trust and can cause monetary loss. In this project, we use a comprehensive evaluation
method to compare the performance of four different machine learning models on the same
online payment transaction information dataset. The performance of each model was evaluated
using the Area under the ROC Curve (AUC), classification report, and confusion matrix. The
four models are Random Forest, Decision Tree, Logistic Regression and AdaBoost. In this
project, a dataset contains over six million online payment transactions were preprocessed and
divided into 80% training and 20% testing. The data was heavily skewed so we used random
undersampling to balance our dataset by randomly removing samples from the majority class
and evaluated the performance of the four models. The performance of the models in term of
AUC-ROC can be ranked as RF 99.76% > DT 99.73% >AB 97.57% > LR 76.21% and in terms
of execution time, DT > LR>AB>RF. According to the comparison results, Random Forest has
the highest AUC-ROC and consistency in predicting fraudulent transactions within this dataset.
Selecting the most important feature for the model reduces the execution time to predict our
result, increases efficiency and provides a more accurate result. After performing feature
selection, we were able to achieve an AUC of 100% for Random Forest which indicates a
perfect classifier. Therefore, it is recommended as the primary machine learning algorithm for
online payment fraud detection.

4
CHAPTER ONE

1.1. INTRODUCTION

The rise of online payment systems has led to an increase in payment fraud, particularly in
credit card fraud. Credit card fraud involves theft or fraud using or during payment with a credit
card. The theft of identity, which is closely related to credit card fraud, has also increased over
the years. Credit card fraud is a broad term used to describe illegal activities that involve theft
or fraud during a payment transaction using a credit card. "Credit card fraud" often refers to
the fraudulent use of payment cards, such as debit or credit cards. The procurement of goods
or services or payments to another account under the criminal's control could be the motivation.
Credit card fraud is a serious concern nowadays due to the rise in fraud in governmental
institutions, courts, the financial sector, the corporate sector, and many other institutions. Credit
card transaction fraud is the fraudulent use of a credit card account by a person other than the
account owner. Credit card fraud currently affects every nation and every country. Credit card
fraud is prohibited by the law. As a result, both financial institutions and individuals sustain
huge losses (Malaker et al., 2020). As reported by Forbes (2011 cited by Seera et al., 2021)
according to the American Bankers, payment card transactions are a prime target for fraud as
they estimate that approximately 10,000 such transactions take place every second on a global
scale. Fraud is now a major concern in many commercial and business domains. Credit card
companies have been fighting against fraud since the introduction of credit cards by the Diners
Club in 1950 as reported by Forbes (2011 cited by Seera et al., 2021). According to (Ahsan et
al., 2022, pp 1338) “The ease of using a credit card causes many people to use a credit card.
This triggers the emergence of credit card fraud. Credit card fraud events often occur and cause
big financial disadvantages. Villains can apply some methods (phishing or trojans) to swipe
credit card data from the customer. Hence, developing a powerful fraud detection system is
very crucial because it can detect fraud when hackers use stolen cards for consumption” Credit
card fraud detection models have become a common method of preventing consumers from
losing money to online criminals and fraudsters. As a result, many consumers can now avoid
falling victim to these types of scams (Garg, Chaudhary, and Mishra, 2021).
Machine learning has played a crucial role in automatic fraud detection. Machine
learning involves the use of algorithms and statistical models to enable computers to learn from
data and perform tasks automatically. This involves the computer recognizing and
understanding the characteristics of the data and using that information to make predictions or
decisions (Strelcenia and Prakoonwit, 2023). According to Bhattacharyya et al (2011 cited by
Seera et al., 2021, pp 172) “fraudulent mechanisms have evolved along with the models used
by the bank to avoid fraud detection”. Therefore, it's miles vital to broaden powerful and green
strategies to discover price fraud (Seera et al., 2021). The developed methods also need to be
revised continually by the advances in technologies.

1.2. REAL-WORLD PROBLEM

The rise of online payment systems has led to an increase in payment fraud, particularly in
credit card fraud. Credit card fraud involves theft or fraud using or during payment with a credit
card. The theft of identity, which is closely related to credit card fraud, has also increased over
the years. Financial institutions can use machine learning algorithms to detect fraudulent
transactions and continuously update their methods to keep up with evolving fraud
mechanisms. This project aims to develop an effective and efficient fraud detection system that
will help credit card companies detect fraudulent transactions.

5
This project was built using data that is openly accessible. Financial data is typically private,
thus there aren't many publicly accessible datasets that may be utilized for research. This
project makes use of a fictitious dataset created by the simulator PaySim and made publicly
accessible on Kaggle. The dataset was created using aggregated measurements from a
multinational provider of mobile banking services' private dataset (Lopez-Rojas, Elmir, and
Axelsson, 2016).
There are 6,362,620 transactions, the data set has 11 attributes which include;
• Type of transactions
• Amount transacted
• Customer ID and Recipient ID
• Old and New balance of Customer and Recipient
• The time step of the transaction
• Whether the transaction was fraudulent or not

https://www.kaggle.com/datasets/ealaxi/paysim1

1.3. AIM AND OBJECTIVES

The focus of this project is to accurately classify a valid transaction from a fraudulent
transaction. The objectives for this project could be solved using artificial intelligence in the
following ways:
• Developing an accurate and effective machine learning model for online payment
fraud detection.
• Applying four supervised machine learning algorithms and evaluating which
algorithm gives the best result.
• To perform feature selection and improve the efficiency of the model.
• Applying an 80 to 20 ratio to train and test data.
• Evaluating the result using the confusion matrix, classification report and AUC-ROC.

6
CHAPTER TWO

2.1. ARTIFICIAL INTELLIGENCE APPROACH

Online payment fraud is a significant concern for financial institutions as it affects customer
trust and can cause monetary losses. Machine learning algorithms offer a solution to detect
fraudulent transactions accurately and efficiently in a fully automated process, saving time and
labour (He, 2022). However, choosing the right machine learning algorithm for fraud detection
is challenging as there are many different algorithms available that use various techniques and
models (He, 2022). Researchers have employed different machine learning algorithms to
predict credit card fraud with varying levels of accuracy. For example, Meier (2022) used KNN
and Naive Bayes to predict credit card fraud with 85% accuracy, while Sailusha et al. (2020b)
employed Random Forest and AdaBoost algorithms, obtaining high accuracy, precision, recall,
and F1 scores. The highest accuracy was achieved by Adaboost and Logistic Regression in the
work of Sailusha et al. (2020b).
To compare the efficiency of different models, this project focuses on classification
models in supervised learning. Four algorithms, namely Random Forest (RF), Logistic
Regression (LR), Decision Tree (DT), and AdaBoost (AB) are picked to analyze efficiency.
This paper aims to answer which model has the best accuracy and which model is the most
efficient. This project will address the gap in the literature where it is difficult to compare the
efficiency of different models due to varying datasets and evaluation metrics used in different
studies. By analyzing the four selected algorithms' efficiency, we will provide insights into the
most accurate and efficient machine-learning algorithm for detecting fraudulent transactions in
online payments.

2.2. ARTIFICIAL INTELLIGENCE IMPLEMENTATION

The potential applications of automatic fraud detection are vast, as it can protect against
cybercriminals and guarantee the safety of online users. Furthermore, it can discourage
malicious actors who partake in web-based fraud. To effectively combat fraudulent activities
in a significant number of credit card transactions, the development of an accurate automatic
fraud detection method is of utmost importance, as highlighted by Strelcenia and Prakoonwit
(2023). Numerous approaches have been devised to detect fraudulent credit card transactions,
but none have provided a foolproof solution. Machine learning has emerged as the industry
standard for various applications due to its versatility. In machine learning, algorithms
concentrate on learning and enhancing themselves independently by analyzing relevant data
(Strelcenia and Prakoonwit, 2023).
Based on the above research, we have formulated the following hypothesis. i) “There’s no
significant difference in the performance of the model”. Ho: h1=h2=h3=h4
HA: At least AUC of one model is different than others.

where Ho = Null hypothesis, HA = alternate hypothesis, Decision tree =h1, logistic


regression=h2, Ada boost=h3, and Random Forests =h4.
In this task, we used four different supervised machine-learning classification models to test
the best algorithm. Once we have prepared the dataset, we can train and test different models
using various performance metrics, such as AUC-ROC, confusion matrix, and classification
report. Once we have trained and tested different models, we can compare their performance
on the test set using AUC-ROC (area under the curve) and select the algorithm that performs
the best.

7
2.2.2. Random Forest (RF)
Random Forest is a powerful machine learning technique that involves building multiple
decision trees and combining their results. Decision trees use information acquisition at each
node to classify data points. They categorize each data point and check for information at each
node. The node with the highest information gain is used for classification. This process
continues until all nodes are used or no further information is obtained (Valli et al., 2022).
Random forest was first proposed by Breiman (2001) who was inspired by earlier work by
Amit and Geman (1997).

2.2.3. AdaBoost Classifier (AB)


AdaBoost (Adaptive Boosting) is a popular ensemble learning algorithm in machine learning
that combines several weak classifiers into a strong classifier. The AdaBoost algorithm was
proposed by Freund and Schapire (1996). The idea behind AdaBoost is to iteratively train a
sequence of weak classifiers on the same dataset, where each weak classifier is trained to focus
on the misclassified samples from the previous classifiers.

2.2.4. Logistic Regression (LR)


Logistic regression is a popular classification algorithm in machine learning that models the
probability of a binary outcome based on one or more predictor variables. Logistic regression
was first introduced by Cox (1958). In this project, binary logistic regression is utilized to
determine the likelihood of fraud or non-fraud transactions. The logistic regression model
leverages a sigmoid function to convert input values into predicted outcomes.

2.2.5. Decision Tree classifier (DT)


According to Rokach and Maimon (2005) the Decision Tree classifier is a method of
classification that creates a recursive partition of the instance space. It is composed of nodes
that form a directed tree with a "root" node that has no incoming edges, and all other nodes
having exactly one incoming edge. The internal or test nodes split the instance space into two
or more sub-spaces based on a discrete function of the input attribute values, while the leaves
or terminal nodes are the final decision nodes. The test function typically considers a single
attribute, partitioning the instance space based on the attribute's value.

Exploratory Feature engineering and split


Dataset data analysis data cleaning data

performance model sampling


machine
analysis selection technique
learning model

train data

Fig 1: Architecture of the online payment fraud detection system

8
CHAPTER THREE

3.1. EVALUATION

There are 6,362,620 transactions, the data set has 11 attributes which include;
I. Type of transactions
II. Amount transacted
III. Customer ID and Recipient ID
IV. Old and New balance of Customer and Recipient
V. The time step of the transaction
VI. Whether the transaction was fraudulent or not

Fig 2: Count of Fraud transaction

Fig 2 above shows that the data is imbalanced with only 0.13% of transactions being
fraudulent, and the number of safe transactions is much higher. The data needs to be balanced
for accurate predictions.

Fig 3: Fraud Distribution on type column

Fig 3 showed that the majority of fraudulent transactions belong to the 'TRANSFER' and
'CASH_OUT' types, indicating that these types are more susceptible to fraud.

9
Fig 4: Count of type transaction distribution

Fig 4 indicates that only 16 out of 4,097 fraud transfers were flagged by the system. This
suggests that the system's parameters for detecting fraud are unreasonable, and the
isFlaggedFraud feature can be considered insignificant and discarded without losing
information.

3.1.1. FEATURE ENGINEERING AND DATA CLEANING


We performed exploratory data analysis (EDA) on a dataset to identify patterns in fraudulent
transactions. We found that fraud only occurred in 'TRANSFER and 'CASH_OUT, so we
assembled corresponding data for analysis. We dropped irrelevant columns and calculated
errors in account balances before and after transactions, which made us to add a new feature
called 'errorbalance' to identify fraudulent transactions. We converted the step feature from
hours to days and created a new column called hour of the day for better understanding. We
used one-hot encoding to convert categorical data in the type column to numerical data. The
dataset was unbalanced, with fraudulent transactions making up only 0.13% of the total
transactions. To address this problem, we used the standard scaler method from sci-kit-learn
to scale the data.
3.1.2. MODEL SELECTION AND PERFORMANCE ANALYSIS

We split our data into 80% training and 20% testing and evaluated the performance of our
model on unbalanced data before using the random undersampling technique to balance the
data. To accurately evaluate the performance of our model, we used three evaluation metrics
namely, classification report, confusion matrix and AUC-ROC.
A classification report is a performance evaluation metric used to show the precision, recall,
F1 Score, and support of a classification model.
𝑇𝑃
Recall = 𝑇𝑃+𝐹𝑁 (1)
𝑇𝑃
Precision = 𝑇𝑃+𝐹𝑃 (2)
𝑃𝑟𝑒𝑐𝑠𝑖𝑜𝑛 ∗ 𝑅𝑒𝑐𝑎𝑙𝑙
F1 = 2 * 𝑃𝑟𝑒𝑐𝑠𝑖𝑜𝑛+ 𝑅𝑒𝑐𝑎𝑙𝑙 (3)
𝑇𝑃+𝑇𝑁
Accuracy = (4)
𝑇𝑃+𝑇𝑁+𝐹𝑃+𝐹𝑁

10
A confusion matrix can be described as a 2 x 2 matrix of the True positive, False positive,
False negative and True negative.

Confusion matrix
Positive(+) Negative(-)
Positive(+) TP FP
Negative(-) FN TN

The ROC curve is a graphical representation of the performance of a binary classifier. It plots
the true positive rate (sensitivity/recall) against the false positive rate (1 - specificity) at various
threshold settings.

The AUC is a performance metric for machine learning models that measures the overall
accuracy across all threshold settings. A score of 1 means perfect classification, while 0.5
means no better than random. Confusion matrix, classification report, and ROC curve
analysis help evaluate model performance beyond accuracy, showing how well the model
performs across various metrics.

11
CHAPTER FOUR

4.1. RESULT AND DISCUSSION

To evaluate the performance of the classification model, python programming on an Anaconda


Jupiter notebook 3.9.12, on a MacBook retina, Dual-Core Intel Core M 8 GB 1600 MHz
DDR31.1 GHZ have been used. Table 1 shows the confusion matrix of the models on skewed
data. From Table 1 we can see that random forest has less error in labelling fraudulent
transactions as valid compared to DT, RF and AB, but we cannot use this result because the
data is heavily skewed. Table 2 shows the classification report for all the models on unbalanced
data. The precision, recall and f1-score from Table 2 of random forest shows how well the
model performs but since the data is unbalanced, we are not going to use this report as part of
our evaluation. Table 3 shows the result of the confusion matrix for the balanced data. A
random undersampling technique was used to balance the data by reducing the majority class.
From Table 3, we can see that RF classified 2 fraudulent transactions as valid and 4 valid
transactions as fraudulent compared to DT, LR and AB, hence we can rank the models as
RF>DT>AB>LR. Table 4 shows the classification report for balanced data and RF performed
better, followed by DT. Table 5 shows the result for AUC before and after the sampling
technique. Although there's not much difference between RF and DT as RF has an AUC of
99.67% and DT has an AUC of 99.66%, this result cannot be used to determine the efficiency
of our model as the data is heavily skewed. After performing random under-sampling, RF gave
a higher AUC closer to 1 compared to DT, LR and AB with an AUC of 99.76%, hence the 4
models can be ranked as RF > DT>AB>LR. The execution time for the models is ranked, DT
> LR>AB>RF. Table 6 shows the result for the confusion matrix after feature selection.
Selecting the most important feature for the model reduces the execution time to predict our
result, increases efficiency and provides a more accurate result. From Table 6, we can see that
RF gave a significantly excellent result. The number of fraudulent transactions classified as
valid was 0 and the number of valid transactions classified as fraudulent was 0. Table 7 shows
the classification report for RF after feature selection and we can see how well the model
performed after feature selection. Table 8 shows the AUC score after feature selection. From
Table 8 below, we can see that RF gave an AUC score of 1, which indicates a perfect classifier.

Table 1
Confusion matrix before random undersampling (unbalanced data)
Model False positive (FP) False Negative(FN)
Decision Tree 10 11
Random Forest 1 11
Logistic
Regression 83 783
AdaBoost 6 80

12
Table 2
Classification report before Random undersampling (unbalanced data)
precision Recall F1-score
RF valid(0) 1.00 1.00 1.00
Fraud(1) 1.00 0.99 1.00

DT Valid(0) 1.00 1.00 1.00


Fraud(1) 0.99 0.99 0.99

LR valid(0) 1.00 1.00 1.00


Fraud(1) 0.91 0.52 0.67

AB Valid(0) 1.00 1.00 1.00


Fraud(1) 1.00 0.95 0.97

Table 3
Confusion matrix after random undersampling (balanced data)
Model False positive (FP) False Negative(FN)
Decision Tree 9 9
Random Forest 3 5
Logistic
Regression 83 783
AdaBoost 6 80

Table 4
Classification report for balanced data
precision Recall F1-score
RF valid(0) 1.00 1.00 1.00
Fraud(1) 1.00 0.99 1.00

DT Valid(0) 1.00 1.00 1.00


Fraud(1) 0.99 0.99 0.99

LR valid(0) 1.00 1.00 1.00


Fraud(1) 0.91 0.52 0.67

AB Valid(0) 1.00 1.00 1.00


Fraud(1) 1.00 0.95 0.97

13
Table 5
AUC before and after random undersampling
Model AUC score (%) before RUS AUC score (%) after RUS
Decision Tree 99.66 99.73
Random Forest 99.67 99.76
Logistic
Regression 76.21 76.21
AdaBoost 97.57 97.57

Table 6
Confusion matrix after feature selection
Model False positive (FP) False Negative(FN)

Random Forest 0 0

Table 7
Classification report for random forest after feature selection
precision Recall F1-score
RF valid(0) 1.00 1.00 1.00
Fraud(1) 1.00 1.00 1.00

Table 8
AUC after feature selection
AUC score (%) after feature
Model selection

Random Forest 1.00

14
CHAPTER FIVE

5.1. CONCLUSION AND FUTURE WORK

In this project, we used four supervised classification models to classify if a transaction is


fraudulent or not, and RF gave a more accurate result compared to DT, LR and AB. This project
shows the effectiveness of the model and applying 80:20 to test and train data yielded a good
result. Although the execution time for RF is higher, it gave a more accurate result. There is
not much significant difference between the performance of the models which answers our
question for the hypothesis. Applying different performance metrics (confusion matrix,
classification report and AUC_ROC) to evaluate the performance of the models provided a
more comprehensive evaluation of our model. Feature selection yielded a more accurate result
as it increased the performance, efficiency and execution time of the model to achieve an AUC
of 1 which shows a perfect classifier. By combining four different models, we saw the strength
and weaknesses of the models. It is recommended to test the models on multiple datasets with
different characteristics to obtain a more general evaluation of their performance. Future work
can be done by combing neural networks with binary classifiers and turning in hyperparameters
to improve the execution time of the models. Additionally, future work can be done by using
different sampling techniques on the models.

15
REFERENCES

Ahsan, M., Susanto, T. Y., Virania, T. A. and Jaya, A. I., 2022. CREDIT CARD
FRAUD DETECTION USING LINEAR DISCRIMINANT ANALYSIS
(LDA), RANDOM FOREST, AND BINARY LOGISTIC REGRESSION.
BAREKENG: Jurnal Ilmu Matematika dan Terapan, 16 (4), 1337–1346.
https://doi.org/10.30598/barekengvol16iss4pp1337-1346

Amit, Y. and Geman, D., 1997 .Shape Quantization and Recognition with Randomized Trees.

Neural Computation, 9(7), 1545–1588 https://doi.org/10.1162/neco.1997.9.7.1545.

Bhattacharyya, S., Jha, S., Tharakunnel, K. and Westland, J. C., 2011. Data mining for credit

card fraud: A comparative study. Decision Support Systems, 50(3), 602–613.

https://doi.org/10.1016/j.dss.2010.08.008.

Breiman, L., 2001 .Random forest. Machine Learning, 45(1), 5–32.

https://doi.org/10.1023/a:1010933404324

Forbes. (2011). Bringing trust back to the table—part one: Adyen and Mobile Payments.

Garg, V., Chaudhary, S. and Mishra, A.K., 2021 .ANALYSING AUTO ML MODEL FOR

CREDIT CARD FRAUD DETECTION. International Journal of Innovative

Research in Computer Science & Technology, 9(3).

https://doi.org/10.21276/ijircst.2021.9.3.5.

He, Y., 2022 .Machine Learning Methods for Credit Card Fraud Detection. Highlights in

Science, Engineering and Technology, 3 December, 106–110.

https://doi.org/10.54097/hset.v23i.3204.

Lopez-Rojas, E.A., Elmir, A. and Axelsson, S. 2016 .Paysim: a financial mobile money

simulator for fraud detection. Annual Simulation Symposium, 249–255.

https://www.msc-les.org/proceedings/emss/2016/EMSS2016_249.pdf.

16
Malaker, A., Miad, A. H., Mim, F. K., Badhan, W. B. W., and Hossen, MD. I., 2020. An

Approach to Detect Credit Card Fraud Utilizing Machine Learning. International

Journal Advanced Networking and Application, 14(5), 5619-5620.

Meier, T. M., 2022. Early Detecting Credit Card Frauds. Medium, Towards Data Science,

https://towardsdatascience.com/early-detecting-credit-card-frauds-38db7c190e44.

Rb, A. and Kr, S.K., 2021 .Credit card fraud detection using artificial neural network. Global

Transitions Proceedings, 2(1), pp. 35–41. https://doi.org/10.1016/j.gltp.2021.01.006.

Rokach, L. and Maimon, O., 2005. Decision Trees. In: Maimon, O., Rokach, L. (eds) Data

Mining and Knowledge Discovery Handbook[online]. Springer, Boston, MA, 165-

166. https://doi.org/10.1007/0-387-25465-X_9.

Sailusha, R., Gnaneswar, V., Ramesh, R. and Rao, G. R., 2020b. Credit Card Fraud Detection

Using Machine Learning. 4th International Conference on Intelligent Computing and

Control Systems (ICICCS), 1264-1270.

https://doi.org/10.1109/iciccs48265.2020.9121114.

Seera, M., Lim, C. P., Kumar, A., Dhamotharan, L. and Tan, K. H., 2021. An intelligent

payment card fraud detection system. Annals of Operations Research.

Strelcenia, E. and Prakoonwit, S., 2023. Improving Classification Performance in Credit Card

Fraud Detection by Using New Data Augmentation. AI, 4 (1), 172–198.

https://doi.org/10.3390/ai4010008.

Valli, L. N., Sujatha, N. and Divya, D., 2022. A Novel Approach for Credit Card Fraud

Detection Using LR Method-Comparative Studies. Journal Eduvest. 2(12), 2611-2614

17
APPENDICES

ABOUT THE DATASET

There are 6,362,620 transactions, the data set has 11 attributes which include.
I. Type of transactions
II. Amount transacted.
III. Customer ID and Recipient ID
IV. Old and New balance of Customer and Recipient
V. The time step of the transaction
VI. Whether the transaction was fraudulent or not

step represents a real-world time unit. In this instance, 1 step equals 1 hour. 744 steps
altogether (30 days simulation).

type: TRANSFER, DEBIT, PAYMENT, CASH-IN, and CASH-OUT.

amount is the transaction's total value in local currency.

nameOrig - Name of the user who initiated the transaction.

initial balance before the transaction: oldbalanceOrg

new balance following the transaction is newbalanceOrig.

nameDest - Customer serving as the transaction's recipient.

oldbalanceDest is the receiver of the initial balance prior to the transaction. Notably, there is
no information available for clients whose names begin with M (merchants).

newbalanceDest - the recipient of the new balance following the transaction. Notably, there is
no information available for clients whose names begin with M (merchants).

isFraud - This represents the transactions carried out by the simulation's fraudulent agents.
The agents' dishonest behavior in this data seeks to make money by seizing control of or
clients' accounts and attempting to drain the funds by moving to another account before
cashing out of the system.

isFlaggedFraud's business concept strives to prevent large-scale transfers between accounts


and detects unauthorized efforts. An attempt to transfer more than 200.000 in a single
transaction is considered an illegal attempt in this dataset.

18
HOW THE ALGORITHM WORKS

DECISION TREE ALGORITHM


Step 1: Let A be a set of instances and B a set of features.
Step 2: if all instances in A fraud, create a fraud node and stop
if all instances in A valid, create a valid node and stop.
Step 3: Otherwise, select feature b from B with most common value (e.g., b={TRANSFER})
Step 4: Create node and label its B.
Step 5: For each value c of b (e.g., {fraud, valid}) do:
Step 6: Create a branch and label its c.
Step 7: Partition the data A into a subset A_i = {A_1, A_2, A_3}
by keeping only instances with v
Step 8: Go to step 1 for and set A=A_i

B = {TRANSFER, CASH_OUT}
A = {instance 1, instance 2, …. instance n}

RANDOM FOREST ALGORITHM.


Step 1; Let A be the set of decision trees and B subset of features.
Step 2: for each a, randomly select b.
Step 3: randomly train each data and select features b using binary splitting and create series
of nodes and branches.
Step 4: once each a are trained on each node.
Step 5: go to step 1, combine predictions for each a, and take majority a vote.
A= (a1, a2, a3, a4)
B = {TRANSFER, CASH_OUT}

ADA BOOST ALGORITHM


Step 1: Let A be set of base models and B weights.
Step 2: Evaluate the performance for set of A’s and adjust B on training samples.
Step 3: Fit A on updated B
Step 4: continue step 3 and stop.
Step 5: Combine the predictions of sets of A with B assigned based on performance.

A = {A1, A2, A3, A4} base models.


B = {W1, W2, W3, Wn} set of weights.

LOGISTIC REGRESSION
Step 1: Compute the probability of B having class 1 given the values from A
Step 2: use sigma function to convert the output value of B {Fraud, Valid}.
Step 3: train C on the data where B is known for each input to predict 0 and 1.
Step 3: Let C estimate the value of B.
Step: use threshold to covert the probability of values in step 1.

A = {TRANSFER, CASH_OUT} independent variable.


B = {Fraud= 0, valid = 1} dependent variable.
C = model

19
HOW OUR OBJECTIVES WERE ACHIEVED

OBJECTIVE HOW IT WAS ACHIEVED


Developing an accurate and effective Achieving an AUC-ROC of 1.00 indicates
machine learning model for online payment an accurate, effective, and perfect classifier
fraud detection. as seen in chapter 5 Table 8.
Applying four supervised machine learning Chapter 2.2 shows how we applied 4
model and testing which algorithm gives the classifiers and chapter 3.1.2 shows how we
best result. evaluated the performance using different
matrices.
To perform feature selection and improve Chapter 4 table 6 – 8 shows how we used
the efficiency of the model feature selection to improve the efficiency
of our model.
Applying an 80:20 ratio to train and test Chapter 3.1.2 shows how we split our data
data. into ratio 80:20 train and test.
Evaluating the result using confusion Chapter 4 shows how we evaluated the
matric, classification report and AUC-ROC. performance of our models using AUC,
Confusion matrix and classification report.

OBSERVATIONS
1) There was no change in the AUC, classification report and confusion matrix for LR
and AB before and after sampling technique.

2) We can observe that TRANSFER (16) transaction type transfers are those that are
flagged as fraudulent. Therefore, only 16 of the 4097 Fraud Transfers were detected
by the system.
Thus, the system only flagged 16 out of 6 million transactions. It is safe to claim that
the system's criteria for identifying fraudulent transactions are irrational.

3) Despite the fact that isFraud is always set when isFlaggedFraud is set, the fact that
isFlaggedFraud is only set 16 times in an apparent meaningless manner allows us to
treat this feature as insignificant and remove it from the dataset without losing any
data.

4) 'TRANSFER' and 'CASH_OUT' transactions are the only ones where fraud happens,
according to the exploratory data analysis (EDA).

20
LIBRARY USED AND THEIR FUNCTION

Library Function
“Math” This library was used for mathematical
computation.
“NumPy” np was used for numerical computing on
multi-dimensional arrays and matrices
“Pandas” Pd module was used to read our data and
store it in a dataframe for manipulation
“Plotly.express” px was used create to create interactive pie
plot.
“matplotlib” Plt module was used to create dashboards.
“random” Seed and sample modules were used to
generate pseudorandom numbers.
“OS” This library was used to locate path in my
system.
“Sklearrn.preprocessing” StandardScaler module was used to scale
the numeric data.
“Sklearn.tree” Decision tree algorithm module was
imported from this library.
“Sklearn.ensemble” Random forest and Ada boost algorithm
module was imported from this library.
“Sklearrn.linear_model” Logistic regression module was imported
from this library
“Sklearn.metrics” Average_precision_score,
classification_report, confusion_matrix,
accuracy_score, roc_curve, auc, and
precision_score was imported for evaluating
the performance of our model.
“seabon” Sns module was imported for visualizing
our data.
“Warnings” This module was used to control the
behavior warnings in our environment.
“collections” Counter module was imported to count the
frequency of items in the list.
“Sklearn.dataset” Make_classification module was used for
generating synthetic data
“Imblearn.under_sampling” Randomundersampler module was used to
balance our data.
“Sklearn.preprocessing” LabelEncoder module was used for one-hot
encoding

21
LIST OF EQUATIONS

eq 1. Formula to calculate “recall”.


eq 2. Formula to calculate “precision”.
eq 3. Formula to calculate “F1 score”.
eq 4. Formula to calculate “accuracy”.

22

View publication stats

You might also like