Ridge Regression Studio
A real 4-feature synthetic dataset — two features deliberately correlated — and a real, from-scratch closed-form ridge solve (a hand-written Gauss-Jordan matrix inverse, no linear-algebra library) recomputed live as you drag . Makes Ridge Regression, In Full Depth's central claim — multicollinearity makes OLS coefficients unstable, ridge fixes it at a small MSE cost — something you watch happen, not just read.
Interactive
Ridge Regression Studio
x1 = 2.20x2 = 3.80x3 = 0.05x4 = 1.65
MSE 1.522x1 + x2 = 6.01 (true combined effect ≈ 6.0)
Drag λ to 0 (plain OLS) and push Correlation up -- watch x1 and x2 swing individually while their sum barely moves. Now increase λ and watch them settle toward each other, with MSE barely changing.
A real 4-feature synthetic dataset (x1 and x2 deliberately correlated) and a real, from-scratch closed-form ridge solve -- w(lambda) = (X^TX + lambda*P)^-1 X^Ty -- recomputed live as you move lambda.
What to Try
- Set λ = 0 (plain OLS) and push Correlation up toward 0.98. Watch
x1andx2swing apart individually — one shooting up, the other down — whilex1 + x2in the readout barely moves. That's multicollinearity: the model can't tell which of two nearly-identical features deserves the credit, so it arbitrarily splits it unstably. - Now drag λ up from 0. Watch
x1andx2converge toward each other instead of splitting — ridge treats correlated features symmetrically, pulling them toward sharing the credit evenly — whilex3(genuinely irrelevant, true weight 0) shrinks toward zero fastest of all. - Watch the MSE readout while you do this: it barely moves. That's the whole trade — a large reduction in coefficient instability for a tiny cost in fit quality, exactly the bias-variance tradeoff the page describes.
- Set Correlation back to 0 and compare: with independent features, OLS is already stable, and increasing λ has nothing to fix — regularization is a solution to a specific problem, not a free improvement to apply blindly everywhere.
Back to Visual Lab Overview.