Machine Learning, Step by Step
From a line through a few points to neural networks, decision trees and agents that learn from rewards.
0 of 23 lessons complete

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 descent
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.
- What is machine learning?
- Supervised vs unsupervised learning
- Linear regression: your first model
- The cost function: how wrong is the line?
- The cost landscape
- Gradient descent: walking downhill
- Choosing the learning rate
- Lab: train a model yourself + section quiz
0 of 8 lessons complete
Section 2Many features, feature scaling and polynomial regression
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.
- Multiple features and vectors
- Vectorisation: doing it all at once
- Gradient descent with many features
- Feature scaling
- Is gradient descent working?
- Feature engineering and polynomial regression
- Lab: linear regression in NumPy + section quiz
0 of 7 lessons complete
Section 3Classification, logistic regression and overfitting
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.
- Classification: why a straight line fails for yes or no
- The sigmoid and logistic regression
- Decision boundaries
- The log loss: why not squared error?
- Gradient descent for logistic regression
- Underfitting and overfitting
- Regularisation
- Lab: logistic regression in NumPy + section quiz
0 of 8 lessons complete
Section 4Neural networks
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.
- Neurons and layers
- Forward propagation by hand and in NumPy
- Activation functions
- Multiclass classification and softmax
- How training works: backprop intuition
- Lab: a tiny network that classifies 2-D points
Section 5Practical advice for building models
How to decide what to try next: data splits, bias and variance, learning curves, error analysis, skewed classes and the whole project cycle.
- Train, validation and test sets
- Bias and variance
- Learning curves
- Error analysis
- Adding data, augmentation and transfer learning
- Skewed classes, precision, recall and F1
- The ML project cycle, fairness and ethics
Section 6Decision trees and ensembles
A different kind of model built from questions. Entropy and information gain, choosing splits, regression trees, random forests and boosted trees.
- Trees as questions
- Entropy and information gain
- Choosing splits
- One-hot and continuous features
- Regression trees
- Random forests and boosted trees
- Trees or neural networks?
- Lab: build a tree from scratch
Section 7Unsupervised learning
Finding structure without labels: k-means in depth, anomaly detection with Gaussians, and dimensionality reduction with PCA.
- k-means clustering
- Choosing k and initialisation
- Anomaly detection with Gaussians
- Dimensionality reduction
- Principal component analysis
- Lab: cluster and compress
Section 8Recommender systems and reinforcement learning
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.
- Collaborative filtering
- Content-based filtering
- Reinforcement learning: states, actions, rewards
- Returns and discounting
- The Bellman equation
- Q-learning in a grid world
- Lab: train an agent