Imperial College Machine Learning Course
Welcome, welcome and welcome to what is probably the most interesting and foundational course of your journey into the world of computing and artificial intelligence. You have arrived at the Machine Learning course that I teach at Imperial College London ๐.
I have specifically designed this course so that we get to the bottom of this ๐ฉ once and for all. There is so much information out there now and AI has become a soup of buzzwords. We will cut through the mess, try to ask the right questions and hope that we are ready for the answers.
There is one goal, critically think about machine learning and AI.
I completely revamped the course from last time I help teach it, and am very excited to take it on with a full and fresh perspective. We will explore the detailed and gory mathematical foundations, practical engineering workflows, algorithms, and societal implications of modern machine learning all under the guise of trying to build an artificial brain.
- This is probably also the last time I’ll hand write slides for a course, so enjoy the subtle questions, jokes and insights.
- All the diagrams and demos are LLM generated, so keep an eye out for anything that looks a bit off.
I structured the course into 8 parts with each part trying to tackle a different aspect of machine learning. Please read the sections below for my personal commentary on each part and behind the scenes action.
๐ Course Index
| Part | Topic | Web Slides | PDF (Light) | PDF (Dark) |
|---|---|---|---|---|
| 1 | ๐ง Atomic Unit of Thought | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 2 | ๐ Statistical Foundations of ML | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 3 | ๐งช Good Machine Learning Practice | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 4 | โก Connectionist Renaissance | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 5 | ๐ณ Decisions, Decisions | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 6 | ๐ Unsupervised Learning | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 7 | ๐ค Agency & Evolution | ๐ HTML | โ๏ธ PDF | ๐ PDF |
| 8 | โ๏ธ Ethics & Alignment | ๐ HTML | โ๏ธ PDF | ๐ PDF |
๐งญ Module Breakdown
๐ง Part 1: Atomic Unit of Thought
Introduction to Machine Thinking
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Biological vs. artificial neurons, the Perceptron (1958) and its learning rule, linear separability and the XOR problem, $k$-Nearest Neighbours ($k$-NN), instance-based vs. model-based learning, and data representations.
- Demos: ๐น๏ธ Mini-MNIST Opening Act | ๐น๏ธ Perceptron & Logic Gates Lab
I really wanted us to start from what is probably the most fundamental question Alan Turing asked in his seminal 1950 paper: Can machines think? Then we kick off with what does the thinking in our brains and off we go. This is the atomic unit of thought premise of Part 1. You’ll see many times in which the ideas are inspired by biology and with good intention but starts boil down to mathematical soup of abstractions. Part 1 kind of sets the scene of either glory or utter disappointment for AI depending on how you feel about the Perceptron. In an ideal world, I would have loved to add some discussion on classical philosophy to reflect on us as intelligent beings whilst trying to make machines learn. Perhaps that is another course, the philosophy of AI.
๐ Part 2: Statistical Foundations of ML
The glory of curve-fitting
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Linear regression, Ordinary Least Squares (OLS) and normal equations, gradient descent and Least Mean Squares (LMS), probabilistic interpretation and Maximum Likelihood Estimation (MLE), logistic regression and multi-class softmax classification, information theory, polynomial basis expansion, the bias-variance decomposition and regularisation.
- Demos: ๐น๏ธ Multiple Linear Regression: 3D Plane Fitting
This was probably the most difficult part to design and prepare. It is a mess. Wherever you look, every resource online and book I found made it seem like a simple topic. But I really wanted to get to the bottom of what was going on. The unifying final view that geometry, Bayesian stats and information theory are all the same thing but just different perspectives is one of the most satisfying parts of the course in my opinion. It is dense and I tried many times to remove content but every time I did, you were at the mercy of proof by intimidation by someone who thinks they know what they are talking about. So buckle up, it is a tough part to get through but sets you up for the rest of your career.
๐งช Part 3: Good Machine Learning Practice
Hit the train button and go on holiday
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Problem framing, data preprocessing, dataset partitioning and cross-validation, establishing baselines, classification and regression metrics, hyperparameter tuning, statistical significance, and deployment.
- Demos: ๐น๏ธ Unified Evaluation Metrics Lab
I originally wanted to jump straight into neural networks after statistical foundations like many other ML courses. The link is too strong, you just want to add more and more layers to see what happens. But rock solid theory knowledge rarely translates into success in the ML world. So, Part 3 is about getting your hands dirty and actually doing ML in practice. So I decided to pause the theory and dedicate a whole part on what actually is ML as science and engineering. In particular, I wanted to go beyond the usual practice of just highlighting higher accuracy in bold. All the good ML practice applies whether you are doing linear regression or training a 100 billion parameter LLM. Of course, by now you’d realise that logistic regression is just a single layer neural network. So, the practice is the same but the scale will increase.
โก Part 4: Connectionist Renaissance
We’ll beat the neural networks with a hose until…
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Multi-Layer Perceptrons (MLPs) and feed-forward networks, non-linear activations and resolving XOR, backpropagation and matrix calculus, vanishing and exploding gradients, weight initialisation, modern optimisers, regularisation and normalisation, PyTorch fundamentals, and architectural inductive biases (CNNs, ResNets, RNNs, GRUs, Attention, and Transformers).
- Demos: ๐น๏ธ Backpropagation & Autodiff Studio | ๐น๏ธ 3D Loss Landscape & Modern Optimisers Lab
The big bang people have been waiting for. I had previously delivered parts of this topic back in 2019 so I was prepared for Nuri ML neural nets 2.0. Part 4 does not hold back. We go full in and explore the guts of neural networks until we are sick of it. I wanted to make sure the mystery of neural nets to disappear. As I alluded in Part 1, at this point you’ll either be in awe or just disappointed in matrix multiplying calculators imitating intelligence. We get a full introduction to what I call the model zoo too with a tour of the most popular architectures and their stories.
๐ณ Part 5: Decisions, Decisions
The art of separation
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Decision trees as piecewise-constant functions, top-down greedy induction, splitting criteria, failure modes, pre-pruning and minimal cost-complexity post-pruning, ensemble methods, Bootstrap Aggregation (Bagging) and Random Forests, feature importance (MDI vs. permutation importance), and Gradient Boosted Decision Trees (GBDT).
- Demos: ๐น๏ธ Step-by-Step Decision Tree Induction
There is this worry that decision trees are slowly dying out in the LLM and AI age. But the idea of a decision tree is what matters and that idea could flourish again in the future. So I wanted to cover decision trees not in terms of does it beat neural nets in performance but in terms of appreciating the ideas behind them. I thought, we’re going to do this course once, might as well get to the bottom of this stuff too. So, Part 5 is about giving a different perspective to the neural network story yet they somehow complement each other when we arrive at gradient boosted decision trees.
๐ Part 6: Unsupervised Learning
The art of latent
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Clustering, $k$-Means and Lloyd’s coordinate descent algorithm, $k$-Means++ initialisation, selecting $k$ (elbow method, silhouette analysis), soft clustering with Gaussian Mixture Models (GMMs) and Expectation-Maximisation (EM), model selection with BIC, dimensionality reduction via Principal Component Analysis (PCA) and Singular Value Decomposition (SVD), and non-linear manifold learning with Autoencoders.
- Demos: ๐น๏ธ Clustering Playground: k-Means vs. GMM EM | ๐น๏ธ Interactive PCA Explorer | ๐น๏ธ Interactive Autoencoder Explorer
Unsupervised learning gets thrown around a lot. Oh, we have so much unlabelled data, the future is unsupervised. Actually, it turned out to be self-supervised learning where we create our own labels like predicting the next-token. But why self supervised models learn useful representations relate heavily to the topics we cover in unsupervised learning. The ideas of clustering, similarity, and hidden structure are key to representation learning. Who is similar to who, what is the underlying manifold, and what is the a compressed representation of the data? These are some of the questions we will try to answer in Part 6.
๐ค Part 7: Agency & Evolution
Reinforcement Learning & Evolutionary Computation
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: Agency and animal conditioning, Multi-Armed Bandits and exploration-exploitation strategies, Markov Decision Processes (MDPs), Bellman equations, Temporal Difference (TD) learning and tabular Q-Learning, dopamine as TD error, derivative-free search and evolutionary algorithms (Genetic Algorithms, Evolution Strategies, CMA-ES), novelty search, Quality-Diversity (QD) algorithms, and neuroevolution.
- Demos: ๐น๏ธ Multi-Armed Bandit Playground | ๐น๏ธ Tabular Q-Learning GridWorld | ๐น๏ธ Evolutionary Walkers | ๐น๏ธ Novelty Search Maze
I had doubts whether to include this part in the course at all. Originally, it stretched the course too much and I trimmed it down to just the core of RL and evolutionary computation. I thought, let’s just get rid of it because we are cooked by this point. But it creates such a complete and compelling picture of ML and AI that acts as a strong foundation for whatever you do next. If you skip a full RL course, you’ll still be able to critically think about RL and it’s role in ML; and since that’s the goal, I decided to keep it in. Unlike full RL courses, I tried to keep it grounded in the natural world to keep you engaged about the wider context. Finally, the introduction to AI course I took some decade ago had a strong RL component, so I wanted to pay homage to that and give you a taste of what RL is about.
โ๏ธ Part 8: Ethics & Alignment
Introduction to AI Ethics
- Materials: ๐ Interactive HTML | โ๏ธ PDF | ๐ PDF
- Topics: The bias lifecycle and algorithmic fairness, data privacy and memorisation in LLMs, web scraping and intellectual property/copyright, explainability and the right to explanation, compute and carbon footprint, data annotation labour, misinformation and synthetic media, autonomous system liability, benchmark leakage, and regulation (EU AI Act).
This is completely new, no other ML course I have researched has a dedicated ethics or alignment part. When I first drafted Part 8, I swayed too much into explainable AI but now it is more about immediate concerns and issues that are very easy to relate to. Perhaps, Part 8 is the most important part to be able to critically think about AI and ML as it ventures out into the real world. It is also the shortest part. What does any of this mean? What world do we want to live in? And much more is packed tightly into this part.
If you made it this far and are still reading, you are one step away from enlightenment and can complete the sentence: The meaning of all this is …