CLASSICAL ML · INTERVIEW QUESTION
Explain bias-variance tradeoff with a concrete example.
🟡 intermediate · Supervised Learning
Hint: Underfitting vs overfitting. Think of polynomial regression with different degrees.
Answer
Total error = Bias² + Variance + Irreducible noise. Bias: error from wrong assumptions (underfitting). A linear model fit to quadratic data has high bias. Variance: error from sensitivity to training data fluctuations (overfitting). A degree-20 polynomial changes dramatically with different training sets.
Example: fitting polynomial regression to noisy quadratic data. Degree 1 (linear): high bias (misses curve), low variance. Degree 2: low bias, low variance (correct model). Degree 20: low bias, high variance (fits noise). The sweet spot minimizes total error. Regularization (L1/L2) trades higher bias for lower variance. Ensemble methods: bagging reduces variance (Random Forest), boosting reduces bias (XGBoost). Cross-validation helps find the optimal complexity.
Related questions
- What is overfitting? How do you detect and prevent it?
- What is cross-validation? Compare k-fold, stratified, and time series CV.
- Explain precision, recall, F1-score, and when to use each.
- What is the ROC curve and AUC? What are their limitations?
- How do you handle class imbalance? Compare different approaches.