liveBook · Manning

L2 norm

As explained in Grokking Machine Learning

The L2 norm of a vector is the square root of the sum of the squared values of its components.

The L2 norm measures a vector’s size by taking the square root of the sum of its squared components. In model regularization, the sum of squared coefficients is used as a measure of model complexity; the model’s bias is left out. section 4.5 section 4.7

Adding this complexity measure to regression error discourages overly complex models. L2 regularization, also called ridge regression, gradually shrinks coefficient values but does not drive them to zero. section 4.5 section 4.7

Ridge regression error = Regression error + L2 norm

Ridge regression combines regression error with the L2 complexity measure. section 4.5

From recommendation models to polynomial regression

A movie recommendation model can be assessed by the sizes of its coefficients, with the bias excluded. An exercise applies the L2 measure to a polynomial regression model and compares its ridge error with lasso error. section 4.5 section 4.8

How Grokking Machine Learning covers it

How deep it goes
Defines the complexity measure, explains coefficient shrinkage, and excludes model bias from the calculation.
Examples
Uses movie recommendation coefficients and a polynomial regression exercise to illustrate complexity and ridge error.
What you can do after
Apply L2 regularization by adding a coefficient-complexity measure to regression error during training.
How it connects
Links L2 regularization to ridge regression, and contrasts it with L1 regularization and lasso regression.

Also explained in

Compare how 3 books explain l2 norm →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.