Computing · Machine Learning · Introduction to Machine Learning · The whole process · Advanced

From pixels to predictions,
A to Z

Twenty-six steps, one handwritten digit. A to G turn an 8 × 8 image into a feature vector and show, with formulas, why 64 dimensions are already a strange place. H to T learn from it three ways: with labels (supervised), without labels (unsupervised) and from rewards alone (reinforcement). U to Y show how each result is checked: cross-validation, bias–variance, capacity bounds, metrics and confidence intervals. Z is what it costs and how a learned representation is reused: transfer learning.

Click any letter, press ▶, or use the arrow keys.

01

The whole process on one sheet

The example image enters on the left and becomes a 64-dimensional feature vector (A–G). It then splits into three branches that differ only in the feedback they get: labels, nothing, or a reward. All three meet in the checking phase (U–Y); the dashed red loop is model selection feeding back into training. Click any lettered dot to jump to that step.
One 8 × 8 digit · three learning paradigms · checking · reuse100%
The RL branch (R–T) sees the same 1,437 training images as the supervised branch. Why does the map count 0 labels for it, and what is the most information one trial can carry?
The learner never sees y; it only sees whether its own guess a was right, r = 1[a = y]. A binary reward carries at most H(r) ≤ 1 bit, while a label among 10 equally likely classes carries log₂ 10 ≈ 3.32 bits. When r = 0 the learner only learns "not a", which leaves 9 candidates: log₂(10/9) ≈ 0.15 bit. That is why step T needs far more trials than step L needs examples.
02

Step by step

Letters fill in as you pass them. Each step shows what goes in and what comes out, a figure computed from the same data specification as the rest of the page, the derivation behind it and, where the field writes code, a short reference implementation in NumPy you can copy. The panel tracks the data shape, the number of features d and how many labels have been used.
A
step 1 of 26
data100%
← → keys · any letter key jumps · F = full screen
data & features A–Gsupervised H–Nunsupervised O–Qreinforcement R–Tchecking U–Yreuse Z

in
out

data at this point
features d
—
labels used
0
At step K the loss of an untrained softmax model (all weights zero) is exactly ln 10 ≈ 2.303 on every image. Why, and what is the gradient with respect to the logits at that point?
With W = 0 every logit is 0, so softmax gives pk = 1/10 for every class and ℓ = −ln(1/10) = ln 10 ≈ 2.303 whatever the label. The gradient is ∂ℓ/∂z = p − ey = (0.1, …, 0.1 − 1, …, 0.1): −0.9 on the true class and +0.1 on the other nine, so the first step raises the true class and lowers the rest. ln K is the standard sanity check for any K-class classifier at initialisation.
03

All 26 steps in one table

A printable summary: what goes in, what comes out and the key figure of every step, all computed from the same data specification as the step viewer. Click a row to open that step.
stepphasewhat happensinputoutputkey figure

Running example: the UCI optical handwritten digits (scikit-learn load_digits): 1,797 images of 8 × 8 pixels, grey levels 0–16, 10 classes, split 1,437 train / 360 test. Softmax regression has 10 × 64 + 10 = 650 parameters; k-NN stores 1,437 × 64 = 91,968 numbers.

Using the table: how many multiply-adds does one k-NN prediction cost before and after PCA to 20 components, and what is the speed-up?
Before: 1,437 distances × 64 coordinates = 91,968. After: projecting the query costs 20 × 64 = 1,280, then 1,437 × 20 = 28,740 for the distances, total 30,020. Speed-up 91,968 / 30,020 ≈ 3.1 ×, while about 90 % of the pixel variance is kept (step P).
04

Quiz

Ten questions at the advanced level: calculations, derivations and what-if questions. Pick an answer to see why it is right or wrong. Nothing is recorded.
score0 / 0
05

Glossary

Every term marked with a red ? on this page, with a short definition. Type to filter.