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.
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
The dataset contains structured financial and personal attributes of loan applicants.
income_annum— Annual income of applicantloan_amount— Requested loan amountloan_term— Loan durationcibil_score— Credit score (key risk indicator)residential_assets_value,commercial_assets_value,luxury_assets_value,bank_asset_value— Asset detailseducation,self_employed— Applicant profileno_of_dependents— Financial dependency load
loan_status— Loan approval outcome (Approved / Rejected)
-
Standardized column names for consistency
-
Handled missing values using:
- Median (numerical features)
- Mode (categorical features)
-
Encoded categorical variables using label encoding
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
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
- Credit score (CIBIL) is strongly correlated with approval
- Loan-to-income ratio is a critical risk indicator
- Asset ownership increases approval probability
A production-style pipeline was implemented using:
- StandardScaler — Feature scaling
- Logistic Regression — Primary classification model
Feature scaling ensures all variables contribute equally and improves convergence for Logistic Regression.
- Train-test split (80/20)
- Hyperparameter tuning using GridSearchCV
- Cross-validation for model stability
The model was evaluated using:
- Accuracy Score
- Confusion Matrix
- Classification Report
- ROC Curve
- AUC Score
- High classification accuracy
- Strong ROC-AUC score indicating good discrimination
- Minimal misclassification between classes
Feature importance analysis revealed:
- CIBIL Score — Most influential feature
- Loan-to-Income Ratio — Strong predictor of risk
- Total Assets — Moderate contribution
- 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
- False positives (approving risky applicants) carry higher financial cost
- Model should prioritize minimizing high-risk approvals
- Enables automated loan screening systems
- Reduces default risk through early detection
- Improves decision consistency and efficiency
- Dataset size is relatively small
- Real-world data may include noise, fraud, and missing patterns
- Model performance may vary in production environments
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
pip install -r requirements.txtjupyter notebookRun all cells in the notebook sequentially.
credit-risk-prediction/
│
├── credit_risk_analysis.ipynb
├── README.md
└── requirements.txt
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.
Muhammad Shoaib Inksar Data Analyst | Machine Learning Enthusiast