Bar grid: X = λ (log-spaced), Z = fold, height = validation MSE
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Cross-Validation Lambda Tuner: Ridge Regression

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: forty-eight noisy points are generated from a fixed nonlinear function, a ridge-regularized polynomial is fit across ten log-spaced candidate values of λ, and each candidate is scored K times by holding out a different fold and measuring error on the data the model never saw during that fit. The result is a live 3D bar grid — one column per λ, one row per fold — where the gold column marks the λ that minimizes mean validation error. Sliders for polynomial degree, noise level and fold count let you watch the optimal column migrate in real time as the bias-variance trade-off shifts underneath it.