The Modern Mathematics of Deep Learningexplained for non-mathematicians

An algorithm’s sample complexity measure

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.

Generalization and risk bounds · Relate sample behavior to population risk under stated assumptions.

The project supplies finite observations and fitted parameters. A held-out sample does not establish population bounds or prove a theorem.

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: 2.4 A second descent

The source defines a measure using expected training risk as sample size changes.

In the toy, labels are independent fair bits, the algorithm predicts the first label for every example, and loss is zero-one. Its expected training risk is (m−1)/(2m).

This measure describes the algorithm’s ability to fit a sample at a chosen error threshold.

Source formula example

complexity⁡(A)≔max⁡{m∈N ⁣:E[R^S(A(S))]≤ε with S∼PZm}\operatorname{complexity}({\mathcal{A}})\coloneqq\max\big\{m\in{\mathbb{N}}\colon{\mathbbm{E}}\big[\widehat{\mathcal{R}}_{S}({\mathcal{A}}({S}))\big]\leq{\varepsilon}\ \text{with}\ {S}\sim{\mathbbm{P}}_{Z}^{m}\big\}

illustration · This is an exact analytic calculation for one toy algorithm and distribution. For other algorithms the maximum may differ, fail to exist, or be unbounded.

Symbols

A\mathcal{A}
A learning algorithm.
SS
An i.i.d. training sample.
εε
The training-risk threshold.

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.epsilon = 0.3

Calculated here

Result expression: { maximum, expectedRiskAtMaximum, expectedRiskAtNext }

  • epsilon = input.epsilon Uses: input.epsilon
  • maximum = Math.floor(1 / (1 - 2 * epsilon)) Uses: epsilon
  • expectedRiskAtMaximum = (maximum - 1) / (2 * maximum) Uses: maximum
  • next = maximum + 1 Uses: maximum
  • expectedRiskAtNext = (next - 1) / (2 * next) Uses: next

Returns

Example result
maximum
2
expectedRiskAtMaximum
0.25
expectedRiskAtNext
≈0.3333

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

Result

Enable JavaScript to run this example.

Technical statement

For the toy, the first sample is always classified correctly. Each of the remaining m−1 fair independent labels differs from the first with probability 1/2, giving expected training error (m−1)/(2m). For ε<1/2 the resulting maximum is floor(1/(1−2ε)); for ε≥1/2 it is unbounded, so the control excludes that range.

Source: Algorithm complexity