This project predicts whether a loan application will be approved or rejected based on applicant information and financial data. The goal is to build a binary classification model that accurately predicts loan approval while handling imbalanced data.
- Source: Kaggle – Loan Approval Prediction Dataset
- Number of Entries: 4269
- Features (13 columns):
- Python 3.x
- Pandas – Data manipulation
- NumPy – Numerical computations
- Scikit-learn – Modeling and evaluation
- Imbalanced-learn – Handling imbalanced data (SMOTE)
- Seaborn & Matplotlib – Data visualization
- Downloaded dataset from Kaggle.
- Loaded CSV into a Pandas DataFrame.
- Checked dataset shape, column types, and summary statistics.
- Analyzed target variable distribution to identify imbalance.
- Visualized categorical features vs loan status.
- Created correlation heatmap for numeric features.
- Confirmed there were no missing values in this dataset.
- Dropped loan_id (identifier).
- Encoded categorical features using one-hot encoding: education, self_employed.
- Converted target variable loan_status to binary (1 = Approved, 0 = Rejected).
- Scaled numeric features using StandardScaler:
- Split dataset into 80% training and 20% testing.
- Stratified split to maintain class distribution:
Checked class distribution: Approved vs Rejected. Applied SMOTE to oversample minority class:
- Trained three models on the resampled dataset:
- Logistic Regression
- Decision Tree Classifier
- Random Forest Classifier
- Evaluated models on test set using:
- Accuracy
- Precision
- Recall
- F1-score (main metric due to imbalance)
- Confusion matrix visualization
- Saved scaler and trained models using joblib for future use: