This project is a production-ready Smart Loan Risk Predicton system designed to help financial institutions assess credit risk and predict the probability of loan risk using machine learning.
The solution combines advanced ML models with a high-end Streamlit dashboard, delivering an experience similar to real-world fintech products used by banks and NBFCs.
π GitHub Repo: Link
π Live Demo: Link
Loan defaults pose significant financial risks for lending institutions.
The goal of this project is to predict the likelihood of a borrower defaulting on a loan using demographic, financial, and loan-specific attributes.
π This enables:
- Better credit decisions
- Early risk identification
- Data-driven lending strategies
- XGBoost Classifier
- Bagging Ensemble Technique
- Feature importanceβbased selection
- Class imbalance handling using sample weighting
- Accuracy
- Precision
- Recall
- F1-Score
- ROC-AUC (for probability calibration)
The dataset contains borrower-level information with the following features:
| Category | Examples |
|---|---|
| Demographics | Age, Education, MaritalStatus |
| Financial | Income, CreditScore, DTIRatio |
| Loan Details | LoanAmount, LoanTerm, InterestRate |
| Employment | EmploymentType, MonthsEmployed |
| Target | Default (0 = No, 1 = Yes) |
π Files:
train.csvβ Training data with targettest.csvβ Test data (no target)prediction_submission.csvβ Final predictions
- Modern fintech-style UI
- Interactive sliders & dropdowns
- Real-time default probability prediction
- Feature importance visualization
- Risk-level interpretation (Low / Medium / High)
- Glassmorphism cards
- Gradient theme
- Interactive Plotly charts
- Sidebar navigation
Smart-Loan-Risk-Predictor/
β
βββ SmartLoanRiskPredictor.ipynb
βββ app.py
βββ train.csv
βββ test.csv
βββ prediction_submission.csv
βββ requirements.txt
βββ README.md
βββ .gitignore
βββ venv/
git clone https://github.com/mr-piyushkr/Smart-Loan-Risk-Predictor.git
cd Smart-Loan-Risk-Predictor
2οΈβ£ Create & Activate Virtual Environment
python -m venv venv
venv\Scripts\activate # Windows
3οΈβ£ Install Dependencies
pip install -r requirements.txt
4οΈβ£ Run Streamlit App
streamlit run app.py
π§ͺ Model Output
- Predicted Probability of default (0β1)
- Risk category: π’ Low Risk π‘ Medium Risk π΄ High Risk
π Key Learnings
- End-to-end ML pipeline design
- Handling class imbalance effectively
- Feature engineering & selection
- Ensemble learning with XGBoost
- Deploying ML models using Streamlit
- Designing professional ML dashboards
π Future Improvements
- Model monitoring & logging
- API integration (FastAPI)
- Database support
- Cloud deployment (AWS / GCP)
This project is licensed under the MIT License.
Piyush Kumar
π Data Science & Machine Learning Developer
π Portfolio Β β’Β π» GitHub Β β’Β πΌ LinkedIn Β β’Β π§ Email