← All STAT 413 applets

Gradient Descent for Linear Regression

Watch gradient descent fit a line by minimizing squared error on a real, standardized dataset (the same data as the Simple Linear Regression applet). Then see how the Ridge, Lasso, and Elastic-Net penalties modify the update: Ridge adds a term to the gradient, while Lasso and Elastic Net add a soft-threshold step that can drive the slope to exactly zero. The intercept is never penalized. The green star marks the least-squares optimum; the black tick on each bar marks its OLS value.

Data & current fit

Loss surface & descent path

Coefficients (bar = current, tick = OLS)

Penalty
Hyperparameters
0.080
1.00
0.50
Run