Instructions to use animeshakr/sba-credit-trust with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use animeshakr/sba-credit-trust with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("animeshakr/sba-credit-trust", "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
SBA Credit-Trust β calibrated, selective loan-default model
Trustworthy default-risk model for U.S. SBA small-business loans (public dataset). The artefact is a self-contained serving bundle: an Optuna-tuned XGBoost classifier + temperature calibration + conformal approve/reject thresholds, so a single call yields a calibrated probability and a risk-controlled auto-approve / auto-reject / refer-to-human decision.
β οΈ Research / education only β not a real lending decision system. Trained on 1987β2014 SBA loans; the conformal risk control holds in distribution and degrades under temporal shift.
Files
serving_bundle.joblibβServingBundle(pipeline + temperature + conformal thresholds + form schema).sba_xgb.onnxβ the gradient-boosted model exported to ONNX (preprocessing kept in the serving layer).
Held-out test performance
- PR-AUC 0.924, ROC-AUC 0.982, isotonic ECE 0.001 (positive class = default, prevalence β 17.6%).
- Per-loan decision at Ξ± = 0.05: auto-approve 71.5% at a realised 0.65% default rate among approved; auto-reject 17% (88% true defaults); refer 11.5%.
The deployed app uses a per-loan rule (approve if individual risk β€ Ξ±, reject if β₯ 50%, else refer). The project also studies conformal marginal risk control and adaptive conformal under shift β see the GitHub repo.
Usage
from huggingface_hub import hf_hub_download
import joblib, pandas as pd
bundle = joblib.load(hf_hub_download("animeshakr/sba-credit-trust", "serving_bundle.joblib"))
X = pd.DataFrame([{ # one loan, approval-time features only
"Term": 84, "NoEmp": 5, "CreateJob": 0, "RetainedJob": 0, "GrAppv": 150000,
"SBA_Appv": 100000, "ApprovalFY": 2005, "sba_portion": 100000/150000, "real_estate": 0,
"State": "CA", "BankState": "CA", "NewExist": "1", "UrbanRural": "1",
"RevLineCr": "N", "LowDoc": "N", "naics_sector": "44", "is_franchise": 0,
}])[bundle.numeric_cols + bundle.categorical_cols]
p = bundle.predict_proba(X)[0] # calibrated P(default)
decision = bundle.decide([p], alpha=0.05)[0] # auto-approve / auto-reject / abstain (refer)
print(p, decision)
Method & caveats
Full project (leakage-corrected benchmark, tabular DL, calibration, uncertainty, OOD, conformal, cost-sensitive policy, temporal-shift study, and adaptive conformal that restores risk control under shift), plus an honest audit (including a negative OOD result), are on GitHub: https://github.com/Animesh-Kr/sba-credit-trust
Demo Space: https://huggingface.co/spaces/animeshakr/sba-credit-trust
Reference dataset on Kaggle (mirbektoktogaraev/should-this-loan-be-approved-or-denied). A prior public
demo on this dataset over-reports due to oversampling-before-split leakage; this model corrects that.
- Downloads last month
- -