Weight decay, commonly implemented as L2 regularization, adds a penalty for large parameter magnitudes to the learning objective. Training therefore balances fitting the data against keeping the model simpler: increasing α strengthens shrinkage, while excessive regularization can underfit. section 7.1.1 section 6.2.2
The practical effect is easiest to see by contrasting related regression methods:
- Ridge regression minimizes squared error plus the sum of squared weights, shrinking coefficients toward zero without generally making them exactly zero. section 7.1.1
- LASSO uses an L1 penalty instead, encouraging sparse models and implicit feature selection. section 7.1.1
- Elastic net combines L1 and L2 penalties to balance sparsity with robustness to correlated features. section 7.1.1
- In tree ensembles, regularized objectives can combine L2 regularization with a penalty on the number of leaf nodes. section 6.6
Correlated regression features
A synthetic regression dataset contains two highly correlated features, with the second approximately three times the first. Ordinary least squares learns coefficients of about [-1.46, -0.32], whereas ridge with α = 0.5 learns about [-0.34, -0.70]. The ridge model slightly improves test MSE while redistributing and shrinking the coefficients. section 7.1.1
Figure 7.1 Data for a synthetic regression problem to which we fit several linear regression models, generated by the univariate (1D), noisy function f(x) = -2.5x + 3.2 shown by the line overlaid on the data points.
Inspect the noisy synthetic regression data used to compare unregularized and regularized linear models. section 7.1.1








