Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Credit Risk Intelligence Engine

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.


๐Ÿ“– Table of Contents

  • 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

๐Ÿ” Overview

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.


โ— Problem Statement

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

๐Ÿš€ Key Features

Machine Learning Features

  • 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

Application Features

  • Interactive Streamlit dashboard
  • Real-time predictions
  • Risk probability visualization
  • Loan approval recommendation
  • User-friendly interface
  • Instant inference
  • Stores New data for future training

Engineering Features

  • Scikit-Learn Pipeline architecture
  • Model serialization using Joblib
  • Modular code structure
  • Reproducible training workflow
  • Data leakage prevention

๐Ÿ— Technical Architecture

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

โš™ Machine Learning Workflow

1. Data Collection

The system accepts structured applicant financial data.

Example attributes:

  • Age
  • Annual Income
  • Employment Status
  • Credit History
  • Existing Debt
  • Loan Amount
  • Loan Duration

2. Data Preprocessing

Performed automatically using Scikit-Learn pipelines.

Includes:

  • Missing value treatment
  • Outlier handling
  • Feature scaling
  • Data transformation
  • Encoding categorical variables

3. Feature Engineering

Custom features include:

Debt-to-Income Ratio (DTI)

DTI = Total Debt / Annual Income

Loan Burden Ratio

Loan Burden = Loan Amount / Annual Income

These indicators significantly improve predictive performance.


4. Model Training

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.


5. Evaluation

Performance metrics include:

ROC-AUC

Measures ranking quality of predictions.

F1 Score

Balances:

  • Precision
  • Recall

Useful for imbalanced classification problems.

Confusion Matrix

Evaluates:

  • True Positives
  • True Negatives
  • False Positives
  • False Negatives

๐Ÿ“‚ Project Structure

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

๐Ÿ“Š Dataset Requirements

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

๐Ÿ’ป Setup & Installation

Clone Repository

git clone https://github.com/MonishwarCf/Credit_Risk_Model/tree/main

cd Credit_Risk_Intelligence_Engine

Create Virtual Environment

python -m venv venv

Windows

venv\Scripts\activate

Linux / Mac

source venv/bin/activate

Install Dependencies

pip install -r requirements.txt

Verify Installation

python --version
pip list

โ–ถ Usage Guide

Train the Model

python main.py

This will:

  • Load dataset
  • Perform preprocessing
  • Train multiple models
  • Evaluate performance
  • Save best model

Output:

models/best_model.joblib

Launch Web Application

streamlit run app.py

Open:

http://localhost:8501

๐Ÿ“ˆ Model Performance

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.


๐Ÿ–ผ Screenshots

Dashboard

Add Screenshot Here

Example:

screenshots/dashboard.png

Prediction Results

Add Screenshot Here

Example:

screenshots/prediction.png

๐Ÿ”ฎ Future Improvements

  • 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

๐Ÿงฐ Tech Stack

Programming Language

  • Python

Machine Learning

  • Scikit-Learn
  • XGBoost

Data Processing

  • Pandas
  • NumPy

Visualization

  • Matplotlib
  • Seaborn

Web Application

  • Streamlit

Model Persistence

  • Joblib

๐Ÿ“‹ Requirements

pandas
numpy
scikit-learn
xgboost
streamlit
matplotlib
seaborn
joblib

Install all dependencies:

pip install -r requirements.txt

๐Ÿ“œ License

This 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages