A sophisticated credit risk model that categorizes loan applications into Poor, Average, Good, and Excellent categories based on criteria similar to the CIBIL scoring system.
def get_rating(score):
if 300 <= score < 500:
return 'Poor'
elif 500 <= score < 650:
return 'Average'
elif 650 <= score < 750:
return 'Good'
elif 750 <= score <= 900:
return 'Excellent'
else:
return 'Undefined'- Predict credit risk based on user inputs:
- Age
- Income
- Loan Amount
- Loan Tenure (Months)
- Average DPD per Delinquency
- Delinquency Ratio
- Credit Utilization Ratio
- Number of Open Accounts
- Residence Type
- Loan Purpose
- Loan Type
- Programming Language: Python
- Libraries/Frameworks:
scikit-learn,streamlit,pandas,numpy,joblib,xgboost
- Clone the repository:
git clone <repository-url> cd <repository-folder>
- Install the dependencies:
pip install -r requirements.txt
- Run the Streamlit app:
streamlit run app.py
- Open the deployed app on Streamlit Cloud.
- Enter user details such as:
- Age
- Income
- Loan Amount
- Loan Tenure (Months)
- Average DPD per Delinquency
- Delinquency Ratio
- Credit Utilization Ratio
- Number of Open Accounts
- Residence Type
- Loan Purpose
- Loan Type
- The app predicts:
- Default Probability: e.g.,
63.25% - Credit Score: e.g.,
520 - Rating: e.g.,
Average
- Default Probability: e.g.,
- Merged datasets:
- Customers Dataset
- Loans Dataset
- Bureau Dataset
- Resulted in 50,000 rows and 33 columns.
- Data Splitting: Performed train-test split early to avoid data leakage.
- Data Cleaning: Replaced invalid loan purpose values with mode.
- Feature Selection: Utilized VIF, IF, and domain knowledge.
- Scaling: Min-Max scaling for numeric features.
- Train-Test Split: 75% train, 25% test.
- Model Training:
- Logistic Regression
- XGBoost
- Random Forest
- Fine Tuning:
- RandomizedSearchCV
- Optuna
- Evaluation Metrics:
- AUC-ROC
- KS
- Gini Coefficient
- Classification Report
- Platform: Streamlit Cloud
This project is licensed under the Apache 2.0 License.
Contributions are welcome! Feel free to open issues or submit pull requests.

