Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- tabular-classification
|
| 4 |
+
- xgboost
|
| 5 |
+
- scikit-learn
|
| 6 |
+
- loan-default
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Loan Default Classifier
|
| 10 |
+
|
| 11 |
+
Binary classifier predicting whether a loan applicant will default, mirrored here from the
|
| 12 |
+
MLflow Model Registry of the source project (`loan-default-classifier`, best model: **xgboost**).
|
| 13 |
+
|
| 14 |
+
## Test set performance
|
| 15 |
+
|
| 16 |
+
| Model | Accuracy | Precision | Recall | F1 | ROC-AUC | PR-AUC |
|
| 17 |
+
|---|---|---|---|---|---|---|
|
| 18 |
+
| logistic_regression | 0.672 | 0.214 | 0.680 | 0.325 | 0.739 | 0.313 |
|
| 19 |
+
| random_forest | 0.856 | 0.358 | 0.309 | 0.332 | 0.740 | 0.310 |
|
| 20 |
+
| xgboost | 0.687 | 0.221 | 0.671 | 0.333 | 0.746 | 0.324 |
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
`model.pkl` is a scikit-learn `Pipeline` (preprocessing + classifier) saved with `joblib`. It expects
|
| 25 |
+
a single-row DataFrame with these raw feature columns:
|
| 26 |
+
|
| 27 |
+
`Age, Income, LoanAmount, CreditScore, MonthsEmployed, NumCreditLines, InterestRate, LoanTerm, DTIRatio, Education, EmploymentType, MaritalStatus, HasMortgage, HasDependents, LoanPurpose, HasCoSigner`
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import joblib
|
| 31 |
+
import pandas as pd
|
| 32 |
+
|
| 33 |
+
pipeline = joblib.load("model.pkl")
|
| 34 |
+
row = pd.DataFrame([{...}], columns=['Age', 'Income', 'LoanAmount', 'CreditScore', 'MonthsEmployed', 'NumCreditLines', 'InterestRate', 'LoanTerm', 'DTIRatio', 'Education', 'EmploymentType', 'MaritalStatus', 'HasMortgage', 'HasDependents', 'LoanPurpose', 'HasCoSigner'])
|
| 35 |
+
probability = pipeline.predict_proba(row)[0, 1]
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Trained as part of an end-to-end MLOps pipeline (DVC + MLflow + FastAPI + Docker + GitHub Actions).
|
| 39 |
+
Source repository: https://github.com/Yashwanth-R19/loan-default-mlops
|