This project prepares the Kaggle Loan Prediction Dataset for machine learning. The goal is to predict whether a loan application is approved (Loan_Status).
## AnalystLab Africa – Week 2: Loan Prediction Feature Engineering
## Project Overview
This project prepares the Kaggle Loan Prediction Dataset for machine learning. The goal is to predict whether a loan application is approved (Loan_Status).
Target: Loan_Status
Approved: 422 (68.7%)
Rejected: 192 (31.3%)
## Feature Engineering
TotalIncome = ApplicantIncome + CoapplicantIncome
LoanToIncome = LoanAmount / TotalIncome
Loan_ID removed because it is an identifier.
## Missing Values
Categorical fields were imputed with the mode. Numerical fields were imputed with the median because the dataset contains extreme income and loan observations.
## Encoding
Loan_Status: binary label encoding, N=0 and Y=1.
Dependents: ordinal encoding from 0 to 3.
Nominal categorical variables: one-hot encoding with drop_first=True.
## Scaling
RobustScaler was used on continuous numerical features because it uses the median and IQR and is less sensitive to extreme observations.
## Outliers
The IQR method was used. Monetary and ratio features were capped at IQR bounds rather than deleting records. Binary Credit_History and discrete Loan_Amount_Term were not treated as ordinary continuous outliers.
## Feature Selection
Correlation analysis was used to identify redundancy. Random Forest feature importance was used as an exploratory model-based ranking. The strongest features included:
- Credit_History
- LoanToIncome
- TotalIncome
- ApplicantIncome
- LoanAmount
## Key Finding
Credit history is the strongest individual feature in the Random Forest importance analysis, while income and loan-affordability measures are also prominent. The dataset contains no duplicate records and all missing values were resolved.
## Technologies
Python, Pandas, NumPy, Matplotlib, Seaborn, Scikit-learn, Jupyter Notebook.