Polynomial Model Complexity & Bootstrap Variance Simulation
Status
Optimal
Squared Bias
0.038
Model Variance
0.045
Irreducible Noise (σ²)
0.123
Expected Test MSE
0.206
INTERVIEW RUBRIC
Standard Interview Question
"Derive and explain the Bias-Variance Tradeoff. How do model complexity and dataset size shift the sweet spot?"
E[(y - f̂(x))²] = Bias[f̂(x)]² + Var[f̂(x)] + σ²
Expected Answer Strategy
- High Bias (Underfitting): Model makes restrictive assumptions (e.g. degree 1 line fitting sine). Cannot capture true underlying pattern. High train & high test error.
- High Variance (Overfitting): Model fits sample noise (high degree polynomials oscillating wildly). Low train error but poor generalization.
- Irreducible Error (σ²): Noise in measurement/target that no model can eliminate.
- Dataset Scaling: Increasing sample size (N) lowers the variance curve, shifting the optimal complexity rightward.
Senior Follow-Up: Mitigations
To reduce variance: Bagging / Ensembling (Random Forests average uncorrelated estimators, dividing variance by ~M), L1/L2 regularization, or collecting more training samples. To reduce bias: Increase capacity, add interaction features, or boost (GBM).
Loss Ellipses & L1 Diamond vs L2 Circle Constraint Ball
Coordinate plane (w₁, w₂)
Unconstrained Optimum (OLS)
(1.80, 1.40)
L1 Regularized w*
(1.15, 0.00)
L2 Regularized w*
(1.08, 0.74)
Sparsity Status
Exact Zero (w₂=0)
GEOMETRIC PROOF
"Why does L1 induce true sparsity while L2 only shrinks weights?"
min_w ||Xw - y||² s.t. ||w||_p ≤ C
Visual & Mathematical Defense
- Diamond Corners (L1): The L1 ball {w : |w₁| + |w₂| ≤ C} has sharp vertices located exactly on coordinate axes where wᵢ = 0.
- First Point of Contact: As loss ellipses expand from the OLS center, they tangentially touch the diamond vertex with very high probability, setting coefficients to strict zero.
- Spherical Smoothness (L2): The L2 ball {w : w₁² + w₂² ≤ C²} has no corners; gradients are continuous everywhere. The tangent point will almost never lie on an axis, shrinking weights smoothly without strict zeros.
- Subgradient View: L1 derivative is sgn(w) × λ (constant push towards 0). L2 derivative is 2λw (push diminishes as w → 0).
Elastic Net Follow-Up
When features are highly correlated (ρ > 0.8), Lasso randomly selects one feature. Elastic Net combines L1 + L2 penalties: L1 produces sparsity while L2 retains grouped feature selection.
Gradient Descent Trajectory on Ravine Loss Surface
Descent Regime
Stable Convergence
Steps Taken
45
Final Loss
0.0018
Condition Number (κ)
10.0
CORE INTERVIEW QUESTION
"How do you troubleshoot a model that is not converging or oscillating?"
w_{t+1} = w_t - η ∇L(w_t) + β v_t
Candidate Defense Framework
- Too Small η: Sluggish convergence, gets trapped in plateau or shallow local minima; excessive training epochs required.
- Too Large η: Oscillates perpendicular to ravine walls or causes exploding gradients (∇L → ∞).
- Ill-Conditioned Curvature: In ravines (λ_max / λ_min >> 1), standard SGD bounces violently across steep walls instead of moving down the gentle ravine floor.
- Remedies: Momentum β damps cross-canyon oscillations while accelerating floor velocity. Adaptive optimizers (Adam, RMSProp) scale learning rates per coordinate by historical second moments.
Classification Threshold & Metric Trade-off Explorer
Class Separability: d' = 1.6
Precision (PPV)
0.82
Recall / TPR
0.78
F1-Score
0.80
False Positive Rate
0.11
ROC-AUC
0.88
METRIC SELECTION
"When do you optimize ROC-AUC vs PR-AUC in production?"
Precision = TP / (TP + FP) | Recall = TP / (TP + FN)
Interview Talking Points
- Severe Class Imbalance: Switch to PR curve. ROC curve uses FPR = FP / (FP + TN). When TN is in millions (e.g. ad click / fraud), FP can balloon by 10,000× without visibly altering FPR, making ROC deceptively optimistic.
- Precision Sensitivity: Precision directly penalizes FP because denominator is (TP + FP). PR curves reveal severe precision collapse in rare-event detection.
- Threshold Tuning: In medical diagnosis (cost of FN is lethal), choose low τ for high Recall. In spam filtering (cost of FP drops important emails), choose high τ for high Precision.