Learn machine learning from scratch

Start at chapter 1 and build up: what a model is, how it measures its own mistakes, and how it learns. Everything is worked out in plain Python, with the maths shown rather than assumed. Two shorter tracks hold reference notes on the maths and on modern architectures.

Track Progress: 0 Completed
0%

Choose where to start

New to machine learning? Start with chapter 1 of the Core Course. Already code? Jump into The Math Behind ML or Modern Architectures.

New to programming?Epoch Zero PythonA free 12-week course that teaches Python on your own computer, from print() to a working Pac-Man. Then come back for chapter 1.See the Python course →

Core Course

17 chapters

  1. Chapter 1What a Model Is: A Function with Knobsbeginner29 min
  2. Chapter 2One Neuron, Many Inputs: The Dot Productbeginner32 min
  3. Chapter 3Measuring Error: Choosing a Loss Functionbeginner34 min
  4. Chapter 4Which Way Is Downhill? Derivatives by Hand and by Nudgingintermediate35 min
  5. Chapter 5Let the Computer Do the Calculus: A Tiny Autograd Engineintermediate45 min
  6. Chapter 6From Numbers to Arrays: Batches and Matrix Gradientsintermediate51 min
  7. Chapter 7The Training Loop: Gradient Descent in Practiceintermediate38 min
  8. Chapter 8Solving XOR: Why Networks Need a Hidden Layerintermediate41 min
  9. Chapter 9Choosing Among Many: Classification with Softmaxintermediate38 min
  10. Chapter 10Smarter Steps: Momentum, RMSProp and Adamintermediate49 min
  11. Chapter 11Too Good to Be True: Overfitting and Regularizationintermediate43 min
  12. Chapter 12Twenty Questions: Decision Treesintermediate48 min
  13. Chapter 13Starting Right: Initialization and Normalizationintermediate42 min
  14. Chapter 14Real Data: Reading Handwritten Digitsintermediate42 min
  15. Chapter 15After Training: Saving Models and Making Predictionsintermediate48 min
  16. Chapter 16Same Weights Everywhere: From Dense Layers to Convolutionsintermediate47 min
  17. Chapter 17Capstone: A Tiny Attention-Based Language Modelintermediate61 min

Maths for ML

34 lessons

All of it on one page: the modules, the notation explorer and Read an equation.

  1. Lesson 1Letters and the little numbers: xᵢ, x², x⁽ⁱ⁾beginner9 min
  2. Lesson 2Plain, bold and capital letters; hats, bars and starsbeginner10 min
  3. Lesson 3Σ and Π are for-loopsbeginner10 min
  4. Lesson 4Sets, ℝ and shapes: what W ∈ ℝ^(m×n) tells youbeginner10 min
  5. Lesson 5Functions and arrows: f: ℝⁿ → ℝ, ↦ and f ∘ gbeginner10 min
  6. Lesson 6Vectors: arrows and arraysbeginner9 min
  7. Lesson 7The dot product and the angle between vectorsbeginner10 min
  8. Lesson 8Norms: how big is a vector?beginner10 min
  9. Lesson 9Linear combinations and span: which points can you reach?beginner10 min
  10. Lesson 10A matrix is a transformationbeginner10 min
  11. Lesson 11Multiplying matrices: check the shapes firstbeginner11 min
  12. Lesson 12Transpose, identity, inverse and determinantintermediate10 min
  13. Lesson 13Special matrices: diagonal, symmetric, orthogonal, triangular, sparseintermediate10 min
  14. Lesson 14Tensors and broadcastingintermediate10 min
  15. Lesson 15Eigenvectors: the directions a matrix only stretchesintermediate10 min
  16. Lesson 16The SVD: rotate, stretch, rotateintermediate10 min
  17. Lesson 17PCA: the directions where the data varies mostintermediate10 min
  18. Lesson 18The derivative: slope, and sensitivitybeginner10 min
  19. Lesson 19Partial derivatives and the gradientbeginner10 min
  20. Lesson 20The chain rule, run backwards: backpropagationintermediate10 min
  21. Lesson 21Jacobians and Hessians: derivatives as tablesintermediate10 min
  22. Lesson 22Probability, and probability given somethingbeginner9 min
  23. Lesson 23Bayes' rule: updating on evidencebeginner9 min
  24. Lesson 24Expectation, variance and covarianceintermediate10 min
  25. Lesson 25Common distributions: Bernoulli, categorical, Gaussianbeginner9 min
  26. Lesson 26Sampling, i.i.d. data and likelihoodintermediate10 min
  27. Lesson 27The loss as a landscapebeginner9 min
  28. Lesson 28Learning rates and momentumintermediate10 min
  29. Lesson 29Convex and non-convex: valleys, traps and plateausintermediate10 min
  30. Lesson 30argmin, constraints and Lagrange multipliersintermediate10 min
  31. Lesson 31Capstone: linear regression three waysintermediate11 min
  32. Lesson 32Capstone: logistic regression from scratchintermediate10 min
  33. Lesson 33Capstone: PCA on real handwritten digitsintermediate11 min
  34. Lesson 34Capstone: read three equations from real papersintermediate11 min

The Math Behind MLReference notes

8 chapters

Condensed summaries of each topic, not step-by-step lessons. The Core Course is the one to work through.

  1. Chapter 1Linear Algebra, Vector Spaces & Matrix Calculusbeginner8 min
  2. Chapter 2Probability Distributions, Maximum Likelihood & MAPbeginner7 min
  3. Chapter 3Information Theory, Entropy & Divergence Measuresintermediate8 min
  4. Chapter 4Convexity, Optimization Dynamics & Dualityintermediate8 min
  5. Chapter 5Matrix Decompositions, SVD & Low-Rank Adaptation (LoRA)advanced8 min
  6. Chapter 6Deep Neural Representations & Normalization Mathematicsadvanced8 min
  7. Chapter 7Transformer Mathematics: Attention Scaling, RoPE & Latent Projectionsfrontier7 min
  8. Chapter 8Continuous Flow Matching ODEs & Post-Training RL Mathematicsfrontier7 min

Modern ArchitecturesReference notes

6 chapters

Already know how networks are trained? Start at Chapter 2.

Condensed summaries of each topic, not step-by-step lessons. The Core Course is the one to work through.

  1. Chapter 1Modern Optimizers & Normalization Mechanicsintermediate5 min
  2. Chapter 2Scaled Dot-Product & Multi-Head Attentionadvanced6 min
  3. Chapter 3Modern Decoder-Only LLM Block (Llama / Mistral Style)advanced6 min
  4. Chapter 4Mixture of Experts (MoE) & Multi-Head Latent Attention (MLA)advanced7 min
  5. Chapter 5Diffusion Models & Rectified Flow Matchingfrontier6 min
  6. Chapter 6Post-Training RL for Reasoning LLMs (DPO & DeepSeek-R1 GRPO)frontier5 min

Guides

Reference articles