Skip to content

paul-souvik3/credit-card-fraud-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’³ Credit Card Fraud Detection App

A Streamlit web application that uses a trained XGBoost classification model to detect the risk of credit card fraud based on anonymized transaction features.


πŸš€ Live App

πŸ‘‰ Click here to access the live Streamlit app


πŸ“Š About the Dataset

  • 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 fraud
    • V10: Linked to unusual transaction behavior
    • V12: Reflects customer spending behavior
    • V4: Captures transaction frequency signals
    • V17: Often tied to internal risk scores
  • Target Variable: Class

    • 0: Genuine Transaction
    • 1: Fraudulent Transaction

πŸ› οΈ How It Works

Users input 5 anonymized PCA-derived features from a credit card transaction. The app:

  • Loads a pre-trained XGBoost model (fraud_xgb_model.pkl)
  • Predicts whether the transaction is fraudulent or genuine
  • Displays the fraud probability score

🎯 App Features

  • βœ… 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

⚠️ Model Disclaimer

  • 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.


πŸ§ͺ Example Inputs

Feature Placeholder Example
V14 -2.3456
V10 3.2178
V12 -4.1023
V4 1.2567
V17 -1.7890

πŸ“ Technologies Used

  • Python
  • Streamlit
  • XGBoost
  • scikit-learn
  • pandas, numpy
  • joblib

πŸ“ Project Structure

Fraud_Detection/
β”œβ”€β”€ app.py                  # Streamlit frontend app
β”œβ”€β”€ fraud_xgb_model.pkl     # Trained ML model
β”œβ”€β”€ requirements.txt        # Dependencies
└── README.md               # Project documentation

πŸ“¦ Requirements

Install dependencies using:

pip install -r requirements.txt