Credit risk modeling is essential for financial institutions to assess the likelihood of a borrower defaulting on a loan.
This project provides a credit risk assessment system powered by machine learning. It evaluates borrowers' default risk, calculates credit scores, and assigns credit ratings.
The project is built using Python and Streamlit, offering an interactive and user-friendly dashboard. Web Link
The project develops a machine learning model to predict default risk with high accuracy and interpretability.
It leverages advanced techniques to provide actionable insights, making it suitable for real-world deployment.
- Dataset: Imbalanced classification problem (~10% defaults).
- Techniques:
- Feature engineering using domain relevance and statistical analysis.
- Resampling methods (SMOTE, under-sampling).
- Models Evaluated:
- Logistic Regression
- Random Forest
- XGBoost
- Final Model: XGBoost with Optuna hyperparameter tuning and under-sampling.
- Metrics:
- AUC: 0.98
- Gini Coefficient: 0.97
- KS Statistic: 86.87%
- Interpretability Tools:
- High precision and recall for classifying defaults.
- Decile analysis confirms strong separation of high-risk instances.
- ✅ High performance across metrics
- ✅ Interpretability aligns with business/regulatory needs
- ⚡ Retraining recommended to mitigate under-sampling risks
git clone https://github.com/jainrakshit24/OPTI_Recourse.git
cd OPTI_RecourseMake sure you have Python 3.8+ installed. Use a virtual environment for best practice:
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activatepip install -r requirements.txtstreamlit run main.pyOnce you run the above command:
-
Streamlit starts a local server.
- You will see a link in your terminal (usually
http://localhost:8501/).
- You will see a link in your terminal (usually
-
Open the link in a browser.
- The homepage of the app will appear with input fields and sliders.
-
Enter borrower details such as:
- Age
- Income
- Loan Amount
- Employment Details, etc.
-
Click “Calculate Risk”.
-
The app will process inputs using the trained ML model.
-
Predictions are displayed instantly:
- 📊 Default Probability
- 📈 Credit Score
- 🏦 Credit Rating
-
-
Visual Insights
- The dashboard also shows SHAP & LIME explanations for interpretability.
-
Business Use Case
- Financial institutions can use the model to quickly screen borrowers before loan approval.
Main libraries used:
streamlit→ interactive dashboardscikit-learn→ preprocessing, metricsxgboost→ final modeloptuna→ hyperparameter tuningshap,lime→ model interpretabilitypandas,numpy→ data processingjoblib→ model serialization
(All dependencies listed in requirements.txt)
- Dashboard Home – Input borrower details.
- Results Page – Risk prediction, score & rating.
- Combines state-of-the-art ML techniques with interpretability.
- Addresses a real-world business problem with rigor and precision.
- Clear pipeline: Model development → Evaluation → Deployment.
This project is licensed under the terms of the MIT License.
👤 Developed by Rakshit Jain

