Skip to content

ankityadav-problemsolver/Personal_Loan_Default_Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ Personal Loan Default Prediction - Streamlit Application

Live Demo: Click here to try the app ๐Ÿš€


Animated Header


๐Ÿงน Problem Statement

Financial institutions face increasing challenges in accurately identifying applicants who might default on personal loans. Misclassification can lead to bad debts, regulatory issues, and loss of trust. A reliable prediction system can help mitigate risk, enhance operational efficiency, and drive smarter lending decisions.


๐ŸŽฏ Goal of the Project

  • โœ… Predict the probability of loan default based on customer attributes
  • โœ… Provide a production-ready, interactive Streamlit app for banks and analysts
  • โœ… Explain predictions with SHAP visualizations
  • โœ… Export reports to share insights with decision-makers

๐Ÿ› ๏ธ Flow Diagram

graph TD
    A[User Inputs Loan Details via Form] --> B[Data Preprocessing]
    B[Data Preprocessing] -->C[ML model]
    C[ML model] -->E[Predict] 
    E[Predict] --> F[Recommendation]
Loading

๐Ÿ“‚ Folder Structure

Folder Structure


๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend Streamlit
Backend Python
ML Models Logistic Regression, Random Forest, XGBoost
Visualization Plotly, Matplotlib, SHAP
Export Tools PDFKit, Streamlit Export

๐Ÿง  Code Walkthrough

# Load the model
model = pickle.load(open("model/model.pkl", "rb"))

# Preprocess user inputs
def preprocess(data):
    ...
    return processed_input

# Make prediction
prediction = model.predict(processed_input)

# Show results
st.success(f"Prediction: {'Approved' if prediction==0 else 'Rejected'}")

Automate EDA REPORT


๐Ÿžผ Application UI & Screenshots

๐Ÿ”˜ Home Page

Home Page

๐Ÿ”ข Prediction Form

Prediction Result

๐Ÿ”ข Prediction Result

Prediction Result

๐Ÿ“‰ ROC AUC Curve

ROC AUC CURVE

๐ŸŽŸ๏ธ Precision_Recall Curve

Precision_Recall_Curve

๐ŸŽŸ๏ธ Loan KPI

KPI

๐ŸŽŸ๏ธ 3D SCATTER

KPI


โœจ Key Features

  • ๐Ÿ”น User-friendly UI built in Streamlit
  • ๐Ÿ”น Real-time loan eligibility prediction
  • ๐Ÿ”น Support for multiple ML models
  • ๐Ÿ”น SHAP visualizations for explainability
  • ๐Ÿ”น Exportable PDF reports
  • ๐Ÿ”น Clean, minimal, responsive design

๐Ÿ”ฎ Scientific Innovation

What makes this project stand out:

  • ๐Ÿง  Explainable AI (XAI): Integrates SHAP values to explain each prediction
  • ๐Ÿงฌ Bias Check Module: Identify model fairness issues across genders/ages
  • โœจ Risk Interpretation Layer: Converts numeric predictions into easy-to-understand advice
  • ๐Ÿš€ Model Comparator: Visual comparison between Logistic, Random Forest & XGBoost

๐Ÿš€ Future Enhancements

  • ๐Ÿš€ Aadhaar/PAN Verification via Gemini API
  • ๐ŸŽฎ Voice-based AI Assistant for customer service
  • ๐Ÿค– Chatbot integration for insights
  • ๐Ÿ“Š Historical dashboard for tracking applicant trends
  • ๐Ÿ‘จโ€๐Ÿ“ˆ Credit score simulator based on customer profile edits

๐Ÿšง How to Run Locally

# Step 1: Clone the repo
git clone https://github.com/yourusername/personal-loan-prediction.git
cd personal-loan-prediction

# Step 2: Install dependencies
pip install -r requirements.txt

# Step 3: Run the application
streamlit run app.py

๐Ÿงณ Collaboration & Contribution

We'd love your help! You can:

  • โœจ Improve UI/UX
  • ๐Ÿง  Optimize the model pipeline
  • ๐Ÿ“‰ Add new data sources or APIs
  • ๐Ÿค Translate into local languages

How to Contribute

# Fork the repository
# Create your feature branch
git checkout -b feature/new-awesome-feature

# Commit and push your changes
git commit -m "Added awesome feature"
git push origin feature/new-awesome-feature

# Submit a Pull Request

๐Ÿ“ข Contact Me

Platform Link
๐Ÿ’ผ LinkedIn Ankit Yadav
๐Ÿ’ป GitHub Ankit Yadav
๐Ÿ“ง Email ankitofficial151@gmail.com

๐Ÿ“„ License

This project is licensed under the MIT License. Feel free to fork, adapt, and build upon it for your use case!


๐Ÿ’Ž Pro Tip

Use this architecture as a blueprint for any classification-based real-time prediction system with SHAP explainability, PDF reporting, and clean UI design.


๐Ÿ”น Tags

#LoanPrediction #StreamlitApp #ExplainableAI #SHAP #FinanceAI #BankingML #CreditScoring


About

๐Ÿš€ Personal Loan Default Prediction App helps banks and financial institutions assess the risk of loan default using machine learning. ๐Ÿ” Users can input applicant details, and the app provides real-time predictions with explainable insights.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors