DEV Community

Retro
Retro

Posted on

I Dockerized a Bank-Grade Credit Card Fraud Detection App with XGBoost (Recall 0.92 + SHAP)

I Dockerized a Bank-Grade Credit Card Fraud Detection App with XGBoost

SHAP Force Plot - Fraud Cases

SHAP Summary Plot

Confusion Matrix - Best Model

1. Project Background & Challenge

Credit card fraud detection is a classic extreme imbalanced data problem (fraud rate only 0.172%).

Normal accuracy looks amazing (~99.8%), but in real business the cost of false negatives is huge.

So I built the model with a Recall-first approach.

2. Key Results

  • Recall: 0.92
  • PR-AUC: 0.85
  • SHAP analysis clearly identified V14 and V17 as the top fraud drivers

3. Tech Stack & Production Features

  • Model: XGBoost + scale_pos_weight for imbalance
  • Production: Docker + docker-compose
  • Testing: Full unit tests
  • Model persistence: joblib with DataFrame input
  • Dependencies: All strictly pinned

4. How to Run (Docker)

docker compose up
Enter fullscreen mode Exit fullscreen mode

5. GitHub Repository

https://github.com/Retro099/ML-Projects/tree/main/Credit_Card_Fraud_Detection

6. What I Learned

  • Always use Recall + PR-AUC as main metrics for imbalanced data
  • In production, always use DataFrame for predictions
  • Dockerization dramatically increases portfolio credibility

If you found this project useful, feel free to star the repository ⭐

Top comments (0)