Bias–Variance Tradeoff using Polynomial Regression on Housing Dataset
Experiment
Bias–Variance Tradeoff using Polynomial Regression on Housing Dataset
🎯 Aim
To study the bias–variance tradeoff by implementing polynomial regression with varying degrees and analyzing training and validation errors.
Objectives
- Load and preprocess housing dataset
- Apply polynomial regression with different degrees
- Compute training and validation errors
- Plot error curves
- Analyze bias–variance tradeoff
🛠️ Tools Required
- Python
- NumPy
- Pandas
- Matplotlib
- Scikit-learn
📖 Theory
🔹 Bias–Variance Tradeoff
- Bias → Error due to overly simple model
- Variance → Error due to overly complex model
🔹 Behavior
| Model Complexity | Bias | Variance |
|---|---|---|
| Low (degree 1) | High | Low |
| Medium | Balanced | Balanced |
| High (degree 10+) | Low | High |
🔹 Key Insight
- Increasing degree → decreases bias
- But increases variance
- Optimal model minimizes both
📋 Procedure
- Load dataset
- Select one feature (e.g., RM: average rooms)
- Split into train and validation sets
- Apply polynomial regression for different degrees
- Compute training and validation MSE
- Plot error curves
- Analyze results
💻 Program
📊 Output
📈 Interpretation
🔹 Low Degree (Underfitting)
- High training error
- High validation error
- Model too simple → high bias
🔹 Optimal Degree
- Training error ↓
- Validation error minimum
- Best generalization
🔹 High Degree (Overfitting)
- Training error very low
- Validation error increases
- Model too complex → high variance
Result
The bias–variance tradeoff was successfully demonstrated using polynomial regression. The optimal degree corresponds to the minimum validation error.
- Increasing complexity reduces bias but increases variance
- Best model lies at minimum validation error
- Overfitting occurs at higher polynomial degrees

Comments
Post a Comment