L2 norm
The L2 norm is the nonnegative Euclidean magnitude of a vector, equal to the square root of the sum of its components’ squares, and to absolute value for a scalar.
Grokking Machine Learning
The L2 norm of a vector is the square root of the sum of the squared values of its components.
- How it is used
- Uses squared model coefficients as a complexity measure in regularization to help reduce overfitting.
- 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.
Natural Language Processing in Action, Second Edition
The L2 norm of a vector is the square root of the sum of the squares of its components.
- How it is used
- Supports measuring vector length, Euclidean distance, normalization, and cosine-based comparison in NLP vector spaces.
- How deep it goes
- Defines the formula, explains geometric consequences, and demonstrates NumPy normalization without deriving deeper linear-algebra theory.
- Examples
- Uses two-dimensional vector geometry, a four-element NumPy vector, TF vectors, and normalized sentence embeddings.
- What you can do after
- Apply it via NumPy to calculate vector lengths, normalize embeddings, and support cosine-similarity computations.
Read how Natural Language Processing in Action, Second Edition explains l2 norm →
Math and Architectures of Deep Learning
The Euclidean norm measuring a vector's length by squaring components, summing them, and taking the square root.
- How it is used
- Measures vector magnitude, model prediction error, and weight size used for regularization.
- How deep it goes
- Defines the formula, dot-product relationship, geometric meaning, normalization use, and regularization role without deriving matrix norms.
- Examples
- Uses error vectors across training data, right-triangle geometry, unit-vector normalization, and weight penalties.
- What you can do after
- Evaluate vector magnitude, interpret prediction error, normalize vectors, and understand L2 weight regularization.
Read how Math and Architectures of Deep Learning explains l2 norm →
Related concepts
- Euclidean distanceequivalent to · Euclidean distance is the straight-line distance between two points in Euclidean space, calculated as the square root of the sum of squared differences between corresponding coordinates.
- weight decayused by · Weight decay is a model-training regularization technique that discourages large parameter values by penalizing their magnitudes or shrinking them during optimization.
- L1 regularizationused by · L1 regularization is a technique that adds a penalty proportional to the sum of absolute model-parameter values, encouraging sparse parameter estimates.
- ridge regressionconfigures · Ridge regression is linear regression that applies an L2 penalty to coefficient magnitudes, shrinking estimates toward zero to reduce overfitting.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


