ML Labs · Diagrams

See how it fits together

Short animated diagrams of what we have learned. Press Play, or step through one part at a time

Same spam filter example as the lab and the practice page. The numbers are examples, the ideas do not depend on them. Motion switches off if your device asks for reduced motion

Train, validate, adjust, then test once

1,000 emails, split once at the start

Training600 emails
Validation200
Testlocked

Not to scale on small screens

1Trainon training emails
2Validatescore on validation
3Adjustchange a setting

repeat as often as you like

4Test oncenever seen before
5Reportwhatever number you get

Key points

Quiz yourself on this

Where the sample size formula applies

|H|rules you allow
εerror you accept
δchance of bad luck
m ≥ ln(|H| / δ) / ε emails needed in training Assumes at least one perfect rule exists (realizable case)
Trainingm = 600 emails
Validation200
Test200
not part of m own formula±9.6% at 200

Not to scale on small screens

Key points

Try the formula in the lab

How big should the list of rules be

Move the sliders. The curves show the worst-case error you can guarantee. The estimation curve comes from the agnostic bound with δ = 0.05. The approximation curve is a made-up shape, because its real shape depends on your problem

Approximation error (the list) Estimation error (the emails) Total you can guarantee Sweet spot

Error you can guarantee (lower is better)

Number of rules in the list (|H|)

100100,000
11 billion
Play slides the emails from 100 to 100,000 and the sweet spot follows

At the list size you picked

Approximation error (the list)
Estimation error (the emails)
Total you can guarantee

Key points

Quiz yourself on this