Dadix/PD_estimation_XGBoost
1
Credit Risk — Probability of Default
An interactive web app that predicts the probability of default for a borrower using an XGBoost classifier trained on the German Credit Dataset.
Features
- Inputs: Age, Sex, Job, Housing, Saving Accounts, Checking Account, Credit Amount, Duration, Purpose
- Output: Probability of default (%), creditworthiness score, risk tier (Low / Medium / High)
- Clean dark finance-themed UI
Files required in this Space
Upload these files alongside app.py:
How to export your model from the notebook
Add this cell at the end of your Colab notebook and run it:
import joblib
# Save the XGBoost model
joblib.dump(best_xgb, "XGBclassifier.pkl")
# Save all encoders (they were already saved during feature engineering,
# but re-save here to be sure)
for col in ['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose']:
joblib.dump(encoders[col], f"{col}_encoder.pkl")
# Download from Colab
from google.colab import files
files.download("XGBclassifier.pkl")
for col in ['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose']:
files.download(f"{col}_encoder.pkl")Deployment on Hugging Face Spaces
- Go to huggingface.co/new-space
- Choose Gradio as the SDK
- Upload all
.pklfiles +app.py+requirements.txt - The Space will build and launch automatically
