Machine Learning, Step by Step

From a line through a few points to neural networks, decision trees and agents that learn from rewards.

  • Intermediate
  • About 14 hours
  • 8 sections · 57 lessons
  • Free, no account

0 of 23 lessons complete

The course tutor, a friendly robot

About this course

A hands-on introduction to machine learning that you learn by doing. Every idea comes with an interactive graphic you can poke and a narrated walkthrough that drives it step by step: you will drag a line through data, watch the cost of a bad guess appear as literal squares, roll a ball down a cost surface and train a model yourself. The path follows the classic beginner's route (supervised learning, neural networks, decision trees, then unsupervised learning and beyond). Generative models (diffusion, speech, image-to-3D and transformers) are covered in the later courses "Transformers and Large Language Models" and "Generative AI: Images, Speech and 3D". You need school-level algebra and curiosity; no programming is required for Section 1.

Before you start

This course builds on:

Part of the AI from Zero learning path (course 4 of 8).

What you'll learn

  • Explain what machine learning is, and when learning from examples beats writing rules by hand
  • Tell supervised learning from unsupervised learning, and regression from classification
  • Build a linear regression model and read its prediction ŷ = wx + b
  • Measure how wrong a model is with a squared-error cost function, and picture it as a landscape
  • Train a model with gradient descent and choose a sensible learning rate
  • Extend models to many features, classification, regularisation and neural networks
  • Use clustering, anomaly detection, recommenders and the basics of reinforcement learning
  • Build decision trees and explain how random forests and boosted trees combine them

Syllabus

Section 1Supervised learning: regression and gradient descent8 lessons · 2 h 8 min

What machine learning is, the difference between supervised and unsupervised learning, and your first model: a straight line fitted to house prices. You will measure its error with a cost function, picture that cost as a landscape and train the model with gradient descent.

Section overview

  1. What is machine learning?Lesson · 12 min
  2. Supervised vs unsupervised learningLesson · 12 min
  3. Linear regression: your first modelLesson · 15 min
  4. The cost function: how wrong is the line?Lesson · 15 min
  5. The cost landscapeLesson · 14 min
  6. Gradient descent: walking downhillLesson · 18 min
  7. Choosing the learning rateLesson · 12 min
  8. Lab: train a model yourself + section quizLab · 30 min

0 of 8 lessons complete

Section 2Many features, feature scaling and polynomial regression7 lessons · 1 h 50 min

Real predictions use more than one input. Vectors and multiple linear regression, vectorised NumPy code, why feature scaling makes gradient descent fast, how to check that training is working, and curved fits with polynomial features. Ends with a from-scratch linear regression lab in NumPy.

Section overview

  1. Multiple features and vectorsLesson · 15 min
  2. Vectorisation: doing it all at onceLesson · 12 min
  3. Gradient descent with many featuresLesson · 14 min
  4. Feature scalingLesson · 14 min
  5. Is gradient descent working?Lesson · 10 min
  6. Feature engineering and polynomial regressionLesson · 15 min
  7. Lab: linear regression in NumPy + section quizLab · 30 min

0 of 7 lessons complete

Section 3Classification, logistic regression and overfitting8 lessons · 2 h 18 min

Predicting categories instead of numbers. Why a straight line fails for yes-or-no answers, the sigmoid and logistic regression, decision boundaries, the log loss and how gradient descent trains it, then the central problem of machine learning: fitting the data without memorising it, and how regularisation helps. Ends with a lab where you build logistic regression in NumPy.

Section overview

  1. Classification: why a straight line fails for yes or noLesson · 12 min
  2. The sigmoid and logistic regressionLesson · 15 min
  3. Decision boundariesLesson · 14 min
  4. The log loss: why not squared error?Lesson · 16 min
  5. Gradient descent for logistic regressionLesson · 16 min
  6. Underfitting and overfittingLesson · 14 min
  7. RegularisationLesson · 16 min
  8. Lab: logistic regression in NumPy + section quizLab · 35 min

0 of 8 lessons complete

Section 4Neural networksComing soon

Layers of simple units that learn their own features. Forward propagation by hand and in NumPy, activation functions, softmax, and the intuition for how training works.

  1. Neurons and layersLesson · 13 min
  2. Forward propagation by hand and in NumPyLesson · 15 min
  3. Activation functionsLesson · 12 min
  4. Multiclass classification and softmaxLesson · 14 min
  5. How training works: backprop intuitionLesson · 15 min
  6. Lab: a tiny network that classifies 2-D pointsLab · 25 min
Section 5Practical advice for building modelsComing soon

How to decide what to try next: data splits, bias and variance, learning curves, error analysis, skewed classes and the whole project cycle.

  1. Train, validation and test setsLesson · 13 min
  2. Bias and varianceLesson · 15 min
  3. Learning curvesLesson · 12 min
  4. Error analysisLesson · 12 min
  5. Adding data, augmentation and transfer learningLesson · 13 min
  6. Skewed classes, precision, recall and F1Lesson · 15 min
  7. The ML project cycle, fairness and ethicsLesson · 13 min
Section 6Decision trees and ensemblesComing soon

A different kind of model built from questions. Entropy and information gain, choosing splits, regression trees, random forests and boosted trees.

  1. Trees as questionsLesson · 11 min
  2. Entropy and information gainLesson · 15 min
  3. Choosing splitsLesson · 13 min
  4. One-hot and continuous featuresLesson · 12 min
  5. Regression treesLesson · 12 min
  6. Random forests and boosted treesLesson · 15 min
  7. Trees or neural networks?Lesson · 10 min
  8. Lab: build a tree from scratchLab · 25 min
Section 7Unsupervised learningComing soon

Finding structure without labels: k-means in depth, anomaly detection with Gaussians, and dimensionality reduction with PCA.

  1. k-means clusteringLesson · 15 min
  2. Choosing k and initialisationLesson · 13 min
  3. Anomaly detection with GaussiansLesson · 15 min
  4. Dimensionality reductionLesson · 12 min
  5. Principal component analysisLesson · 15 min
  6. Lab: cluster and compressLab · 22 min
Section 8Recommender systems and reinforcement learningComing soon

How services suggest what you might like, and how an agent learns to act from rewards: states, actions, returns, the Bellman equation and Q-learning.

  1. Collaborative filteringLesson · 15 min
  2. Content-based filteringLesson · 12 min
  3. Reinforcement learning: states, actions, rewardsLesson · 14 min
  4. Returns and discountingLesson · 11 min
  5. The Bellman equationLesson · 15 min
  6. Q-learning in a grid worldLesson · 15 min
  7. Lab: train an agentLab · 25 min