A Streamlit web application that uses a trained XGBoost classification model to detect the risk of credit card fraud based on anonymized transaction features.
π Click here to access the live Streamlit app
-
Source: Kaggle β Credit Card Fraud Detection
-
Samples: 284,807 transactions
-
Fraud Cases: 492 (~0.17%) β heavily imbalanced
-
Features Used (Top 5 selected based on importance):
V14: PCA component strongly correlated with fraudV10: Linked to unusual transaction behaviorV12: Reflects customer spending behaviorV4: Captures transaction frequency signalsV17: Often tied to internal risk scores
-
Target Variable:
Class0: Genuine Transaction1: Fraudulent Transaction
Users input 5 anonymized PCA-derived features from a credit card transaction. The app:
- Loads a pre-trained
XGBoostmodel (fraud_xgb_model.pkl) - Predicts whether the transaction is fraudulent or genuine
- Displays the fraud probability score
- β Clean Streamlit UI with input tooltips and examples
- β Real-time fraud prediction with risk score
- β Educates users on dataset and model behavior
- β Clear disclaimers about limitations
-
This model is trained on anonymized and imbalanced data.
-
While tuned with SMOTE and hyperparameter optimization, misclassifications may still occur.
-
Designed for:
- Educational use β
- Demonstrating end-to-end ML β
- Prototyping and portfolios β
-
β Not suitable for production or real-time banking environments.
| Feature | Placeholder Example |
|---|---|
| V14 | -2.3456 |
| V10 | 3.2178 |
| V12 | -4.1023 |
| V4 | 1.2567 |
| V17 | -1.7890 |
- Python
- Streamlit
- XGBoost
- scikit-learn
- pandas, numpy
- joblib
Fraud_Detection/
βββ app.py # Streamlit frontend app
βββ fraud_xgb_model.pkl # Trained ML model
βββ requirements.txt # Dependencies
βββ README.md # Project documentation
Install dependencies using:
pip install -r requirements.txt