README
📌 Project Overview
This project builds a probabilistic credit default prediction model using Logistic Regression with L1 and L2 regularization.
The goal is to predict whether a customer will default within the next two years based on financial and credit history features.
Instead of focusing only on accuracy, this project emphasizes:
- Probabilistic prediction
- ROC-AUC evaluation
- Class imbalance handling
- Regularization effects
- Decision threshold tuning
📊 Dataset
Dataset used: Give Me Some Credit (Kaggle)
Target Variable:
SeriousDlqin2yrs- 1 → Customer defaulted
- 0 → Customer did not default
The dataset is imbalanced (~7% defaults), making accuracy an unreliable metric.
🧠 Key Machine Learning Concepts Applied
- Logistic Regression (Binary Classification)
- Log-Odds Modeling
- L1 Regularization (Feature Selection)
- L2 Regularization (Weight Shrinkage)
- Bias–Variance Tradeoff
- Stratified Train-Test Split
- Feature Scaling (Standardization)
- ROC-AUC Evaluation
- Threshold Tuning
⚙️ Project Workflow
-
Data Cleaning
- Dropped unnecessary index column
- Handled missing values using median imputation
-
Exploratory Analysis
- Examined class imbalance
-
Train-Test Split
- Used stratified sampling to preserve class distribution
-
Feature Scaling
- Applied StandardScaler (important for regularization)
-
Model Training
- Logistic Regression (L2 regularization)
- Logistic Regression (L1 regularization)
-
Evaluation Metrics
- Accuracy
- ROC-AUC
- Precision, Recall, F1-score
- ROC Curve visualization
-
Threshold Tuning
- Compared default threshold (0.5) vs custom threshold (0.3)
-
Feature Importance Analysis
- Interpreted coefficients
- Identified features removed by L1
📈 Results Summary
- ROC-AUC used as primary evaluation metric due to imbalance.
- L1 regularization performed feature selection by shrinking some coefficients to zero.
- Lowering decision threshold improved recall (important in credit risk context).
- L2 provided stable coefficient estimates.
💡 Business Insights
- Logistic regression outputs probability scores, which can be directly used as risk scores.
- Threshold tuning allows businesses to balance between:
- Reducing false negatives (missed defaulters)
- Reducing false positives (rejecting good customers)
- Regularization prevents overfitting and improves generalization.
🚀 Future Improvements
- Hyperparameter tuning (GridSearchCV)
- SMOTE for class imbalance handling
- Comparison with Random Forest / XGBoost
- Deployment as a FastAPI risk scoring API
