Skip to content
Charan Kumar Reddy
Data & MLExperimentalSynthetic data

Smart Loan Recovery

Leak-free PD × LGD × EAD expected-loss pipeline, evaluated out of time

Leak-free credit-risk pipeline on a month-by-month simulated loan book: calibrated PD (logistic regression vs LightGBM vs XGBoost), LGD and EAD models, Expected Loss = PD × LGD × EAD backtested out of time, recovery-priority tiers and SHAP driver summaries. Replaces an earlier version whose label was K-Means cluster membership.

PD out-of-time ROC-AUC against a 0.8343 oracle ceiling
0.7645
benchmarks/metrics.json
of realised out-of-time loss in the top 5% of loans by expected loss
45.4%
benchmarks/metrics.json

The problem

Collection teams need to know which performing loans are likely to default and how much each would cost, without a model that leaks the answer into its features.

The approach

Month-by-month loan-book simulation with timing-tagged columns and an out-of-time split; calibrated PD, LGD and EAD models combined into Expected Loss and recovery tiers, with SHAP explanations.

Architecture

  1. 01

    Loan-book simulation

    52,000 applicants across personal, auto, home-equity and revolving products are underwritten and simulated month by month: missed instalments, cures, roll to 90+ DPD, prepayment, utilisation draw-down and collateral workouts.

  2. 02

    Leak-free snapshots

    A column registry tags every field as origination, snapshot, outcome or generator; features use history up to the snapshot only and the label is 90+ DPD in the next 12 months. Development snapshot 2022-06, out-of-time test 2023-06.

  3. 03

    PD

    Logistic regression, LightGBM and XGBoost with isotonic calibration, compared by stratified 5-fold CV; the lowest CV Brier score was the pre-declared selection rule.

  4. 04

    LGD and EAD

    LightGBM models on development defaults (cross-entropy objective for LGD in [0, 1], EAD as a factor of limit or balance), each compared with a product-mean baseline.

  5. 05

    Expected Loss and tiers

    EL = PD × LGD × EAD per loan, backtested against realised OOT losses; loans are ranked by EL into four recovery tiers with actions.

  6. 06

    Explainability

    SHAP (linear and tree explainers) per model, with one-hot columns summed back to their source feature.

Key decisions

  • Tests leakage directly: re-simulating every month after the snapshot leaves all features identical while labels change.
  • Reports the generator's oracle PD as a ceiling so model AUC is read against what is learnable.
  • Removes features that are exact functions of others after they split the logistic model's SHAP attributions.
  • Leaves the 30% EL over-prediction uncorrected and traces it to PD drift between periods instead of using OOT data to fix it.

Results

  • PD OOT ROC-AUC 0.7645 (bootstrap 95% CI 0.749 to 0.780) against an oracle ceiling of 0.8343; the three PD models are statistically tied.
  • LGD R² 0.8354 and EAD-factor R² 0.6415 on OOT defaults; the top 5% of loans by EL hold 45.4% of realised OOT loss.
Measured results and the files they come from
MetricValueSource
PD out-of-time ROC-AUC (oracle ceiling 0.8343)0.7645 · Brier 0.04106benchmarks/metrics.json
Realised OOT loss in the top 5% of loans by EL45.4% vs 36.3% by PD alonebenchmarks/metrics.json
Shuffled-label leakage control, mean OOT ROC-AUC0.5055 over 5 drawsbenchmarks/metrics.json

How it is tested

  • 16 pytest tests including the future-resampling leakage test, SHAP additivity and EL identities; CI runs them and the full pipeline on Python 3.12 and 3.13.
  • Five shuffled-label refits as a leakage control, plus a 500-resample bootstrap for the selected model's OOT metrics.

Limits, stated plainly

  • Synthetic data: the models recover the generator's assumptions, so the numbers do not describe a real portfolio.
  • No macro feature: EL over-predicts realised OOT loss by 30% because the training year had a higher default rate.

Stack

Pythonscikit-learnLightGBMXGBoostSHAPpandaspytestGitHub Actions