The Modern Mathematics of Deep Learningexplained for non-mathematicians

Bias as an extra coordinate

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.

Features · Transform inputs into features used by a rule.

The project scales bill and flipper measurements using training-row means and scales; its feature vector has two entries.

Consider this concept alongside the project; its source assumptions may differ. These observations do not prove a theorem.

Input: 12 × 2; Held-out evaluation: 102 · #58 · 40.6 mm, 193 mm. Known answer: Adélie; Prediction: Adélie · [≈0.7383, ≈0.2444, ≈0.01737].

Used in these source sections: 1.2 Learning from examples

Appending 1 to the input lets a matrix multiplication include the bias.

This representation simplifies layer notation.

Source formula example

x→[x1],(W(ℓ),b(ℓ))→[W(ℓ)b(ℓ)01],ℓ∈[L−1],and(W(L),b(L))→[W(L)b(L)].x\to\begin{bmatrix}x\\ 1\end{bmatrix},\quad(W^{(\ell)},b^{(\ell)})\to\begin{bmatrix}W^{(\ell)}&b^{(\ell)}\\ 0&1\end{bmatrix},\quad\ell\in[L-1],\quad\text{and}\quad(W^{(L)},b^{(L)})\to\begin{bmatrix}W^{(L)}&b^{(L)}\end{bmatrix}.

exact · This is a concrete finite-dimensional example of the source transformation.

Symbols

xx
Input vector.
W(l)W⁽ˡ⁾
Weight matrix.
b(l)b⁽ˡ⁾
Bias vector.
LL
Number of layers.

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.x = 1

Initial values in code

  • W = [ [1, 2], [3, 4], ]
  • b = [1, -1]
  • augmented = [ [1, 2, 1], [3, 4, -1], [0, 0, 1], ]

Calculated here

Result expression: { augmentedInput, augmented, hiddenOutput: full, finalOutput: finalLayer }

  • x = [input.x, 2] Uses: input.x
  • augmentedInput = [...x, 1] Uses: x
  • full = augmented.map((row) => row.reduce((s, v, i) => s + v * augmentedInput[i], 0), ) Uses: augmented, augmentedInput
  • finalLayer = [ [1, 2, 1], [3, 4, -1], ].map((row) => row.reduce((s, v, i) => s + v * augmentedInput[i], 0)) Uses: augmentedInput

Returns

Example result
augmentedInput
array (3 items): [1, 2, 1]
augmented
array (3 items): [array (3 items): [1, 2, 1], array (3 items): [3, 4, -1], array (3 items): [0, 0, 1]]
hiddenOutput
array (3 items): [6, 10, 1]
finalOutput
array (2 items): [6, 10]

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

Result

Enable JavaScript to run this example.

Technical statement

The extra row preserves the constant 1 for intermediate layers; the final layer does not include that row.

Source: Source expression