The Modern Mathematics of Deep Learningexplained for non-mathematicians

Finding useful patterns

It is one thing to find weights that make the correct prediction. It is another to understand what information the layers have learned to represent.

We will look for two useful kinds of picture descriptions: ones that stay steady when a picture moves, and ones that use just a few building blocks.

7.1 Features that stay steady

Invariances and the scattering transform · paper pp. 52–53

Move a drawn cat a little to the right. For a cat-or-dog question we probably want the answer to stay the same. A useful feature can ignore an irrelevant change while still responding to important changes.

Imagine an arrow pointing right. Turn it downward without changing its length: its direction changes, but its length stays the same. A complex number can be pictured as such an arrow. A Fourier coefficient uses one to describe the strength and alignment of a repeating pattern in a signal. Frequency tells how many times the pattern repeats around a loop. Try a signal sampled at four positions around a loop, with one mark; move the mark one position.

The arrow turns from right to down, but its length stays 1.

From the paper

u(⋅−τ)^(ω)=e−2πi⟨τ,ω⟩u^(ω)\widehat{u(\cdot-\tau)}(\omega)=e^{-2\pi i\langle\tau,\omega\rangle}\hat{u}(\omega)
[1,0,0,0]→[0,1,0,0]:∣1∣=∣−i∣=1[1,0,0,0]\to[0,1,0,0]:\quad |1|=|-i|=1
function shiftedMagnitude(shift) {
  const angle = -2 * Math.PI * shift / 4;
  return { first: 1, second: Math.hypot(Math.cos(angle), Math.sin(angle)) };
}
const result = shiftedMagnitude(1);

Choose a change. Predict, then run.

Result:
Enable JavaScript to run this example.

Go deeper in Concepts paper pp. 53

Move lit windows

Made-up example

Explore

Choose a changed picture that keeps two lit windows.

Tap the illustration or use the buttons

Original house2 lit windowsChanged house2 lit windowsChanged house2 lit windowsChanged house1 lit windows
Picture

Selected: Unchanged; Current: 0 · 1 · 1 · 0; Lit windows: 2

The coefficient changes from 1 to −i: its arrow turns from right to down. This arrow represents a number; it is not an arrow drawn on the image. Its length, or magnitude, stays 1; its direction, or phase, changes. The source formula gives a continuous shift identity; this finite circular example illustrates it but does not prove it. In the formula u is the signal, τ the shift and ω the frequency.

A scattering transform applies filters to find patterns, takes the magnitude of each response, then averages over an area. It can repeat these steps to describe patterns at different scales. Its theory gives guarantees for particular translations and small deformations, such as a slight stretch.

Invariance is “the feature stays the same”; stability is “a small input change causes only a small feature change.” The paper does not say every image change should be ignored, or that ordinary learned networks automatically satisfy the same guarantees.

7.2 A few building blocks at a time

Hierarchical sparse representations · paper pp. 53–55

Describe a house drawing using stored patterns such as a roof, walls and a door. A number for each pattern says how much of it to use. If only a few numbers are nonzero among many available patterns, the description is sparse.

The collection of patterns is called a dictionary. Here the simplest dictionary, the identity, matches each input entry to its own pattern, so the amounts stay [2, 0.1]. Now shrink them with a threshold of 0.2.

Subtract 0.2 from the large amount; reduce the smaller-than-0.2 amount to zero.

From the paper

TD,b(x)=ϱR(DTx−b)−ϱR(−DTx−b)\mathcal{T}_{D,b}(x)=\varrho_R(D^Tx-b)-\varrho_R(-D^Tx-b)
D=I, b=(0.2,0.2), x=(2,0.1):TD,b(x)=(1.8,0)D=I,\ b=(0.2,0.2),\ x=(2,0.1):\quad \mathcal{T}_{D,b}(x)=(1.8,0)
function thresholdCoefficients(values, cutoff) {
  const coefficients = [];
  for (const value of values) {
    coefficients.push(Math.max(0, value - cutoff) - Math.max(0, -value - cutoff));
  }
  return { coefficients };
}
const result = thresholdCoefficients([2, 0.1], 0.2);

Choose a change. Predict, then run.

Result:
Enable JavaScript to run this example.

Go deeper in Concepts paper pp. 54 (7.3)

Build a house from parts

Made-up example

Explore

Build the toy house silhouette with exactly two parts.

Tap the illustration or use the buttons

Selected partsDoorWallsRoofHouse combinationDashed = removed
House parts

Selected: none; Roof and walls form the outline

For these positive amounts, subtract 0.2 from 2 to get 1.8; 0.1 is below the threshold, so it becomes 0. This is soft thresholding: it also shrinks amounts that remain. Negative amounts are handled by the other term in the formula. In the formula D is the dictionary, Dᵀx gives pattern amounts, b is the threshold and ρR is ReLU.

Thresholding changes the amounts used to describe patterns; pruning in chapter 6 removes network weights. The paper connects sparse pattern descriptions to convolutional networks: early layers can detect local patterns; further layers can combine them into more structured descriptions.

Thresholding can also remove a real but weak clue. Mathematical recovery guarantees need assumptions about how sparse the description is, how different the patterns are and how much noise was added. The point is to understand possible learned features, not to claim every network discovers this dictionary.

The same pixels can have useful short descriptions when irrelevant movement and weak patterns are handled carefully. We finish by asking how these ideas meet equations from natural sciences.

Try the chapter quiz

1. A picture moves sideways. What does invariance to that shift mean?

2. A picture uses two active edge parts out of many. What makes this representation sparse?

3. Why use a hierarchy of features?

An independent educational explanation of The Modern Mathematics of Deep Learning — Julius Berner, Philipp Grohs, Gitta Kutyniok, Philipp Petersen. Examples use invented numbers unless a measured dataset is credited.