MY PAYPAL
Hello everyone.Today’s topic is to build a fraud detection model using the provided data set and increase the revenue from transaction fees.
I’m glad to see you all again. Here we go🚀
1>>Of course, we can start by simply checking the dataset
2>>Statistical summary of all the numerical variables in dataset
3>>Company’s compaingn ids’ composition
4>>Visualizing distributions of all numerical variables
5>>Time
count 284807.000000
mean 26.337183
std 13.191152
min 0.000000
25% 15.055972
50% 23.525556
75% 38.700139
max 47.9977786>>Distribution of Transaction Amount
7>>Average transaction Amount for the two classes
8>>Distribution of transaction amount for the two classes
9>>Correlation Matrix
Get Burxon_coder1’s stories in your inbox
Join Medium for free to get updates from this writer.
Data Modelling🔎
Let’s groupby our data by “class” first.
1_Model>>DecisionTreeClassifier
precision recall f1-score support
0 1.00 1.00 1.00 85295
1 0.81 0.74 0.77 148
accuracy 1.00 85443
macro avg 0.90 0.87 0.89 85443
weighted avg 1.00 1.00 1.00 85443
<< 0.9992509626300574 ✅ >>2_Model<<SVC
precision recall f1-score support
0 1.00 1.00 1.00 85295
1 0.97 0.57 0.72 148
accuracy 1.00 85443
macro avg 0.98 0.79 0.86 85443
weighted avg 1.00 1.00 1.00 85443
<< 0.9992275552122467 ✅ >>3_Model>>XGBClassifier
precision recall f1-score support
0 1.00 1.00 1.00 85295
1 0.91 0.72 0.80 148
accuracy 1.00 85443
macro avg 0.95 0.86 0.90 85443
weighted avg 1.00 1.00 1.00 85443
<< 0.9993914071369217 ✅ >>4_Model>>RandomForestClassifier
precision recall f1-score support
0 1.00 1.00 1.00 85295
1 0.95 0.72 0.82 148
accuracy 1.00 85443
macro avg 0.98 0.86 0.91 85443
weighted avg 1.00 1.00 1.00 85443
<< 0.9994499256814484 ✅ >>5_Model>>LogisticRegression
precision recall f1-score support
0 1.00 1.00 1.00 85295
1 0.88 0.63 0.73 148
accuracy 1.00 85443
macro avg 0.94 0.81 0.87 85443
weighted avg 1.00 1.00 1.00 85443
<< 0.999204147794436 ✅ >>Classification summary 🏁
1_DecisionTreeClassifier << 0.9992509626300574 ✅ >>
2_SVC << 0.9992275552122467 ✅ >>
3_XGBClassifier << 0.9993914071369217 ✅ >>
4_RandomForestClassifier << 0.9994499256814484 ✅ >> 👈👈👈👈👈👈👈👍👍👍👍👍👍👍
5_LogisticRegression << 0.9992041477944436 ✅ >>






