The Modern Mathematics of Deep Learningexplained for non-mathematicians

Vector p-norm

Penguin learning project

The project uses 342 complete Palmer penguin records: 240 training-pool and 102 held-out rows. The selected training rows determine feature scaling and model parameters. Source CSV

This project trains weights with softmax, unlike the homepage lab, which uses nearest species averages. Same penguin measurements; different classification methods. Predictions can differ.

Classification predicts three species; Ridge predicts body mass in grams using the same observations. These are separate models. Training predictions feed the objective; 102 separate test predictions never update the weights.

Norms and distances · Measure size or difference in a specified space.

Project vectors have two features; the training matrix has n rows and two columns. Mathematical tools may operate on these values when their assumptions apply.

Project operation

Output: ≈4.309

Project operation

The project calculation uses these records; the source formula and example follow below. Code edits run locally; project settings travel between pages.

Objective → Project operation → Project operation

Project input

Showing first three entries; the operation receives the complete array. Rounded preview; the operation uses full precision.

input.vector · Features
[≈-0.2895, ≈-2.052, ≈-1.016] … (9 entries)
input.p · Project settings or constant
2

Result

≈4.309

Used in these source sections: 1.1 A note on symbols · 3.2 Simple pieces, many layers · 7.2 A few building blocks at a time

Take absolute values, raise them to p, add, then take the p-th root. At p = ∞, use the largest absolute entry instead.

Different norms measure vector size in different ways.

Source formula example

∥x∥p=(∑i=1d∣xi∣p)1/p,1≤p<∞\|x\|_p=(\sum_{i=1}^d|x_i|^p)^{1/p},\quad1\leq p<\infty

exact · The p control computes finite p values; the separate infinityNorm result computes the p=∞ case.

Symbols

pp
A real number in [1,∞], including ∞.

Source formula example

This source example uses its own inputs and assumptions. Editing it does not change the project.

Edit a value or the code, then run the example. This is a finite demonstration, not a proof of the paper’s theorem.

This example’s data flow

You choose

  • input.first = 3
  • input.p = 2

Calculated here

Result expression: { norm, infinityNorm }

  • x = [input.first, -4] Uses: input.first
  • p = input.p Uses: input.p
  • norm = x.reduce((sum, value) => sum + Math.abs(value) ** p, 0) ** (1 / p) Uses: x, p
  • infinityNorm = Math.max(...x.map(Math.abs)) Uses: x

Returns

Example result
norm
5
infinityNorm
4

Read numbers from input and return the result. JavaScript basics.

Result

Enable JavaScript to run this example.

Technical statement

Change the input and run the same code again. The displayed result uses the values shown above.

Source: Vector p-norm