Credit Risk ML Platform
Predicts the probability that a consumer loan defaults, then turns it into decisions: risk grades, approval cut-offs, collections priorities and drift alerts. The model, API and dashboard below are live.
- Test AUC
- 0.769
- Gini
- 0.537
- Lift in the riskiest 10%
- 3.5x
- Loans modelled
- 307,511
Overview
What the project does, what each dashboard is for, the data behind it, how the model performed, and the regulatory context.
About this page
An end-to-end credit risk platform, built the way a bank would run one. A machine-learning model predicts each applicant's probability of default (PD): the chance they will struggle to repay. The platform turns that into risk grades, credit decisions, approval and collections strategies, and drift alerts, and explains every score.
Behind the dashboards: a LightGBM champion model trained on 196,806 loans and tested on 61,503 it never saw, managed in MLflow, served by a FastAPI scoring service in Docker, and checked by automated tests on every change.
Live demo on free hosting: after a quiet spell the dashboard and API take up to a minute to wake up (choose “Yes, get this app back up” if asked). It scores 5,000 simulated applications, because the Home Credit data can't be redistributed; the model does somewhat less well on them (AUC about 0.70) than on the real data (0.769). Amounts are in the lender's undisclosed local currency.
What each dashboard is for
| Tab | Question it answers | Typically used by |
|---|---|---|
| Portfolio | How risky is the book, and where is the risk concentrated? | Risk managers |
| Customer Scoring | Should we lend to this applicant, and why? | Credit officers |
| Model Performance | Is the model accurate, and can its PDs be trusted? | Model validators |
| Strategy Simulator | Where should the approval cut-off be, and whom should collections call first? | Credit strategy and collections teams |
| Model Monitoring | Are applicants changing in a way that breaks the model? | Model risk and MLOps teams |
About the data
The model was built on the Home Credit Default Risk data: 307,511 consumer loans with an 8.07% default rate. The competition's terms don't allow the data to be redistributed, so the live demo scores 5,000 simulated applications instead. They have the real test set's risk mix, but their outcomes are deliberately noisier. The model still performs well on them (AUC about 0.70, against 0.769 on the real data), but less well than on its own test set, as models do on new data. No real loan is published.
Currency: the data doesn't say. Amounts are in the lender's local currency, and even the credit bureau's currency field is anonymised as "currency 1" to "currency 4". The dashboards therefore show amounts as plain numbers, not rand or dollars.
How the model performed on the real data
61,503 held-out loans, shared here only as summary figures.
| Measure | Result | What it means |
|---|---|---|
| Ranking power (AUC / Gini) | 0.769 / 0.537 | Strong for an application scorecard (typical AUC: 0.70–0.80). |
| Separation (KS) | 0.400 | Good separation of defaulters from non-defaulters. |
| Calibration | 8.00% predicted vs 8.07% actual | PDs can be taken at face value. |
| Riskiest 10% of applicants | 35.5% of all defaults | 3.5x better than random. |
| Riskiest 20% of applicants | 54% of all defaults | 2.7x better than random. |
| Riskiest vs safest tenth | 28.6% vs 1.1% default rate | Risk falls steadily from decile to decile. |
| Validation vs test AUC | 0.763 vs 0.769 | Holds up on unseen data: no over-fitting. |
| Challenger models (test AUC) | Logistic regression 0.751, random forest 0.747 | LightGBM was best on validation, so it became champion. |
| Decisions (approve < 10% PD, decline ≥ 20%) | Approve 74.8%, refer 16.8%, decline 8.4% | Declined applicants default 7x as often as approved ones (30.3% vs 4.2%). |
Predicted vs actual default rate by risk grade
| Grade | Share of loans | Predicted PD | Actual default rate |
|---|---|---|---|
| A (PD < 2%) | 15.0% | 1.4% | 1.3% |
| B (2–5%) | 34.1% | 3.4% | 3.3% |
| C (5–10%) | 25.7% | 7.1% | 7.3% |
| D (10–20%) | 16.8% | 13.9% | 14.0% |
| E (20% or more) | 8.4% | 29.8% | 30.3% |
Predicted and actual rates agree within half a percentage point in every grade, so the grades can be used for pricing and limits.
Regulation: South Africa vs the United States
Credit default models are regulated differently in the two countries. Neither prescribes an algorithm: both expect models to be validated, governed and explainable. They differ in who approves the models and what they are used for.
| South Africa | United States | |
|---|---|---|
| Regulators | Prudential Authority (South African Reserve Bank); National Credit Regulator for consumer lending. | Federal Reserve, OCC and FDIC; CFPB for consumer lending. |
| PD models for capital | Basel III. Banks use standardised rules or internal (IRB) models approved by the Prudential Authority; the large banks use IRB. | Internal models only at the largest banks; most use standardised rules. A 2023 proposal would replace internal credit models with standardised rules. |
| Loss provisions | IFRS 9 expected credit loss (12-month or lifetime). | CECL: lifetime expected credit loss. |
| Model governance | Basel IRB minimum standards: independent validation, data history and supervisory approval of material changes. | SR 11-7 / OCC 2011-12 model risk guidance: sound development, independent validation and governance. |
| Customer protection | National Credit Act: affordability checks, no reckless lending. POPIA restricts credit decisions based solely on automated processing. | ECOA / Regulation B: specific reasons for every decline, even from complex models. Fair-lending rules ban discriminatory outcomes. |
| Flexibility in model type | Lower for capital models: they must be approved, stable and explainable, so logistic-regression scorecards dominate. Machine learning is used more for IFRS 9, decisioning and challenger models. | Higher: machine learning is common in underwriting, provided it is validated and can give specific decline reasons. |
A short, high-level summary, not legal advice. This project follows these expectations (hold-out validation, reason codes, gender excluded) but hasn't been through any regulatory approval.
What the numbers and charts mean
| Shown on the page | What it means | How to read it |
|---|---|---|
| Champion model | Model version in production (v2, LightGBM). | Replaced only by a model that beats it on hold-out checks. |
| Test AUC | Chance a defaulter gets a higher PD than a non-defaulter. | 0.5 is random and 1.0 is perfect. Higher is better. |
| Gini | 2 × AUC − 1, the form banks report. | 0 is random and 1 is perfect. |
| KS | Largest gap between the score distributions of defaulters and non-defaulters. | Above 0.40 is good. |
| Portfolio | Applications scored on the other tabs. | 5,000 simulated applications in the demo. |