The Modern Mathematics of Deep Learningexplained for non-mathematicians

Empirical risk

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.

Objectives · Combine losses and penalties into a criterion for parameters or rules.

Project predictions and known answers produce losses. Classification uses cross-entropy and α/2 times squared non-bias weights; Ridge uses normalized-mass MSE and α times all squared coefficients, including the intercept.

Mean training loss

Input
12 Loss
Output
≈0.228

Project operation

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

Loss → Mean training loss → Objective

Project input

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

input.losses · Loss
[≈0.005482, ≈1.012, ≈0.1422] … (12 entries)

Result

≈0.228

Used in these source sections: 1.2 Learning from examples · 1.2.1 Finding better settings · 1.2.3 Does it work on new examples? · More source sections

Compute the loss for every training example, then average those losses.

Training loss is measurable on the available sample.

Source formula example

R^s(f)≔1m∑i=1mL(f,z(i)).\widehat{\mathcal{R}}_{{s}}(f)\coloneqq\frac{1}{m}\sum_{i=1}^{m}{\mathcal{L}}(f,z^{(i)}).

exact · The result is exact for these finite toy inputs, apart from ordinary computer rounding.

Symbols

ss
A sample of m examples.
L(f,z)ℒ(f,z)
Loss of prediction rule f on example z.

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

Calculated here

Result expression: { losses, risk: losses.reduce((a, b) => a + b, 0) / losses.length }

  • losses = [input.first, 4, 9] Uses: input.first

Returns

Example result
losses
array (3 items): [1, 4, 9]
risk
≈4.667

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

Result

Enable JavaScript to run this example.

Technical statement

This computes a sample average of losses, not an expectation over the whole population.

Source: Source expression