Loading...
Credit risk · Machine learning
An XGBoost model trained on 307K real loan applications from the Home Credit Default Risk dataset, with features engineered in SQL from applicants' repayment and credit-bureau history. The model below runs entirely in your browser.
Pick a real (anonymized) applicant the model never trained on, then drag the sliders to see how the risk changes.
5-fold stratified cross-validation on all 307,511 applications. Fixed seed, reproducible end to end.
| Model | ROC-AUC | PR-AUC |
|---|---|---|
| Majority-class guess | — | — |
| Logistic regression | — | — |
| Random forest | — | — |
| XGBoost | — | — |
Only 8% of applicants default, so a PR-AUC of 0.27 is about 3.4× the 0.08 you'd get by guessing.
SHAP values on 5,000 applicants. Each dot is one applicant; dots to the right pushed the prediction toward default. External credit scores dominate, followed by loan term and repayment history.

8 CSVs (58M rows) loaded into DuckDB: applications, credit-bureau loans and monthly balances, previous applications, installment payments, POS and credit-card balances.
One query per table rolls history up to one row per applicant: late-payment ratios, loan counts, debt-to-credit, card utilization, days past due.
Majority-class and logistic-regression baselines, then random forest and XGBoost with early stopping and class weighting.
ROC-AUC and PR-AUC with 5-fold stratified CV; permutation importance and SHAP for explanations.
pytest suite with hand-computed fixtures for every SQL feature (division by zero, sentinels, no target leakage) in GitHub Actions CI.
Trained free on Kaggle, model versioned on Hugging Face, and served here as static JSON: this page walks all 1,013 trees in TypeScript, verified to match XGBoost within 10⁻⁶.