Cross-Validation Lambda Tuner: Ridge Regression (2D)
Interactive 2D ridge-regression simulator: drag the regularization strength (lambda) and watch the fitted curve and a real, recomputed k-fold cross-validation error curve respond live, revealing the bias-variance trade-off.
Choosing a regularization strength by eyeballing the training fit is a trap — training error only ever improves as a model gets more flexible. This simulator makes k-fold cross-validation visible in plain 2D: forty-eight noisy points are generated from a fixed nonlinear function, a ridge-regularized polynomial is fit at whatever λ you drag the slider to, and a second panel recomputes the true cross-validation error curve by genuinely splitting the data into K folds, refitting on K−1 of them and scoring on the one held out, at 60 log-spaced candidate λ values. The gold dot marks the λ that minimizes mean validation error — drag your own slider toward it, or away from it, and watch the fitted curve swing between underfitting (too stiff) and overfitting (chasing noise).
Adjust Ridge Regression's lambda to balance bias and variance using k-fold cross-validation. Observe how changes affect the model fit visually.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install