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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- tabular-classification
|
| 6 |
+
- credit-score
|
| 7 |
+
- random-forest
|
| 8 |
+
- sklearn
|
| 9 |
+
- finance
|
| 10 |
+
- banking
|
| 11 |
+
pipeline_tag: tabular-classification
|
| 12 |
+
library_name: sklearn
|
| 13 |
+
datasets:
|
| 14 |
+
- custom
|
| 15 |
+
metrics:
|
| 16 |
+
- accuracy
|
| 17 |
+
- f1
|
| 18 |
+
- precision
|
| 19 |
+
- recall
|
| 20 |
+
model-index:
|
| 21 |
+
- name: credit-score-classifier
|
| 22 |
+
results:
|
| 23 |
+
- task:
|
| 24 |
+
type: tabular-classification
|
| 25 |
+
name: Credit Score Classification
|
| 26 |
+
metrics:
|
| 27 |
+
- type: accuracy
|
| 28 |
+
value: 0.80
|
| 29 |
+
name: Accuracy
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
# 💳 Credit Score Classifier
|
| 33 |
+
|
| 34 |
+
A **Random Forest Classifier** trained to predict customer credit scores into three categories: **Good**, **Standard**, and **Poor**.
|
| 35 |
+
|
| 36 |
+
## Model Description
|
| 37 |
+
|
| 38 |
+
This model analyzes customer financial data and behavioral patterns to classify their credit worthiness. It was trained on a comprehensive dataset containing financial metrics, payment history, and credit utilization patterns.
|
| 39 |
+
|
| 40 |
+
### Model Details
|
| 41 |
+
|
| 42 |
+
| Property | Value |
|
| 43 |
+
|----------|-------|
|
| 44 |
+
| **Model Type** | Random Forest Classifier |
|
| 45 |
+
| **Framework** | Scikit-learn |
|
| 46 |
+
| **Number of Trees** | 100 |
|
| 47 |
+
| **Target Classes** | Good, Standard, Poor |
|
| 48 |
+
| **Input Features** | 17 numerical + 5 categorical |
|
| 49 |
+
|
| 50 |
+
## Intended Use
|
| 51 |
+
|
| 52 |
+
### Primary Use Cases
|
| 53 |
+
- **Credit Risk Assessment**: Evaluate creditworthiness of loan applicants
|
| 54 |
+
- **Financial Services**: Automate preliminary credit screening
|
| 55 |
+
- **Banking Applications**: Support credit limit decisions
|
| 56 |
+
|
| 57 |
+
### Out-of-Scope Use
|
| 58 |
+
- This model should not be the sole decision-maker for credit approvals
|
| 59 |
+
- Not intended for use without human oversight
|
| 60 |
+
- Should not be used for discriminatory purposes
|
| 61 |
+
|
| 62 |
+
## How to Use
|
| 63 |
+
|
| 64 |
+
### Installation
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
pip install huggingface_hub scikit-learn pandas numpy
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Loading the Model
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from huggingface_hub import hf_hub_download
|
| 74 |
+
import pickle
|
| 75 |
+
|
| 76 |
+
# Download model files
|
| 77 |
+
model_path = hf_hub_download(repo_id="AdityaaXD/credit-score-classifier", filename="models/final_model.pkl")
|
| 78 |
+
scaler_path = hf_hub_download(repo_id="AdityaaXD/credit-score-classifier", filename="models/scaler.pkl")
|
| 79 |
+
label_encoder_path = hf_hub_download(repo_id="AdityaaXD/credit-score-classifier", filename="models/label_encoder.pkl")
|
| 80 |
+
feature_info_path = hf_hub_download(repo_id="AdityaaXD/credit-score-classifier", filename="models/feature_info.pkl")
|
| 81 |
+
|
| 82 |
+
# Load the model
|
| 83 |
+
with open(model_path, "rb") as f:
|
| 84 |
+
model = pickle.load(f)
|
| 85 |
+
|
| 86 |
+
with open(scaler_path, "rb") as f:
|
| 87 |
+
scaler = pickle.load(f)
|
| 88 |
+
|
| 89 |
+
with open(label_encoder_path, "rb") as f:
|
| 90 |
+
label_encoder = pickle.load(f)
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### Making Predictions
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
import pandas as pd
|
| 97 |
+
import numpy as np
|
| 98 |
+
|
| 99 |
+
# Example: Prepare your input data
|
| 100 |
+
numerical_features = {
|
| 101 |
+
'Age': 30,
|
| 102 |
+
'Annual_Income': 50000,
|
| 103 |
+
'Monthly_Inhand_Salary': 4000,
|
| 104 |
+
'Num_Bank_Accounts': 4,
|
| 105 |
+
'Num_Credit_Card': 3,
|
| 106 |
+
'Interest_Rate': 12,
|
| 107 |
+
'Num_of_Loan': 2,
|
| 108 |
+
'Delay_from_due_date': 5,
|
| 109 |
+
'Num_of_Delayed_Payment': 3,
|
| 110 |
+
'Changed_Credit_Limit': 8.0,
|
| 111 |
+
'Num_Credit_Inquiries': 4,
|
| 112 |
+
'Outstanding_Debt': 1200,
|
| 113 |
+
'Credit_Utilization_Ratio': 28.5,
|
| 114 |
+
'Credit_History_Age_Months': 180,
|
| 115 |
+
'Total_EMI_per_month': 150,
|
| 116 |
+
'Amount_invested_monthly': 200,
|
| 117 |
+
'Monthly_Balance': 500
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
# Scale numerical features
|
| 121 |
+
num_df = pd.DataFrame([numerical_features])
|
| 122 |
+
scaled_features = scaler.transform(num_df)
|
| 123 |
+
|
| 124 |
+
# Make prediction (note: categorical features need one-hot encoding)
|
| 125 |
+
prediction = model.predict(scaled_features)
|
| 126 |
+
predicted_class = label_encoder.inverse_transform(prediction)
|
| 127 |
+
print(f"Predicted Credit Score: {predicted_class[0]}")
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Training Data
|
| 131 |
+
|
| 132 |
+
The model was trained on a credit score dataset containing:
|
| 133 |
+
|
| 134 |
+
| Feature Type | Count | Examples |
|
| 135 |
+
|--------------|-------|----------|
|
| 136 |
+
| **Numerical** | 17 | Age, Annual Income, Outstanding Debt, Credit Utilization |
|
| 137 |
+
| **Categorical** | 5 | Occupation, Credit Mix, Payment Behavior |
|
| 138 |
+
|
| 139 |
+
### Input Features
|
| 140 |
+
|
| 141 |
+
#### Numerical Features
|
| 142 |
+
- `Age` - Customer's age
|
| 143 |
+
- `Annual_Income` - Yearly income
|
| 144 |
+
- `Monthly_Inhand_Salary` - Monthly take-home salary
|
| 145 |
+
- `Num_Bank_Accounts` - Number of bank accounts
|
| 146 |
+
- `Num_Credit_Card` - Number of credit cards
|
| 147 |
+
- `Interest_Rate` - Average interest rate
|
| 148 |
+
- `Num_of_Loan` - Number of active loans
|
| 149 |
+
- `Delay_from_due_date` - Average payment delay (days)
|
| 150 |
+
- `Num_of_Delayed_Payment` - Count of delayed payments
|
| 151 |
+
- `Changed_Credit_Limit` - Credit limit changes
|
| 152 |
+
- `Num_Credit_Inquiries` - Number of credit inquiries
|
| 153 |
+
- `Outstanding_Debt` - Total outstanding debt
|
| 154 |
+
- `Credit_Utilization_Ratio` - Credit utilization percentage
|
| 155 |
+
- `Credit_History_Age_Months` - Credit history length
|
| 156 |
+
- `Total_EMI_per_month` - Monthly EMI payments
|
| 157 |
+
- `Amount_invested_monthly` - Monthly investments
|
| 158 |
+
- `Monthly_Balance` - Average monthly balance
|
| 159 |
+
|
| 160 |
+
#### Categorical Features
|
| 161 |
+
- `Month` - Month of record
|
| 162 |
+
- `Occupation` - Employment type
|
| 163 |
+
- `Credit_Mix` - Types of credit accounts
|
| 164 |
+
- `Payment_of_Min_Amount` - Minimum payment behavior
|
| 165 |
+
- `Payment_Behaviour` - Spending patterns
|
| 166 |
+
|
| 167 |
+
## Model Files
|
| 168 |
+
|
| 169 |
+
| File | Description |
|
| 170 |
+
|------|-------------|
|
| 171 |
+
| `models/final_model.pkl` | Trained Random Forest model |
|
| 172 |
+
| `models/scaler.pkl` | StandardScaler for numerical features |
|
| 173 |
+
| `models/label_encoder.pkl` | LabelEncoder for target classes |
|
| 174 |
+
| `models/feature_info.pkl` | Feature metadata and column names |
|
| 175 |
+
| `models/onehot_encoder.pkl` | OneHotEncoder for categorical features |
|
| 176 |
+
|
| 177 |
+
## Limitations
|
| 178 |
+
|
| 179 |
+
- **Data Bias**: Model performance depends on training data quality and may not generalize to all populations
|
| 180 |
+
- **Feature Availability**: Requires all 17 numerical and 5 categorical features for accurate predictions
|
| 181 |
+
- **Temporal Drift**: Financial patterns change over time; periodic retraining recommended
|
| 182 |
+
- **Geographic Scope**: Trained on specific regional data; may need adaptation for other regions
|
| 183 |
+
|
| 184 |
+
## Ethical Considerations
|
| 185 |
+
|
| 186 |
+
⚠️ **Important**: This model is intended as a decision-support tool, not a replacement for human judgment.
|
| 187 |
+
|
| 188 |
+
- Always combine model predictions with human review
|
| 189 |
+
- Be aware of potential biases in credit scoring
|
| 190 |
+
- Ensure compliance with local financial regulations
|
| 191 |
+
- Provide explanations for credit decisions when required by law
|
| 192 |
+
|
| 193 |
+
## Demo Application
|
| 194 |
+
|
| 195 |
+
Try the interactive Streamlit demo: [Credit Score Classifier App](https://github.com/ADITYA-tp01/Credit-Score-Clasification)
|
| 196 |
+
|
| 197 |
+
## Citation
|
| 198 |
+
|
| 199 |
+
```bibtex
|
| 200 |
+
@misc{credit-score-classifier,
|
| 201 |
+
author = {Aditya},
|
| 202 |
+
title = {Credit Score Classification using Random Forest},
|
| 203 |
+
year = {2026},
|
| 204 |
+
publisher = {Hugging Face},
|
| 205 |
+
url = {https://huggingface.co/AdityaaXD/credit-score-classifier}
|
| 206 |
+
}
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
## Contact
|
| 210 |
+
|
| 211 |
+
- **Hugging Face**: [@AdityaaXD](https://huggingface.co/AdityaaXD)
|
| 212 |
+
- **GitHub**: [@ADITYA-tp01](https://github.com/ADITYA-tp01)
|