Readme · MD
# 🇲🇦 Credit Card Default Risk Prediction - Moroccan Banking Portfolio
> **Production-ready end-to-end ML pipeline** · 30,000 customers · 7 models compared · XGBoost final model · SHAP explainability · Interactive Streamlit dashboard
---
## 🔗 Links
👉 **Launch Live Dashboard**
👉 **View Notebook**
👉 **Executive Report**
---
## 📌 Business Problem
Moroccan banks lose **hundreds of millions of MAD annually** to credit card defaults.
This project builds a machine learning system that predicts which customers will default **next month** - enabling risk teams to intervene early through:
- 💳 Credit limit adjustments
- 📋 Structured repayment plan offers
- 🚨 Escalation to manual review
- 📊 Portfolio-level risk monitoring
**Estimated business impact on a 50,000-card portfolio: ~300M MAD saved annually**
---
## 🖥️ Dashboard Preview
| Feature | Description |
|---|---|
| 🎯 Risk Gauge | Live default probability (0–100%) with color-coded tiers |
| 🟢🟡🔴 Risk Tiers | Low / Medium / High with branch manager recommendations |
| 🔍 Key Risk Drivers | SHAP-based feature contribution bar chart |
| 📈 Balance Trend | 6-month statement vs payment chart |
| 🏦 Decision Framework | Full 3-tier approval guidelines |
| 👤 Sample Profiles | Pre-loaded safe / borderline / high-risk test customers |
> Branch managers enter customer data → model predicts default probability in real time
---
## 📊 Results
| Model | AUC-ROC | F1 Score | Recall | Precision |
|---|---|---|---|---|
| Logistic Regression | 0.679 | 0.445 | 0.610 | 0.350 |
| K-Nearest Neighbors | 0.643 | 0.190 | 0.121 | 0.435 |
| Decision Tree | 0.660 | 0.435 | 0.572 | 0.351 |
| Random Forest | 0.684 | 0.433 | 0.518 | 0.371 |
| LightGBM | 0.668 | 0.433 | 0.544 | 0.359 |
| CatBoost | 0.684 | 0.445 | 0.585 | 0.359 |
| **✅ XGBoost (Tuned)** | **0.689** | **0.454** | **0.646** | **0.350** |
> XGBoost selected as final model · Tuned via RandomizedSearchCV (40 iterations, 5-fold CV)
> Optimal classification threshold: * …