Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 

Repository files navigation

πŸ’³ Fraud Detection System using Machine Learning

πŸ“Œ Overview

The Fraud Detection System is an end-to-end Machine Learning project designed to identify fraudulent financial transactions. The project focuses on solving the real-world challenge of highly imbalanced datasets while maximizing fraud detection performance using multiple classification algorithms.

The system includes data preprocessing, exploratory data analysis (EDA), feature engineering, model training, evaluation, and deployment through a FastAPI backend with an optional React frontend.


🎯 Objectives

  • Detect fraudulent transactions with high accuracy.
  • Reduce false negatives by maximizing recall.
  • Compare multiple machine learning algorithms.
  • Handle class imbalance using advanced sampling techniques.
  • Deploy the trained model as a REST API.
  • Build a user-friendly interface for real-time fraud prediction.

πŸš€ Features

  • Data Cleaning and Preprocessing
  • Exploratory Data Analysis (EDA)
  • Feature Engineering
  • Handling Imbalanced Data (SMOTE, Random Oversampling, Undersampling)
  • Multiple Machine Learning Models
  • Hyperparameter Tuning
  • Model Evaluation using industry-standard metrics
  • FastAPI Backend
  • React Frontend (Optional)
  • Model Serialization and Deployment

πŸ“‚ Project Structure

Fraud-Detection-System/
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/
β”‚   β”œβ”€β”€ processed/
β”‚   └── external/
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ 01_data_understanding.ipynb
β”‚   β”œβ”€β”€ 02_data_cleaning.ipynb
β”‚   β”œβ”€β”€ 03_eda.ipynb
β”‚   β”œβ”€β”€ 04_feature_engineering.ipynb
β”‚   β”œβ”€β”€ 05_model_training.ipynb
β”‚   └── 06_model_evaluation.ipynb
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ preprocessing.py
β”‚   β”œβ”€β”€ features.py
β”‚   β”œβ”€β”€ train.py
β”‚   β”œβ”€β”€ evaluate.py
β”‚   β”œβ”€β”€ predict.py
β”‚   └── utils.py
β”‚
β”œβ”€β”€ models/
β”‚
β”œβ”€β”€ reports/
β”‚
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ app.py
β”‚   └── templates/
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── .gitignore

πŸ“Š Dataset

This project uses the Credit Card Fraud Detection Dataset from Kaggle.

Dataset Characteristics

  • Total Transactions: 284,807
  • Fraudulent Transactions: 492
  • Legitimate Transactions: 284,315

This dataset is highly imbalanced, making it ideal for learning fraud detection techniques.


πŸ› οΈ Technologies Used

Programming Language

  • Python

Data Analysis

  • Pandas
  • NumPy

Data Visualization

  • Matplotlib
  • Seaborn
  • Plotly

Machine Learning

  • Scikit-learn
  • XGBoost
  • LightGBM
  • CatBoost

Imbalanced Learning

  • imbalanced-learn (SMOTE, ADASYN)

Deployment

  • FastAPI
  • Uvicorn

Frontend (Optional)

  • React.js

βš™οΈ Machine Learning Workflow

  1. Data Collection
  2. Data Cleaning
  3. Exploratory Data Analysis
  4. Feature Engineering
  5. Feature Scaling
  6. Handle Class Imbalance
  7. Train-Test Split
  8. Model Training
  9. Hyperparameter Tuning
  10. Model Evaluation
  11. Model Saving
  12. API Development
  13. Deployment

πŸ€– Models Implemented

  • Logistic Regression
  • Decision Tree
  • Random Forest
  • Support Vector Machine
  • XGBoost
  • LightGBM
  • CatBoost

πŸ“ˆ Evaluation Metrics

Since fraud detection is an imbalanced classification problem, the following metrics are used:

  • Precision
  • Recall
  • F1 Score
  • ROC-AUC Score
  • Precision-Recall AUC
  • Confusion Matrix

πŸš€ Installation

Clone the repository:

git clone https://github.com/your-username/Fraud-Detection-System.git

Move into the project directory:

cd Fraud-Detection-System

Install dependencies:

pip install -r requirements.txt

▢️ Run the Project

Start the FastAPI server:

uvicorn app:app --reload

Open your browser:

http://127.0.0.1:8000

API documentation:

http://127.0.0.1:8000/docs

πŸ“Š Future Improvements

  • Real-time transaction monitoring
  • Explainable AI using SHAP
  • Model monitoring and drift detection
  • Docker containerization
  • CI/CD pipeline
  • Cloud deployment (AWS, Azure, GCP)
  • Streaming fraud detection with Kafka
  • Interactive analytics dashboard

🀝 Contributing

Contributions are welcome.

  1. Fork the repository.
  2. Create a new feature branch.
  3. Commit your changes.
  4. Push the branch.
  5. Open a Pull Request.

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Parm Khurana

B.Tech Computer Science & Engineering Machine Learning | Data Science | Full Stack Development


⭐ Support

If you found this project useful, consider giving it a ⭐ on GitHub.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors