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.
From the paper
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.
Move lit windows
Made-up exampleExplore
Choose a changed picture that keeps two lit windows.
Tap the illustration or use the buttons
It must change position without changing the count.
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.
From the paper
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.
Build a house from parts
Made-up exampleExplore
Build the toy house silhouette with exactly two parts.
Tap the illustration or use the buttons
Compare the selected parts with the outline; count the parts too.
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
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.