Paper 43-Fraud Detection Using Machine Learning in E Commerce
Paper 43-Fraud Detection Using Machine Learning in E Commerce
net/publication/336148901
CITATIONS READS
10 4,999
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Adi Saputra Saputra on 01 October 2019.
Abstract—The volume of internet users is increasingly Fraud detection that has developed very rapidly is fraud
causing transactions on e-commerce to increase as well. We detection on credit cards ranging from fraud detection using
observe the quantity of fraud on online transactions is increasing machine learning to fraud detection using deep learning [6]
too. Fraud prevention in e-commerce shall be developed using but unfortunately fraud detection for transactions on e-
machine learning, this work to analyze the suitable machine commerce is still small, fraud detection research on e-
learning algorithm, the algorithm to be used is the Decision Tree, commerce commerce is still not much so far, fraud detection
Naïve Bayes, Random Forest, and Neural Network. Data to be research on e-commerce is only limited to the determination of
used is still unbalance. Synthetic Minority Over-sampling features or attributes [7] which will be used to determine the
Technique (SMOTE) process is to be used to create balance data.
nature of fraud or non-fraud transactions in e-commerce.
Result of evaluation using confusion matrix achieve the highest
accuracy of the neural network by 96 percent, random forest is The dataset used in this paper has a total of 151,112
95 percent, Naïve Bayes is 95 percent, and Decision tree is 91 records, the dataset classified as fraud is 14,151 records, the
percent. Synthetic Minority Over-sampling Technique (SMOTE) ratio of fraud data is 0.093 percent. Datasets that have very
is able to increase the average of F1-Score from 67.9 percent to small ratios result in an imbalance of data. Imbalance data
94.5 percent and the average of G-Mean from 73.5 percent to results in accuracy results that are more inclined to majority
84.6 percent. data than minority data. The dataset used results more in the
classification of the majority of non-fraud than fraud. Accuracy
Keywords—Machine learning; random forest; Naïve Bayes;
SMOTE; neural network; e-commerce; confusion matrix; G-Mean;
results that are more inclined to majority data make the
F1-score; transaction; fraud classification results worse; handling imbalance data using the
SMOTE (Synthetic Minority Oversampling Technique).
I. INTRODUCTION Recent research about fraud detection in e-commerce
Insight of previous research results on internet users in transactions still determine feature extraction [8], purpose of
Indonesia as released on October 2019 edition of Marketeers this paper is to find the best model to detect fraud in e-
Magazine [1], according to the research the number of internet commerce transactions.
users in Indonesia on 2019 alone, had reached 132 million
users, an increase from the previous year at 143.2 million users In this paper research fraud transaction in ecommerce,
show in Fig. 1. research use dataset from Kaggle, improve classification
machine learning using SMOTE, SMOTE using to handling
The increasing number of internet users in Indonesia has unbalance data, after using SMOTE, dataset will be training
triggered market players in Indonesia to try opportunities to using machine learning. Machine learning is decision tree,
develop their business through internet media. One method Naïve Bayes, random forest, and neural network machine
used is to develop an E-Commerce business [3]. learning to determine accuracy, precision, recall, G-mean, F1-
Score.
Based on statistical data obtained by Statista.com, it is
shown that the number of retail e-Commerce (electronic
commerce) sales in Indonesia will grow 133.5% to the US $
16.5 billion or around IDR 219 trillion in 2022 from the
position in 2017. This growth is supported by the rapid
advances in technology that provide convenience for
consumers to shop.
Huge number of transactions in e-commerce raises the
potential for new problems namely fraud in e-commerce
transactions shows in Fig. 2. The number of e-commerce-
related frauds has also increased every year since 1993. As per
a 2013 report, 5.65 cents lost due to a fraud of every $ 100 in e-
commerce trading turnover. Fraud has reached more than 70
trillion dollars until 2019 [5]. Fraud detection is one way to
reduce the amount of fraud that occurs in e-commerce Fig. 1. Growth of Internet users [2].
transactions.
332 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
333 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
(1)
Where:
B: Data with unknown classes
334 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
E. Neural Network
The algorithm neural network is an artificial intelligence
method whose concept is to apply a neural network system in
the human body where nodes are connected to each other, Fig. 6. Architecture of Neural Network.
architecture neural network as shown in Fig. 6.
F. Confusion Matrix
The number of input layers before training is 11 input
layers, after preprocessing the input layer to 17 input layers, in Confusion matrix is a method that can be used to evaluate
addition to determining the hidden layer, genetic algorithms on classification performance. Table I shows a dataset with only
the neural network is used [24]. The GA-NN [25] algorithm two types of classes [26].
process for this forecasting process is as follows: True Positive (TP) and True Negative (TN) are the number
This forecasting is as follows: of positive and negative classes that are classified correctly,
False Positive (FP) and False Negative (FN) is the number of
Initialization count = 0, fitness = 0, number of cycles positive and negative classes that are not classified correctly.
Based on the confusion matrix, performance criteria such as
Early population generation. Individual chromosomes Accuracy, Precision, Recall, F-Measure, G-Mean can be
are formulated as successive gene sequences, each determined.
encoding the input.
Accuracy is the most common criteria for measuring
Suitable network design classification performance, but if working in an imbalanced
Assign weights class, this criterion is not appropriate because the minority
class will have a small contribution to the accuracy criteria.
Conduct training with backpropagation Looks for The recommended evaluation criteria are recall, precision F-1
cumulative errors and fitness values. Then evaluated Score and G-Mean. F-1 Score is used to measure the
based on the value of fitness. classification of minority classes in unbalanced classes, and the
G-mean index is used to measure overall performance (overall
If the previous fitness <current fitness value, save the
classification performance).
current value
In this study, classification performance using Recall,
Count = count +1
Precision, F-1 Score and G-Mean:
Selection: Two mains are selected using a wheel
roulette mechanism (2)
335 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
TABLE. I. CONFUSION MATRIX Decision tree without SMOTE produce Accuracy is 91%,
recall is 59.8%, Precision is 54.1%, F1-Score is 56.8%, G-
Class Predictive Positive Predictive Negative
Mean is 75.2%. Table II shows result from confusion matrix
Actual Positive TP TN decision tree without SMOTE.
Actual Negative FP FN Decision tree with SMOTE produce Accuracy is 91%,
recallis 60.4%, Precisionis 91.6%, F1-Score is 91.2%, G-Mean
IV. RESULTS AND DISCUSSION is 75.3%. Table III shows result from confusion matrix
decision tree with SMOTE.
A. Dataset
This study uses an e-commerce fraud dataset sourced from C. Naïve Bayes
Kaggle. The dataset consists of 151,112 records, a dataset The process of testing using the Naïve Bayes model is done
classified as fraud is 14,151 records, and the ratio of fraud data by preparing data that has already been done in the
is 0.093. SMOTE (Synthetic Minority Oversampling preprocessing process. After preprocessing, the data will be
Technique) [27] minimizes class imbalance in the fraud carried out oversampling using Naïve Bayes classification will
transaction dataset by generating synthesis data, so that the be done using data that has been oversampling, and also Naïve
total data consists of 151,112 records, dataset classified as Bayes will be done using data that is not oversampling. The
fraud is 14,151 records, fraud data ratio is 0.093, as shown in results of these two experiments will show the results of the
Fig. 7. classification using the comparison of Naïve Bayes and the
SMOTE (Synthetic Minority Oversampling Technique)
After oversampling at the picture Fig. 8 oversampling process.
The SMOTE (Synthetic Minority Oversampling Naïve Bayes without SMOTE produce Accuracy is 95%,
Technique) process makes the synthesis data so that the data recall is 54.1%, Precision is 91.1%, F1-Score is 67.9%, G-
becomes balance. Mean is 73.3%. Table IV shows result from confusion matrix
B. Decision Trees naïve Bayes without SMOTE.
The experimental process using the decision tree model is Naïve Bayes with SMOTE produce Accuracy is 95%,
done by preparing data that has been done by the preprocessing recall is 54.2%, Precision is 94.9%, F1-Score is 94.5%, G-
process. After preprocessing, the data will be carried out by Mean is 73.4%. Table V shows result from confusion matrix
oversampling the classification using the decision tree will be Naïve Bayes with SMOTE.
done using the oversampling data, and also the decision tree
will be done by using the data that has not been oversampled. TABLE. II. CONFUSION MATRIX DECISION TREE WITHOUT SMOTE
The results of these two experiments will show the results of
the classification using a comparison of decision trees and the Class Predictive Positive Predictive Negative
SMOTE (Synthetic Minority Oversampling Technique)
Actual Positive 38782 38782
oversampling process.
Actual Negative 1746 2595
336 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
D. Random Forest TABLE. IX. CONFUSION MATRIX NEURAL NETWORK WITH SMOTE
The trial process using the Random Forest model is carried Class Predictive Positive Predictive Negative
out by preparing data that has already been done by the
preprocessing process. After preprocessing, the data will be Actual Positive 38566 2539
carried out classification oversampling using Random Forest Actual Negative 9585 31487
will be done using data that has been oversampled, and also
Random Forest will be done using data that is not Experiments using several algorithms produce accuracy
oversampling. The results of these two experiments will show values as shown in Fig. 9. The highest accuracy value in the
the classification results using the Random Forest comparison neural network algorithm is 96%.
and the SMOTE (Synthetic Minority Oversampling Technique)
oversampling process. Experiments using several algorithms produce recall values
as shown in Fig. 10, recall values increase using machine
Random forest without SMOTE produce Accuracy is 95%, learning algorithms and also the Synthetic Minority Over
recall is 55%, Precision is 95.5%, F1-Score is 69.8%, G-Mean Sampling Technique (SMOTE) compared only using the
is 74.0%. Table VI shows result from confusion matrix random decision tree algorithm, random forest, Naïve Bayes, and
forest without SMOTE. neural networks only, the highest increase occurred in the
neural network algorithm and the SMOTE (Synthetic Minority
Random Forest with SMOTE produce Accuracy is 95%,
Over Sampling Technique).
recall is 58.1%, Precision is 80.5%, F1-Score is 94.3%, G-
Mean is 75.7%. Table VII shows result from confusion matrix Experiments using several algorithms produce precision
random forest with SMOTE. values as shown in Fig. 11, the value decreases using machine
learning algorithm and the Synthetic Minority Over Sampling
E. Neural Network Technique (SMOTE) compared only using the decision tree
Research using the Neural Network model is done by algorithm, random forest, Naïve Bayes, and neural networks,
preparing data that has already been done by the preprocessing highest occurs in neural network algorithms and SMOTE
process. After preprocessing, the data will be carried out (Synthetic Minority Over Sampling Technique).
classification oversampling using Neural Network will be done
using data that has been oversampling, and also Random Forest Experiments using several algorithms produce F1-Score
will be done using data that is not oversampling. The results of values as shown in Fig. 12, F1-Score values are increased by
these two experiments will show the results of classification using machine learning algorithms and also Synthetic Minority
using the Neural Network comparison and the SMOTE Over Sampling Technique (SMOTE) compared only using
(Synthetic Minority Oversampling Technique) oversampling algorithms. F1-Score is used to measure the classification of
process. minority classes in unbalanced classes.
337 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
338 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 10, No. 9, 2019
[10] Srivastava, Abhinav, et al. "Credit card fraud detection using hidden [19] Sadaghiyanfam, Safa, and Mehmet Kuntalp. "Comparing the
Markov model." IEEE Transactions on dependable and secure Performances of PCA (Principle Component Analysis) and LDA (Linear
computing 5.1 (2008): 37-48. Discriminant Analysis) Transformations on PAF (Paroxysmal Atrial
[11] Lakshmi, S. V. S. S., and S. D. Kavilla. "Machine Learning For Credit Fibrillation) Patient Detection." Proceedings of the 2018 3rd
Card Fraud Detection System." International Journal of Applied International Conference on Biomedical Imaging, Signal Processing.
Engineering Research 13.24 (2018): 16819-16824. ACM, 2018.
[12] Aljarah, Ibrahim, Hossam Faris, and Seyedali Mirjalili. "Optimizing [20] Harrison, Paula A., et al. "Selecting methods for ecosystem service
connection weights in neural networks using the whale optimization assessment: A decision tree approach." Ecosystem services 29 (2018):
algorithm." Soft Computing 22.1 (2018): 1-15. 481-498.
[13] Bouktif, Salah, et al. "Optimal deep learning lstm model for electric load [21] Randhawa, Kuldeep, et al. "Credit card fraud detection using AdaBoost
forecasting using feature selection and genetic algorithm: Comparison and majority voting." IEEE access 6 (2018): 14277-14284.
with machine learning approaches." Energies 11.7 (2018): 1636. [22] Lakshmi, S. V. S. S., and S. D. Kavilla. "Machine Learning For Credit
[14] Xuan, Shiyang, Guanjun Liu, and Zhenchuan Li. "Refined weighted Card Fraud Detection System." International Journal of Applied
random forest and its application to credit card fraud detection." Engineering Research 13.24 (2018): 16819-16824.
International Conference on Computational Social Networks. Springer, [23] Li, Tong, et al. "Differentially private Naïve Bayes learning over
Cham, 2018. multiple data sources." Information Sciences 444 (2018): 89-104.
[15] Hong, Haoyuan, et al. "Landslide susceptibility mapping using J48 [24] Suganuma, Masanori, Shinichi Shirakawa, and Tomoharu Nagao. "A
Decision Tree with AdaBoost, Bagging and Rotation Forest ensembles genetic programming approach to designing convolutional neural
in the Guangchang area (China)." Catena 163 (2018): 399-413. network architectures." Proceedings of the Genetic and Evolutionary
[16] Zhao, Jie, et al. "Extracting and reasoning about implicit behavioral Computation Conference. ACM, 2017.
evidences for detecting fraudulent online transactions in e-Commerce." [25] Ruehle, Fabian. "Evolving neural networks with genetic algorithms to
Decision support systems 86 (2016): 109-121. study the string landscape." Journal of High Energy Physics 2017.8
[17] Sharma, Shiven, et al. "Synthetic oversampling with the majority class: (2017): 38.
A new perspective on handling extreme imbalance." 2018 IEEE [26] Ting, Kai Ming. "Confusion matrix." Encyclopedia of Machine Learning
International Conference on Data Mining (ICDM). IEEE, 2018. and Data Mining (2017): 260-260.
[18] Kim, Jaekwon, Youngshin Han, and Jongsik Lee. "Data imbalance [27] Siringoringo, Rimbun. "Klasifikasi Data Tidak Seimbang Menggunakan
problem solving for smote based oversampling: Study on fault detection Algoritma Smote Dan K-Nearest Neighbor." Journal Information
prediction model in semiconductor manufacturing process." Advanced System Development (ISD) 3.1 (2018).
Science and Technology Letters 133 (2016): 79-84.
339 | P a g e
www.ijacsa.thesai.org
View publication stats