Skip to content

dalimkumar452-sudo/Card-Fraud-Detection

Repository files navigation

💳 Credit Card Fraud Detection System

Python FastAPI ML Status

An end-to-end Machine Learning pipeline that detects fraudulent credit card transactions in real-time. This project features a trained XGBoost model, a FastAPI backend for real-time scoring, and automated visualization of model insights.


📊 Model Insights & Performance

The following charts are automatically generated by the system to explain the model's decision-making process.

1. Feature Importance

This chart highlights which transaction behaviors (like amount velocity or frequency) the model considers most suspicious to identify fraud.

Feature Importance Chart

2. Real-Time Prediction Breakdown

A visual representation of how the system classifies daily transactions. Based on the latest run, the model detected 12 suspicious transactions from a test batch.

Fraud Detection Pie Chart


🚀 Key Features

  • Real-time Inference: Fast API endpoints to score transactions in milliseconds.
  • Smart Feature Engineering: Behavior-based features to accurately capture fraud patterns.
  • Interactive Documentation: Auto-generated Swagger UI for instant API testing.
  • Automated Visualization: Instant generation of Pie Charts and Bar Charts from model results.
  • Scalable Structure: Clean and professional project organization for real-world deployment.

📂 Project Structure

Credit-Card-Fraud-Detection/
│
├── data/               # Raw and processed datasets
├── src/                # Core logic (features.py, train.py)
├── models/             # Saved ML models (.joblib)
├── images/             # Visualizations (Feature Importance & Pie Charts)
├── main.py             # FastAPI entry point
├── run_app.py          # Auto-launch script (Server + Browser)
├── visualize.py        # Analytics & Chart generation script
├── requirements.txt    # Project dependencies
└── README.md           # Project documentation
🛠️ Installation & Setup
Clone the Project:

Bash
git clone [https://github.com/dalimkumar452-sudo/Card-Fraud-Detection.git](https://github.com/dalimkumar452-sudo/Card-Fraud-Detection.git)
cd Card-Fraud-Detection
Setup Virtual Environment:

Bash
python -m venv .venv
.venv\Scripts\activate  # Windows
Install Dependencies:

Bash
pip install -r requirements.txt
🚦 How to Run
Step 1: Train & Visualize
Run the scripts to prepare the model and generate performance charts:

Bash
python src/train.py
python visualize.py
Step 2: Launch the System
Start the FastAPI server and open the testing dashboard automatically:

Bash
python run_app.py
👨‍💻 Developed By
Dalim Kumar
AI & Machine Learning Enthusiast

License: MIT License - check the LICENSE file for details.

About

"A high-performance Real-Time Card Fraud Detection System built with XGBoost and FastAPI, featuring automated data visualization and behavioral analytics."

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages