Instructions to use iankamar/loan-outcome-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use iankamar/loan-outcome-models with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("iankamar/loan-outcome-models", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Loan Census and Outcome Models
Accepted-loan census analysis and a historical Fully Paid versus Charged Off comparison using logistic regression, random forest, and gradient boosting.
Results
| Model | Validation-selected threshold | Test ROC AUC | Charged-off F1 | Precision | Recall |
|---|---|---|---|---|---|
| Logistic regression | 0.18 | 0.6905 | 0.4259 | 0.3273 | 0.6096 |
| Random forest | 0.17 | 0.6938 | 0.4270 | 0.3131 | 0.6710 |
| Gradient boosting | 0.16 | 0.6941 | 0.4264 | 0.3109 | 0.6788 |
The default is Gradient boosting, chosen by validation ROC AUC. Each threshold maximizes charged-off F1 on validation data, then remains fixed for test evaluation. That objective trades precision against recall; it does not maximize overall accuracy or establish a collection strategy.
Data and target
The course CSV contains 223,143 accepted loans. Census tables retain every recorded status. Models use only 133,131 resolved loans, labeled Fully Paid=0 and Charged Off=1. Whole issue months define chronological partitions: 60,971 training, 54,431 validation, and 17,729 test rows.
The feature allowlist is recorded in metrics.json. It contains loan amount, term, interest rate, income, DTI, origination FICO, delinquency/account history, employment length, grade, home ownership, purpose, and verification status. It excludes payment totals, recoveries, last-payment data, last FICO values, IDs, geography, and joined census demographic percentages. Preprocessing is fitted on training rows only.
The source arrives already cleaned; previous transformations and the outcome snapshot date are unavailable. Resolved-only sampling creates maturity and selection effects. This is a historical outcome study, not an approval model or verified prospective default predictor. There are no rejected applications, and observed associations do not establish approval causes.
Run
Use Python 3.12. Download the course CSV used by the original project, then run:
python -m pip install -r requirements.txt
python train.py --csv path/to/accepted-census.csv
models.joblib contains the pipelines, metrics.json the census and model evaluation, and test-predictions.npz the probabilities and labels used for checks. No raw borrower records are redistributed. Load joblib files only from trusted sources. The public Space shows aggregate results and validation-threshold comparisons, without a borrower application form.
This update replaces the original mixed targets and post-outcome feature leakage. Source data retain their existing terms.
- Downloads last month
- -