Skip to content

mr-piyushkr/Smart-Loan-Risk-Predictor

Repository files navigation

🏦 Smart Loan Risk Predictor (ML + Streamlit)

Python Machine Learning XGBoost Streamlit Status


πŸ“Œ Project Overview

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


🎯 Problem Statement

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

🧠 Machine Learning Approach

βœ” Models Used

  • XGBoost Classifier
  • Bagging Ensemble Technique
  • Feature importance–based selection
  • Class imbalance handling using sample weighting

βœ” Evaluation Metrics

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • ROC-AUC (for probability calibration)

πŸ“Š Dataset Description

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 target
  • test.csv β†’ Test data (no target)
  • prediction_submission.csv β†’ Final predictions

πŸ–₯️ Streamlit Web Application

πŸ”₯ Key Features

  • Modern fintech-style UI
  • Interactive sliders & dropdowns
  • Real-time default probability prediction
  • Feature importance visualization
  • Risk-level interpretation (Low / Medium / High)

🎨 UI Highlights

  • Glassmorphism cards
  • Gradient theme
  • Interactive Plotly charts
  • Sidebar navigation

πŸ› οΈ Tech Stack & Tools

πŸ‘¨β€πŸ’» Programming & ML

Python NumPy Pandas Scikit Learn XGBoost

πŸ“Š Visualization & App

Matplotlib Seaborn Plotly Streamlit


πŸ“ Project Structure

Smart-Loan-Risk-Predictor/
β”‚
β”œβ”€β”€ SmartLoanRiskPredictor.ipynb
β”œβ”€β”€ app.py
β”œβ”€β”€ train.csv
β”œβ”€β”€ test.csv
β”œβ”€β”€ prediction_submission.csv
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ .gitignore
└── venv/

πŸš€ How to Run the Project

1️⃣ Clone the Repository

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)

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Piyush Kumar
πŸš€ Data Science & Machine Learning Developer

πŸ“¬ Let's Connect

🌐 Portfolio Β β€’Β  πŸ’» GitHub Β β€’Β  πŸ’Ό LinkedIn Β β€’Β  πŸ“§ Email

About

🏦 Smart Loan Risk Predictor – An end-to-end ML & Streamlit dashboard that predicts loan default probability with a modern fintech-style UI and explainable insights πŸš€πŸ“Š

Topics

Resources

License

Stars

Watchers

Forks

Contributors