This project is a statistical credit scoring model that predicts a customer's likelihood of defaulting on a loan and generates a CIBIL-like score (300-900). The model uses Logistic Regression with features such as credit utilization, on-time payments, and past defaults to assess creditworthiness.
- Preprocesses financial data (categorical & numerical features).
- Handles class imbalance using SMOTE.
- Trains a Logistic Regression model to predict credit risk.
- Calculates feature importance and contribution percentages.
- Normalizes model output to a CIBIL score (300-900).
- Visualizes model performance with an ROC curve and credit score distribution.
git clone https://github.com/your-username/credit-scoring-model.git
cd credit-scoring-modelYou need Python 3.8+ and the required libraries. Install them using:
pip install -r requirements.txtpython credit_score.pyThe model depends on the following Python libraries:
numpy
pandas
scikit-learn
imblearn
matplotlib
seabornYou can install them manually with:
pip install numpy pandas scikit-learn imblearn matplotlib seaborn- Drops unnecessary columns (e.g.,
CustomerID). - Encodes categorical variables.
- Scales numerical data using
StandardScaler.
- Uses SMOTE (Synthetic Minority Over-sampling Technique) to balance defaulters and non-defaulters.
- Splits data into training/testing sets.
- Trains a Logistic Regression model.
- Evaluates with classification metrics (AUC-ROC, confusion matrix, etc.).
- Extracts feature importance from model coefficients.
- Calculates percentage contribution of each factor to credit score.
- Converts predicted probabilities into CIBIL score range (300-900).
- ROC Curve to analyze classification performance.
- Histogram to visualize predicted CIBIL scores.
| Feature | Contribution (%) |
|---|---|
| Credit Utilization | 35.2% |
| On-Time Payments | 28.4% |
| Past Defaults | 15.8% |
| Total Debt | 10.6% |
AUC Score Example: 0.85 (Higher is better)
- Using Actual CIBIL Dataset for better accuracy.
- Try advanced models like Random Forest, XGBoost.
- Deploy as an API or Web App.
- Optimize feature selection for better accuracy.
This project is MIT Licensed.
Feel free to contribute by creating issues or pull requests.
For questions, reach out via yuvan7480@gmail.com or create a GitHub issue.