🏦 Home Credit Default Risk Predictor

An interactive credit scoring app built with XGBoost, SMOTE, and SHAP explainability β€” part of the Investec Portfolio Project.

How it works

  1. Fill in applicant details across the four input tabs:

    • Application β€” income, loan amount, personal details
    • Credit scores β€” external bureau scores (EXT_SOURCE_1/2/3)
    • Bureau & history β€” bureau loan aggregates and previous applications
    • Instalments β€” payment behaviour history
  2. Click Predict default risk

  3. The app returns:

    • A probability gauge showing the estimated default probability
    • A SHAP waterfall chart explaining which features drove the score
    • A decision summary table (APPROVE / REJECT at the cost-optimal threshold)

Model details

Property Value
Algorithm XGBoost (hist tree method)
Imbalance handling SMOTE (sampling_strategy=0.3)
Hyperparameter search RandomizedSearchCV (15 iter, 3-fold CV)
Evaluation metric ROC-AUC
Target threshold 0.27 (cost-optimal, not default 0.50)
Explainability TreeSHAP via shap library

Using your own trained model

Upload these three files (produced by the training pipeline) to the Space's file system:

home_credit_xgb_model.pkl      ← joblib.dump(best_xgb, ...)
home_credit_threshold.pkl      ← joblib.dump(cost_optimal_thresh, ...)
home_credit_features.pkl       ← joblib.dump(X_train.columns.tolist(), ...)

The app detects them automatically on startup. If they are absent it falls back to a demo model trained on synthetic data so the Space stays functional.

Threshold logic

The cost-optimal threshold (default 0.27) minimises expected credit loss under:

  • LGD = 45% of loan value (loss given default)
  • Opportunity cost = 8% annual interest (rejected good client)
  • False negatives are ~5Γ— more costly than false positives at median loan size

Data sources (training)

Table Rows Purpose
application_train.csv 307 511 Main application features
bureau.csv 1 716 428 External credit history
previous_application.csv 1 670 214 Past Home Credit applications
installments_payments.csv 13 605 401 Repayment behaviour (3M sampled)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support