All subjects

Learn

Learn machine learning

Ten parts, 52 sessions, from decision trees to language models. Predict a result, try the controls, then compare what happened with your prediction.

  • No coding or prior calculusThe maths comes in small, worked examples, starting with made-up loan applications.
  • Every result labelledBrowser calculations, recorded training runs or small models trained for the course: each result tells you which.
  • PrivateNothing you type leaves the page.

Your notebook

Reading your notebook.

Open your progress, saved models and results

The core track

Ten parts, in order.

Each session ends with a check: reach a target, predict what happens on new examples, or demonstrate the idea yourself. Save your takeaway in the notebook. The short code identifies the session there.

Part 1Data and the rules of the game5 sessions

Where the numbers come from, and what a score does not tell you.

  1. 1.1 What a prediction is, open, not started

    rule.hand35 minutesDemonstrate what you learned

  2. 1.2 Features: the model only sees columns, open, suggested after the earlier sessions

    feat.columns30 minutesTry new examples

  3. 1.3 Train, validate, test, open, suggested after the earlier sessions

    split.three30 minutesTry new examples

  4. 1.4 Accuracy, precision, recall, F1, open, suggested after the earlier sessions

    metric.four30 minutesDemonstrate what you learned

  5. 1.5 Accuracy lies, open, suggested after the earlier sessions

    metric.cost25 minutesReach a target

Part 2Decision trees5 sessions · 2 deep dives

Nested cuts you can see, chosen by a search you can check by hand.

  1. 2.1 Cuts by hand, open, suggested after the earlier sessions

    tree.hand30 minutesReach a target

  2. 2.2 Impurity and splits, open, suggested after the earlier sessions

    tree.split40 minutesTry new examples

  3. D1 Entropy versus Gini on the 14-row weather table, optional deep dive, open, suggested after session 2.2

    deep diveDerivation40 minutes

  4. 2.3 Depth and overfitting, open, suggested after the earlier sessions

    tree.depth35 minutesDemonstrate what you learned

  5. 2.4 Pruning and instability, open, suggested after the earlier sessions

    tree.prune30 minutesTry new examples

  6. D2 Cost-complexity pruning, optional deep dive, open, suggested after session 2.4

    deep diveDerivation40 minutes

  7. 2.5 Tree audit, open, suggested after the earlier sessions

    tree.audit25 minutesReach a target

Part 3Ensembles and random forests4 sessions · 1 deep dive

How trees with different errors can make a better prediction together.

  1. 3.1 Many weak voters, open, suggested after the earlier sessions

    vote.crowd30 minutesTry new examples

  2. 3.2 Bootstrap and feature bagging, open, suggested after the earlier sessions

    forest.random35 minutesTry new examples

  3. D3 Out-of-bag error as free validation, optional deep dive, open, suggested after session 3.2

    deep diveHarder target30 minutes

  4. 3.3 Feature importance, open, suggested after the earlier sessions

    forest.permute30 minutesDemonstrate what you learned

  5. 3.4 Forest versus tree, open, suggested after the earlier sessions

    forest.vs20 minutesTry new examples

Part 4Lines, loss and gradients6 sessions · 1 deep dive

A weighted sum, a loss that cares about confidence, and a slope.

  1. 4.1 The dot product is a score, open, suggested after the earlier sessions

    dot.score30 minutesDemonstrate what you learned

  2. 4.2 Sigmoid and log-loss, open, suggested after the earlier sessions

    loss.bet35 minutesReach a target

  3. 4.3 Slope without calculus, open, suggested after the earlier sessions

    slope.numeric30 minutesDemonstrate what you learned

  4. 4.4 Gradient descent by hand, open, suggested after the earlier sessions

    grad.step40 minutesReach a target

  5. D4 Momentum and Adam, hand-stepped, optional deep dive, open, suggested after session 4.4

    deep diveDerivation50 minutes

  6. 4.5 Softmax and temperature, open, suggested after the earlier sessions

    softmax.temp25 minutesDemonstrate what you learned

  7. 4.6 Where lines fail, open, suggested after the earlier sessions

    xor.wall20 minutesTry new examples

Part 5Perceptron, MLP and backpropagation6 sessions · 1 deep dive

Layers that build features, and the bookkeeping that assigns blame.

  1. 5.1 One neuron, open, suggested after the earlier sessions

    neuron.one25 minutesDemonstrate what you learned

  2. 5.2 Hidden layers build features, open, suggested after the earlier sessions

    mlp.hidden40 minutesReach a target

  3. 5.3 Activations matter, open, suggested after the earlier sessions

    mlp.relu25 minutesTry new examples

  4. 5.4 Backprop by hand, open, suggested after the earlier sessions

    backprop.blame45 minutesDemonstrate what you learned

  5. D5 Every weight of the 2-2-1 network, then the matrix form, optional deep dive, open, suggested after session 5.4

    deep diveDerivation60 minutes

  6. 5.5 Initialisation and batches, open, suggested after the earlier sessions

    train.setup30 minutesTry new examples

  7. 5.6 Beat the forest, open, suggested after the earlier sessions

    mlp.vs.forest40 minutesReach a target

Part 6Training dynamics5 sessions · 1 deep dive

Reading curves: capacity, regularisers, folds and shift.

  1. 6.1 The overfitting machine, open, suggested after the earlier sessions

    fit.over30 minutesDemonstrate what you learned

  2. 6.2 Three regularisers, open, suggested after the earlier sessions

    reg.three35 minutesTry new examples

  3. D6 The dataset where dropout hurts, optional deep dive, open, suggested after session 6.2

    deep diveReversal40 minutes

  4. 6.3 Cross-validation, open, suggested after the earlier sessions

    cv.folds30 minutesTry new examples

  5. 6.4 Distribution shift, open, suggested after the earlier sessions

    shift.time25 minutesTry new examples

  6. 6.5 Debug four trainings, open, suggested after the earlier sessions

    debug.four20 minutesTry new examples

Part 7Sequences: RNN and LSTM5 sessions · 1 deep dive

Order as information, a fixed-size state, and a gradient that fades.

  1. 7.1 Order is information, open, suggested after the earlier sessions

    seq.order25 minutesDemonstrate what you learned

  2. 7.2 Hidden state, open, suggested after the earlier sessions

    rnn.state40 minutesTry new examples

  3. 7.3 Vanishing gradients, open, suggested after the earlier sessions

    grad.vanish35 minutesDemonstrate what you learned

  4. 7.4 LSTM gates, open, suggested after the earlier sessions

    lstm.gates40 minutesDemonstrate what you learned

  5. D7 The LSTM's gradient path, optional deep dive, open, suggested after session 7.4

    deep diveDerivation45 minutes

  6. 7.5 Train a character model, open, suggested after the earlier sessions

    lstm.train40 minutesReach a target

Part 8Embeddings, attention and transformers6 sessions · 2 deep dives

Co-occurrence as geometry, then a similarity-weighted average.

  1. 8.1 Embeddings, open, suggested after the earlier sessions

    embed.near35 minutesDemonstrate what you learned

  2. 8.2 Attention by hand, open, suggested after the earlier sessions

    attn.hand45 minutesDemonstrate what you learned

  3. D8 Two heads of dimension one, by hand, optional deep dive, open, suggested after session 8.2

    deep diveDerivation45 minutes

  4. 8.3 Self-attention and heads, open, suggested after the earlier sessions

    attn.heads35 minutesTry new examples

  5. 8.4 Positional information, open, suggested after the earlier sessions

    pos.shuffle25 minutesTry new examples

  6. 8.5 The transformer block, open, suggested after the earlier sessions

    block.assemble35 minutesDemonstrate what you learned

  7. D9 Layer norm by hand and the residual ablation at depth 8, optional deep dive, open, suggested after session 8.5

    deep diveDerivation and harder target40 minutes

  8. 8.6 Attention versus LSTM, open, suggested after the earlier sessions

    attn.vs.lstm25 minutesTry new examples

Part 9Scaling to language models6 sessions · 2 deep dives

Subword ids, one distribution at a time, and what scale predicts.

  1. 9.1 Tokenisation, open, suggested after the earlier sessions

    bpe.merge35 minutesDemonstrate what you learned

  2. D10 The tokeniser and your language, optional deep dive, open, suggested after session 9.1

    deep diveReversal40 minutes

  3. 9.2 Next-token prediction, open, suggested after the earlier sessions

    next.token40 minutesDemonstrate what you learned

  4. D11 Top-k, top-p and temperature, optional deep dive, open, suggested after session 9.2

    deep diveHarder target40 minutes

  5. 9.3 What scale buys, open, suggested after the earlier sessions

    scale.loss30 minutesTry new examples

  6. 9.4 Pretraining and fine-tuning, open, suggested after the earlier sessions

    tune.stages40 minutesTry new examples

  7. 9.5 Mechanism, not mind, open, suggested after the earlier sessions

    mind.mechanism30 minutesDemonstrate what you learned

  8. 9.6 Context windows and retrieval, open, suggested after the earlier sessions

    ctx.cost25 minutesTry new examples

Part 10Mixture-of-Experts and capstone4 sessions · 1 deep dive

Routing, load balancing, and the pipeline you assemble yourself.

  1. 10.1 The router, open, suggested after the earlier sessions

    moe.route40 minutesDemonstrate what you learned

  2. 10.2 Load balancing, open, suggested after the earlier sessions

    moe.balance30 minutesReach a target

  3. D12 Capacity factor and token dropping, optional deep dive, open, suggested after session 10.2

    deep diveHarder target45 minutes

  4. 10.3 Capstone, open, suggested after the earlier sessions

    capstone.build50 minutesReach a target

  5. 10.4 The map, open, suggested after the earlier sessions

    map.place20 minutesDemonstrate what you learned

Every session and deep dive opens from its link at any time; the order is a suggestion. The 12 optional deep dives are suggested after their session and never block anything.

Further explorations

Explore vision, rewards and model errors.

7 optional lessons, open in any order. They sit alongside the 52-session core track and do not add notebook gates or change your saved progress.

  1. Convolutional neural networksMove a filter across pixels, inspect a feature map, and compare convolution, ReLU and pooling.
  2. Reinforcement learningTrain a small gridworld agent. Follow one Q-value update, then compare exploration with its learned policy.
  3. Reward hackingGive a courier the wrong reward. Compare its score with completed deliveries, then repair the incentive.
  4. Hallucination and uncertaintyCompare guessing with abstaining, and check whether evidence actually supports an answer.
  5. SycophancyChange the reward for agreeing with a user. See how the preferred answer can change while the fact stays fixed.
  6. Retrieval evaluationChange chunking and retrieval settings. Measure evidence coverage, missing answers and context cost on a fixed question set.
  7. Diffusion: noise and denoisingStep through a small probability model from noise towards a distribution. Inspect an analytic score and the limits of the illustration.