Phase 2 of 7 · 17 topics
Classical ML, built by you
Build every classic algorithm yourself in NumPy. After this phase, a library is only a shortcut for something you already understand.
Classical ML is a toolbox of different tools for one job: learning a pattern from examples. Build each tool once by hand, and you will know which one to pick, and why.
Core resources for this phase
-
Video
StatQuest: machine learning videos Free
Optional. Short videos, one algorithm each, if you want a second explanation of a topic.
-
Notes
Stanford CS229 lecture notes (Andrew Ng) Free
Optional, for depth: the full maths behind each algorithm. Get the main notes PDF from the course site.
-
Book
An Introduction to Statistical Learning, Python edition (ISLP) Free
Clear and careful. Read the chapters. Do the labs in NumPy, not scikit-learn.
Topics, in order
-
2.1 The ML setup: features, labels, loss, train/validation/test
-
Watch
A Gentle Introduction to Machine Learning
StatQuest (Josh Starmer)
-
Interactive
Train, Test, and Validation Sets
MLU-Explain (Amazon) · animated, scroll through it
Worth it: A short, colourful scroll-through story of why the data is split three ways and what goes wrong when it isn't.
-
Read
An Introduction to Statistical Learning (Python), Ch 2
James, Witten, Hastie, Tibshirani, Taylor · free
- Read
-
Watch
-
2.2 Linear regression: normal equation and gradient descent
-
Watch
Linear Regression, Clearly Explained
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: Watch the line, the residuals and the error update as you scroll. A visual version of this whole topic.
-
Read
ISLP, Ch 3 (linear regression)
free book
-
Read
Mathematics for Machine Learning, Ch 9 (linear regression)
Deisenroth, Faisal, Ong · free
-
Watch
-
2.3 Logistic regression and the sigmoid
-
Watch
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: The sigmoid, the decision boundary and the log-loss drawn and redrawn as you scroll. The best picture of this model on the web.
-
Read
ISLP, Ch 4 (logistic regression)
free book
- Read
-
Watch
-
2.4 Regularisation: L1 and L2
-
Watch
Regularization Part 1: Ridge (L2) Regression
StatQuest (Josh Starmer)
-
Watch
Regularization Part 2: Lasso (L1) Regression
StatQuest (Josh Starmer)
- Read
-
Watch
-
2.5 Bias–variance trade-off and overfitting
-
Watch
Machine Learning Fundamentals: Bias and Variance
StatQuest (Josh Starmer)
-
Watch
Bias–variance trade-off lecture
Kilian Weinberger, Cornell CS4780
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: Models of growing complexity wobble and settle on screen as you scroll, with the error curves drawn alongside. Exactly this topic, as moving pictures.
-
Read
ISLP, Ch 2 (the bias–variance trade-off)
free book
-
Watch
-
2.6 Metrics: precision, recall, F1, ROC-AUC, confusion matrix
-
Watch
ROC and AUC, Clearly Explained
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, interactive
Worth it: Drag the threshold and watch the confusion matrix and the ROC curve change together. The trade-off becomes something you can feel.
-
Interactive
MLU-Explain (Amazon) · animated, interactive
-
Read
Classification: accuracy, recall, precision and related metrics
Google ML Crash Course
-
Watch
-
2.7 Cross-validation and data leakage
-
Watch
Machine Learning Fundamentals: Cross Validation
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: Folds slide into place and rotate as you scroll, with k-fold, leave-one-out and grouped versions side by side.
- Read
-
Read
Intermediate Machine Learning: data leakage
Kaggle Learn
-
Watch
-
2.8 Feature scaling and encoding
-
Read
Working with numerical data (normalisation)
Google ML Crash Course
-
Read
Working with categorical data (one-hot encoding)
Google ML Crash Course
-
Read
Intermediate Machine Learning: categorical variables
Kaggle Learn
-
Read
-
2.9 k-nearest neighbours
-
Watch
K-nearest neighbors, Clearly Explained
StatQuest (Josh Starmer)
-
Watch
k-nearest neighbours and the curse of dimensionality
Kilian Weinberger, Cornell CS4780
- Read
-
Watch
-
2.10 Decision trees: entropy and Gini
-
Watch
Decision and Classification Trees, Clearly Explained
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: A tree grows split by split on screen while the data is carved into regions. The clearest moving picture of how trees choose questions.
-
Interactive
A Visual Introduction to Machine Learning
R2D3 · an animated story you scroll through
- Read
-
Watch
-
2.11 Ensembles: bagging, random forests, gradient boosting
-
Watch
StatQuest (Josh Starmer)
-
Watch
StatQuest (Josh Starmer)
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: Bootstrap samples, many trees and their vote, animated step by step. It shows exactly why averaging different trees works.
- Read
-
Watch
-
2.12 Support vector machines: margin and hinge loss
-
Watch
Support Vector Machines Part 1 (of 3): Main Ideas
StatQuest (Josh Starmer)
-
Watch
Learning: Support Vector Machines
Patrick Winston, MIT 6.034
-
Read
ISLP, Ch 9 (support vector machines)
free book
-
Watch
-
2.13 Naive Bayes
-
Watch
Naive Bayes, Clearly Explained
StatQuest (Josh Starmer)
-
Read
free book
-
Read
Speech and Language Processing: the Naive Bayes chapter
Jurafsky and Martin · free
-
Watch
-
2.14 k-means clustering
-
Watch
StatQuest (Josh Starmer)
-
Interactive
Visualizing K-Means Clustering
Naftali Harris · interactive
Worth it: Pick a dataset, drop the centres yourself, and step through assign and move. You will also see exactly where k-means fails.
-
Read
ISLP, Ch 12 (k-means clustering)
free book
-
Watch
-
2.15 PCA in practice
-
Watch
StatQuest (Josh Starmer)
-
Interactive
Principal Component Analysis, explained visually
Setosa · drag the points yourself
- Read
-
Read
Mathematics for Machine Learning, Ch 10 (PCA)
Deisenroth, Faisal, Ong · free
-
Watch
-
2.16 Gaussian mixture models and EM
-
Watch
Victor Lavrenko
-
Read
Mathematics for Machine Learning, Ch 11 (Gaussian mixture models)
Deisenroth, Faisal, Ong · free
-
Read
Pattern Recognition and Machine Learning, Ch 9 (mixture models and EM)
Christopher Bishop · free PDF
-
Watch
-
2.17 Generalisation: VC dimension and double descent
-
Interactive
MLU-Explain (Amazon) · animated, scroll through it
Worth it: The error curve rises, peaks at the interpolation threshold and falls again, animated alongside the fitted models. It makes a strange result intuitive.
- Read
-
Read
Understanding Machine Learning, Ch 2–6 (PAC learning, VC dimension)
Shalev-Shwartz and Ben-David · free
-
Paper
Nakkiran et al. · arXiv · optional
-
Interactive
Go deeper (optional)
-
Video
Stanford CS229 lectures (Andrew Ng, 2018) Free
The full lectures, if you want the notes explained out loud.
-
Course
Machine Learning Specialization, Course 1 (Andrew Ng)
Very gentle. The labs use NumPy. Skip the later TensorFlow parts.
-
Book
Probabilistic Machine Learning: An Introduction (Kevin Murphy) Free
A deep reference for going further.
-
Practice
Implement ML algorithms from scratch, interview style.