FraudGuard AI is an end-to-end Machine Learning application designed to detect fraudulent credit card transactions in real-time. It addresses the challenge of extreme class imbalance (only 0.17% fraud cases) using a robust XGBoost classifier and provides a user-friendly interface via Streamlit.
Click here to use the Live App
- High-Performance Model: Built using XGBoost (Extreme Gradient Boosting), optimized for tabular data.
- Imbalance Handling: Utilizes
scale_pos_weightto mathematically penalize missing fraud cases, achieving high Recall. - Real-Time Inference: Instant predictions with a probability risk score.
- Production Ready: Modular code structure, pipeline-based preprocessing, and containerized with Docker.
- Interactive UI: A dark-mode dashboard to simulate transaction scenarios and visualize risk factors.
- Language: Python 3.11
- Machine Learning: Scikit-Learn, XGBoost, Joblib
- Data Processing: Pandas, NumPy
- Deployment: Streamlit Cloud, Docker
You can run this project on your local machine using Python or Docker.
-
Clone the repository:
git clone https://github.com/DhashubhanKumar/fraud-detection-live.git cd fraud-detection-live -
Create a virtual environment: It is recommended to use Python 3.11 to avoid compatibility issues.
# Windows py -3.11 -m venv venv .\venv\Scripts\Activate # Mac/Linux python3.11 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the App:
streamlit run app.py
The app will open in your browser at
http://localhost:8501.
If you have Docker installed, you can run the app in a container without installing Python libraries.
-
Build the Image:
docker build -t fraud-app . -
Run the Container:
docker run -p 8501:8501 fraud-app
Access the app at
http://localhost:8501.
The model is trained on real patterns. To see the model flag a transaction as FRAUD in the UI, set the sliders to the following values (which mimic a typical mathematical fraud signature):
- V14: Set to Negative (e.g., -5.0)
- V4: Set to Positive (e.g., 5.0)
- V11: Set to Positive (e.g., 4.0)
Click "Analyze Transaction" and watch the alert turn RED. 🚨
The model was evaluated on the unseen test set of the Kaggle Credit Card Fraud Dataset.
| Metric | Score | Description |
|---|---|---|
| ROC-AUC | 0.97+ | Excellent ability to distinguish between Fraud and Safe. |
| Recall | High | Prioritizes catching thieves over avoiding false alarms. |
Dhashubhan Kumar
Aspiring GenAI Engineer
Note: The dataset features (V1-V28) are PCA-transformed for privacy. This project simulates the backend processing of a banking security module.