Maths for ML / Notation

∥x∥2\lVert \mathbf{x} \rVert_2

norm

Brackets and normsBeginner

Say it “the norm of x / the 2-norm of x”

The length or size of a vector. The subscript says which kind: ‖·‖₂ is straight-line length, ‖·‖₁ is the sum of absolute values.

Example

∥[3,4]∥2=9+16=5\lVert[3,4]\rVert_2 = \sqrt{9+16} = 5

In code

np.linalg.norm(x, ord=2)
torch.linalg.norm(x)

Where you’ll see it in ML

Weight decay, gradient clipping, normalizing embeddings.

Don’t confuse it with

Related

Lessons that use it

← All 94 symbols