Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Credit Risk Prediction Analysis

Project Overview

This project implements a production-style machine learning pipeline to predict loan approval decisions based on applicant financial and demographic data.

The goal is to simulate a real-world credit risk assessment system, enabling financial institutions to identify high-risk applicants and minimize potential losses.


Business Problem

Loan approval decisions carry significant financial risk. Approving high-risk applicants can lead to defaults, while rejecting reliable applicants can reduce business opportunities.

This project aims to:

  • Predict loan approval outcomes
  • Identify key risk factors
  • Support data-driven decision-making

Dataset Description

The dataset contains structured financial and personal attributes of loan applicants.

Features:

  • income_annum — Annual income of applicant
  • loan_amount — Requested loan amount
  • loan_term — Loan duration
  • cibil_score — Credit score (key risk indicator)
  • residential_assets_value, commercial_assets_value, luxury_assets_value, bank_asset_value — Asset details
  • education, self_employed — Applicant profile
  • no_of_dependents — Financial dependency load

Target Variable:

  • loan_status — Loan approval outcome (Approved / Rejected)

Data Preprocessing

  • Standardized column names for consistency

  • Handled missing values using:

    • Median (numerical features)
    • Mode (categorical features)
  • Encoded categorical variables using label encoding


Feature Engineering

New features were created to improve model performance:

  • Loan-to-Income Ratio

    • Measures repayment burden
    • Higher values indicate higher financial risk
  • Total Assets

    • Aggregates all asset types
    • Represents overall financial strength

Exploratory Data Analysis (EDA)

The following analyses were conducted:

  • Distribution of loan amounts and income
  • Relationship between income and loan size
  • Impact of credit score on approval
  • Correlation analysis between features

Key Observations:

  • Credit score (CIBIL) is strongly correlated with approval
  • Loan-to-income ratio is a critical risk indicator
  • Asset ownership increases approval probability

Machine Learning Pipeline

A production-style pipeline was implemented using:

  • StandardScaler — Feature scaling
  • Logistic Regression — Primary classification model

Why Scaling?

Feature scaling ensures all variables contribute equally and improves convergence for Logistic Regression.


Model Training & Optimization

  • Train-test split (80/20)
  • Hyperparameter tuning using GridSearchCV
  • Cross-validation for model stability

Model Evaluation

The model was evaluated using:

  • Accuracy Score
  • Confusion Matrix
  • Classification Report
  • ROC Curve
  • AUC Score

Results:

  • High classification accuracy
  • Strong ROC-AUC score indicating good discrimination
  • Minimal misclassification between classes

Feature Importance

Feature importance analysis revealed:

  • CIBIL Score — Most influential feature
  • Loan-to-Income Ratio — Strong predictor of risk
  • Total Assets — Moderate contribution

Key Insights

  • Credit score is the primary determinant of loan approval
  • Loan-to-income ratio effectively captures financial stress
  • Asset ownership improves approval likelihood
  • Income alone is not a sufficient predictor

Risk Analysis

  • False positives (approving risky applicants) carry higher financial cost
  • Model should prioritize minimizing high-risk approvals

Business Implications

  • Enables automated loan screening systems
  • Reduces default risk through early detection
  • Improves decision consistency and efficiency

Limitations

  • Dataset size is relatively small
  • Real-world data may include noise, fraud, and missing patterns
  • Model performance may vary in production environments

Technologies Used

  • Python
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn

How to Run

pip install -r requirements.txt
jupyter notebook

Run all cells in the notebook sequentially.


Project Structure

credit-risk-prediction/
│
├── credit_risk_analysis.ipynb
├── README.md
└── requirements.txt

Screenshots

image image

Conclusion

This project demonstrates a complete machine learning workflow, from data preprocessing to model evaluation, with strong emphasis on risk analysis and business impact.

The results confirm that credit score and financial ratios are critical drivers of loan approval decisions, making them essential features for real-world credit risk systems.


👤 Author

Muhammad Shoaib Inksar Data Analyst | Machine Learning Enthusiast

About

This project implements a production-style machine learning pipeline to predict loan approval decisions based on applicant financial and demographic data. The goal is to simulate a real-world credit risk assessment system, enabling financial institutions to identify high-risk applicants and minimize potential losses.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages