L2 norm
The L2 norm of a vector is its Euclidean length, calculated as the square root of the sum of the squares of its components.
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 for Web Design
Magnitude is the scalar length or size of a vector, representing the straight-line distance it covers.
- How it is used
- Measures the length of a movement vector for element positioning and consistent-speed movement.
- How deep it goes
- Defines magnitude with a 2D formula and implements it in JavaScript, including its use in normalization.
- Examples
- Uses a Vector2 class with magnitude(), normalize(), and a CSS translation method.
- What you can do after
- Apply it via JavaScript to measure a 2D offset and normalize it for directional movement.
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, calculated as the square root of the sum of squared differences between corresponding coordinates.
- 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.
- weight decayused by · Weight decay is a regularization technique that discourages large model parameters by penalizing their magnitudes in the objective or shrinking them during optimization.
- activationmeasures · An activation is a numerical signal or intermediate value produced by a neural-network unit or layer during computation.
- probability theoryproduces · Probability theory is the branch of mathematics that formalizes uncertainty and analyzes random events and outcomes using probability measures.
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.



