An end-to-end Machine Learning system designed to automate credit risk assessment for financial institutions. The project combines advanced data preprocessing, feature engineering, ensemble learning, and an interactive Streamlit dashboard to provide accurate and explainable loan approval recommendations.
- Overview
- Problem Statement
- Key Features
- Technical Architecture
- Machine Learning Workflow
- Project Structure
- Dataset Requirements
- Setup & Installation
- Usage Guide
- Model Performance
- Screenshots
- Future Improvements
- Tech Stack
- Author
- License
Traditional loan approval processes often rely on manual evaluation and fixed business rules, which can be inefficient and prone to inconsistency.
The Credit Risk Intelligence Engine addresses this challenge by leveraging machine learning to:
- Analyze applicant financial data
- Generate risk-related features
- Predict probability of loan default
- Classify applicants into risk categories
- Assist lending officers in making informed decisions
The system is built using a production-style ML pipeline that ensures consistency between training and inference.
Banks and financial institutions face significant losses due to loan defaults.
The objective of this project is to build a predictive system capable of:
- Identifying high-risk applicants
- Reducing default rates
- Improving lending decisions
- Maintaining fairness and consistency
- Automating risk assessment workflows
- Automated data preprocessing
- Missing value handling
- Feature scaling
- Feature engineering
- Class imbalance management
- Model comparison framework
- Probability-based risk scoring
- Ensemble learning with XGBoost and Random Forest
- Interactive Streamlit dashboard
- Real-time predictions
- Risk probability visualization
- Loan approval recommendation
- User-friendly interface
- Instant inference
- Stores New data for future training
- Scikit-Learn Pipeline architecture
- Model serialization using Joblib
- Modular code structure
- Reproducible training workflow
- Data leakage prevention
Raw Dataset
โ
โผ
Data Cleaning
โ
โผ
Feature Engineering
โ
โผ
Preprocessing Pipeline
โ
โผ
Model Training
(Logistic Regression,
Decision Tree,
Random Forest,
XGBoost)
โ
โผ
Model Evaluation
โ
โผ
Best Model Selection
โ
โผ
Model Persistence (.joblib)
โ
โผ
Streamlit Application
โ
โผ
Real-Time Risk Prediction
The system accepts structured applicant financial data.
Example attributes:
- Age
- Annual Income
- Employment Status
- Credit History
- Existing Debt
- Loan Amount
- Loan Duration
Performed automatically using Scikit-Learn pipelines.
Includes:
- Missing value treatment
- Outlier handling
- Feature scaling
- Data transformation
- Encoding categorical variables
Custom features include:
DTI = Total Debt / Annual Income
Loan Burden = Loan Amount / Annual Income
These indicators significantly improve predictive performance.
The system compares multiple algorithms:
| Model | Purpose |
|---|---|
| Logistic Regression | Baseline Linear Model |
| Decision Tree | Rule-Based Learning |
| Random Forest | Ensemble Learning |
| XGBoost | Gradient Boosting |
The best-performing model is automatically selected.
Performance metrics include:
Measures ranking quality of predictions.
Balances:
- Precision
- Recall
Useful for imbalanced classification problems.
Evaluates:
- True Positives
- True Negatives
- False Positives
- False Negatives
Credit_Risk_Intelligence_Engine/
โ
โโโ models/
โ โโโ best_model.joblib
โ
โโโ outputs/
โ โโโ class_distribution.png
โ โโโ correlation_heatmap.png
โ โโโ model_comparison.png
โ
โโโ dataset.csv
โโโ main.py
โโโ app.py
โโโ requirements.txt
โโโ README.md
โ
โโโ notebooks/
โโโ experimentation.ipynb
The dataset should contain:
| Feature | Description |
|---|---|
| Income | Applicant income |
| Debt | Existing liabilities |
| Credit Score | Creditworthiness |
| Employment Status | Employment category |
| Loan Amount | Requested loan |
| Default | Target Variable |
Target Column:
Default
0 = Low Risk
1 = High Risk
git clone https://github.com/MonishwarCf/Credit_Risk_Model/tree/main
cd Credit_Risk_Intelligence_Enginepython -m venv venvvenv\Scripts\activatesource venv/bin/activatepip install -r requirements.txtpython --version
pip listpython main.pyThis will:
- Load dataset
- Perform preprocessing
- Train multiple models
- Evaluate performance
- Save best model
Output:
models/best_model.joblib
streamlit run app.pyOpen:
http://localhost:8501
Example Results:
| Metric | Score |
|---|---|
| Accuracy | 92.4% |
| ROC-AUC | 0.95 |
| Precision | 0.90 |
| Recall | 0.88 |
| F1 Score | 0.89 |
Actual performance may vary depending on dataset quality and class distribution.
Add Screenshot Here
Example:
screenshots/dashboard.png
Add Screenshot Here
Example:
screenshots/prediction.png
- SHAP Explainability Integration
- Model Monitoring Dashboard
- Loan Portfolio Analytics
- Cloud Deployment
- REST API Development
- Automated Retraining Pipeline
- Docker Containerization
- CI/CD Integration
- Multi-model Ensemble Voting
- Python
- Scikit-Learn
- XGBoost
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Streamlit
- Joblib
pandas
numpy
scikit-learn
xgboost
streamlit
matplotlib
seaborn
joblib
Install all dependencies:
pip install -r requirements.txtThis project is licensed under the MIT License.
Feel free to use, modify, and distribute this project for educational and research purposes.
โญ If you found this project useful, consider giving the repository a star.