Skip to content

Animesh2473/Credit-Risk-Modeling

Repository files navigation


Loan Risk Analyzer 🚦

An interactive web application for Credit Risk Bias & Fairness Detection, allowing users to analyze, predict, and mitigate bias in credit risk modeling with powerful visualizations and explainability.

🔗 Live App: https://loan-risk-analyzer.streamlit.app/


✨ Features

  • Upload Dataset: Instantly visualize predictions, group risk rates, and fairness metrics from your CSV.
  • Manual Entry & Scoring: Enter applicant details in a form and receive an instant risk score using a real ML model.
  • Bias & Fairness Analysis: See group-wise bias before and after mitigation using Demographic Parity and Equalized Odds.
  • Interactive Visualizations: Enjoy dynamic Plotly charts, ROC curves, and classified performance tables.
  • Explainability Ready: (Optional) Integrate SHAP for model transparency (local/global impact explanations).
  • Clean Portfolio Design: Responsive, intuitive UI, perfect for demonstrations or practical decision science.

🛠️ Technology Stack

  • Streamlit: Modern Python app framework for data apps.
  • scikit-learn: Model development; includes logistic regression, scaling, and metrics.
  • Fairlearn: Open-source library for measuring and mitigating bias in ML.
  • Plotly: Interactive and publication-ready charts.
  • Pandas & NumPy: Data manipulation and computation.
  • Pickle: For saving and loading trained pipelines and scalers.
  • SHAP and/or LIME: For explainable AI if desired.

📦 Recommended Folder Structure

loan-risk-analyzer/
├── app.py                      # Main Streamlit app
├── README.md                   # Project documentation
├── requirements.txt            # List of all dependencies
├── scaler.pkl                  # Trained scaler (used for live/manual prediction)
├── best_logistic_model.pkl     # Trained model (loan default risk classifier)
├── data/
│   ├── demo_data.csv           # Demo/test or example input data
├── notebooks/
│   ├── credit_risk_training.ipynb  # Model training and bias analysis notebook
├── utils/
│   ├── model_utils.py              # (Optional) Helper functions for loading/preprocessing/prediction
├── assets/
│   ├── logo.png                # (Optional) Project or sponsor logo
│   └── custom.css              # (Optional) Streamlit theme overrides
└── .streamlit/
    └── config.toml             # (Optional) Streamlit UI/settings config

🏆 Project Workflow

Data Preparation: Load, clean, explore CSVs (Data/)

Feature Engineering: Transform, scale, encode data (see notebook/)

Model Training: Train fair and baseline models, export best to model/

Bias Detection: Audit group fairness using Fairlearn

Mitigation: Apply and compare bias mitigation strategies

Deployment: Streamlit app loads model/scaler, visualizes everything

Manual & Bulk Scoring: Score new applicants and full datasets interactively

🚀 How to Use

1. Open the App

Visit Project Link in your browser.

1 2 3 4 5 6 7 8

📫 Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors