An intelligent Machine Learning project that detects fraudulent online payment transactions using multiple classification algorithms.
Online payment fraud has become one of the biggest challenges in digital transactions. This project uses Machine Learning algorithms to classify whether a transaction is Legitimate or Fraudulent based on transaction details.
The system performs data preprocessing, feature encoding, feature scaling, model training, prediction, and performance evaluation using three popular Machine Learning algorithms.
- Detect fraudulent online payment transactions.
- Compare multiple Machine Learning algorithms.
- Improve fraud detection accuracy.
- Reduce financial losses caused by fraudulent transactions.
- Python
- Google Colab
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
The dataset contains important transaction details such as:
- step β Represents the time step (hour) of the transaction.
- type β Type of transaction (e.g., CASH_IN, CASH_OUT, DEBIT, PAYMENT, TRANSFER).
- amount β Amount of money involved in the transaction.
- nameOrig β Unique identifier of the sender's account.
- oldbalanceOrg β Sender's account balance before the transaction.
- newbalanceOrig β Sender's account balance after the transaction.
- nameDest β Unique identifier of the receiver's account.
- oldbalanceDest β Receiver's account balance before the transaction.
- newbalanceDest β Receiver's account balance after the transaction.
- isFraud β Indicates whether the transaction is fraudulent (1) or legitimate (0).
- isFlaggedFraud β Indicates whether the transaction was flagged as suspicious by the system.
- isFraud
- 0 β Legitimate Transaction
- 1 β Fraudulent Transaction
- Logistic Regression
- Decision Tree Classifier
- Random Forest Classifier
| Machine Learning Model | Accuracy |
|---|---|
| Logistic Regression | 78.33% |
| Decision Tree Classifier | 93.67% |
| Random Forest Classifier | 96.50% β |
Random Forest Classifier
Accuracy: 96.50%
Dataset
β
βΌ
Data Preprocessing
β
βΌ
Handling Missing Values
β
βΌ
Encoding Categorical Data
β
βΌ
Feature Scaling
β
βΌ
Train-Test Split
β
βΌ
Model Training
β
βΌ
Prediction
β
βΌ
Model Evaluation
The models are evaluated using:
- Accuracy Score
- Confusion Matrix
- Classification Report
The model predicts whether an online payment transaction is Fraudulent or Legitimate using two different transaction examples.
Input
Step : 600
Transaction Type : TRANSFER
Amount : 950000
Old Balance Origin : 950000
New Balance Origin : 0
Old Balance Dest : 0
New Balance Dest : 950000
Flagged Fraud : 0
Expected Output
Prediction : 1
Transaction Status : Fraudulent Transaction
A high-value transfer that empties the sender's account is predicted as a Fraudulent Transaction.
Input
Step : 250
Transaction Type : PAYMENT
Amount : 4500.75
Old Balance Origin : 15000.00
New Balance Origin : 10500.25
Old Balance Dest : 5000.00
New Balance Dest : 9500.75
Flagged Fraud : 0
Expected Output
Prediction : 0
Transaction Status : Legitimate Transaction
A normal payment transaction with a reasonable amount and valid balance update is predicted as a Legitimate Transaction.
Project_3_Online_Payment_Fraud_Detection_System_Using_Machine_Learning/
β
βββ Online_Payment_Fraud_Detection_System.ipynb
βββ Online_Payment_Fraud_Detection_System.py
βββ Dataset/
β βββ Online_Payment_Fraud_Dataset.csv
βββ images/
β βββ confusion_matrix.png
β βββ feature_importance.png
β βββ model_accuracy_comparison.png
βββ best_model.pkl
βββ feature_names.pkl
βββ label_encoders.pkl
βββ scaler.pkl
βββ requirements.txt
βββ README.md
βββ LICENSE
git clone https://github.com/Tuhin092005/Project_3_Online_Payment_Fraud_Detection_System_Using_Machine_Learning.gitcd Project_3_Online_Payment_Fraud_Detection_System_Using_Machine_Learningpip install -r requirements.txtpython Online_Payment_Fraud_Detection_System.pyOpen
Online_Payment_Fraud_Detection_System.ipynb
Upload:
- Online_Payment_Fraud_Dataset.csv
Run all cells.
- Deep Learning based fraud detection
- Real-time fraud monitoring
- Web Application using Flask or Streamlit
- API Integration
- Explainable AI (XAI)
Tuhin Maji
B.Tech CSE (Artificial Intelligence & Machine Learning)
Meghnad Saha Institute of Technology (MSIT)
Please consider giving this repository a β on GitHub.
It motivates future development and improvements.
This project is licensed under the MIT License.
Feel free to use, modify, and distribute this project for educational purposes.