Machine Learning - Case Study Solutions
Case Study 1: Loan Default Prediction (Modules II + III)
Problem: Predict whether a customer will default on a loan.
Steps:
1. Problem Understanding: Binary classification; target = Default (1 = Yes, 0 = No).
2. Data Collection: Features include Age, Income, Loan Amount, Credit Score, Tenure, Employment Ye
3. Data Preprocessing:
- Missing values: median (numeric), mode (categorical)
- Encoding: One-Hot / Label Encoding
- Feature Scaling: Standardization/Min-Max Scaling
- Train-Test Split: 80%-20%
- Handle imbalance: SMOTE / class weights
4. Model Building: Logistic Regression, SVM, Random Forest, Naive Bayes
5. Evaluation Metrics: Accuracy, Precision, Recall, F1-Score, ROC-AUC
6. Optimization: k-Fold Cross Validation, Grid Search for hyperparameters
7. Deployment: Save model using pickle/joblib, integrate into loan system
8. Interpretation: Feature importance to identify risk factors
Summary Table:
Step | Task | Technique
1 | Data Collection | Loan dataset
2 | Preprocessing | Encoding, Scaling, Imputation
3 | Model Selection | Logistic, SVM, Random Forest
4 | Evaluation | Accuracy, Precision, Recall, F1, ROC-AUC
5 | Optimization | CV, Grid Search
6 | Deployment | Integration into system
Case Study 2: Ensemble Models (Module IV)
Concept: Combining multiple base models to improve prediction accuracy.
Methods:
1. Bagging:
- Train multiple models on bootstrap samples
- Aggregate predictions (majority vote/average)
- Reduces variance
2. Random Forest:
- Bagging + Random feature selection
- Ensemble of decision trees
- Handles non-linearity and avoids overfitting
3. Boosting:
- Sequential learning; each model corrects previous errors
- Weighted sum of models
- Reduces bias; high accuracy
4. Stacking:
- Base learners (Level-0) generate predictions
- Meta-learner (Level-1) combines outputs for final prediction
Comparison Table:
Method | Training | Combines | Reduces | Example
Bagging | Parallel | Samples | Variance | Random Forest
Boosting | Sequential | Errors | Bias | AdaBoost, XGBoost
Random Forest | Parallel | Trees + Features | Variance | Random Forest
Stacking | Layered | Base model outputs | Both | Stacked Ensemble
Case Study 3: Analytical Question (Module V)
(a) Difference Between K-Means and Hierarchical Clustering:
Feature | K-Means | Hierarchical
Type | Partition | Tree-based (dendrogram)
Need K? | Yes | No
Output | Centroid clusters | Dendrogram
Complexity | O(n) | O(n²)
Suitable | Large datasets | Small to medium datasets
(b) Applications of Unsupervised Learning:
1. Anomaly Detection: Fraud detection, network intrusion detection
2. Recommender Systems: User-item grouping, personalized recommendations
Conclusion:
- Case Study 1 demonstrates a practical supervised learning pipeline.
- Case Study 2 explains ensemble methods to improve model accuracy.
- Case Study 3 highlights clustering methods and applications of unsupervised learning.