Machine Learning Notes — start here

Track 1 is six notes read in one order: fit a line to numbers, bend it into a probability, stack it into a network, generalise it to many classes, learn to tell when it is going wrong, and finally look at the one model family that works a completely different way. Track 2 takes the labels away — clustering and anomaly detection — and needs almost nothing from track 1 beyond note 1.

In one line. Read them 1 → 6. Each note opens and closes with a strip telling you where you are and what comes next, so you never have to come back here to keep going — but this page is the map when you do. Two appendices sit outside the path.

The reading path
1 · Linear regression
Fitting a line, and training it. The squared-error cost, gradient descent in full, feature scaling, polynomial features, the normal equation. Everything later runs on this machinery.
2 · Logistic regression
The same model bent into a probability: the sigmoid, why squared error has to go, the log loss, decision boundaries. This is one neuron.
3 · The network reference
The core document, four parts: one neuron → a shallow network → deep networks → the component-level view of backpropagation. Longest note by far; read a part at a time.
4 · Multiclass and the softmax
From two classes to $N$: the softmax, cross-entropy, one-hot targets, numerical stability (from_logits=True), multi-label vs multiclass, Adam.
5 · Developing a model
How to tell what is wrong and what to do about it: train/cv/test, bias vs variance, learning curves, the remedies, error analysis, the project cycle, precision and recall.
6 · Decision trees, forests, boosting
The model that does not use gradient descent at all: entropy and information gain, continuous splits, regression trees, random forests, XGBoost, and trees vs networks.

Why this order

Each note is written assuming the one before it. The dependencies are real, not decorative:

Everything is cross-linked, so a forward reference you meet early is always one click away.


Where the big one splits

Note 3 is a reference, not a lecture — 41 sections in four parts. Jump straight in:

  1. Part I · The single neuron — §1–16: binary classification, the sigmoid, the loss and cost, derivatives and the computation graph, gradient descent for one neuron, vectorization, broadcasting.
  2. Part II · The shallow network — §17–26: layer notation, forward propagation, vectorizing across $m$ examples, activation functions and their derivatives, the backprop equations, random initialization.
  3. Part III · Deep networks — §27–35: $L$-layer notation, matrix dimensions, why depth helps, blocks and caches, parameters vs hyperparameters.
  4. Part IV · The component view — §36–40: backpropagation derived entry by entry — the scalar chain rule, the sum over paths, and collecting it back into the matrix equations.
  5. §41 · Where this goes next — regularization, optimization, tuning: what a Part V would cover.

Find it fast

This table is the curated version — the topics worth having a fixed home. For anything else, the search box at the top reads the actual text of every note here and shows you the section it lives in.

Looking for It is in
Gradient descent, the learning rate $\alpha$, convergence 1 · linear regression
Feature scaling, mean normalization, z-score 1 · linear regression
Polynomial features, the normal equation 1 · linear regression
The sigmoid, log loss, decision boundary, log-odds 2 · logistic regression
Regularization and weight decay 1 and 2, then reference Part I
Forward propagation, one neuron to a layer reference Part I–II
Backpropagation — the equations reference Part II
Backpropagation — derived entry by entry reference Part IV
Activation functions and their derivatives reference Part II
Matrix dimensions in an $L$-layer network reference Part III
Softmax, cross-entropy, one-hot, from_logits 4 · multiclass
Adam, multi-label vs multiclass 4 · multiclass
Train/cv/test, bias vs variance, learning curves 5 · model development
Error analysis, data augmentation, transfer learning 5 · model development
Precision, recall, $F_1$, skewed datasets 5 · model development
Entropy, information gain, one-hot for trees 6 · decision trees
Random forests, XGBoost, trees vs networks 6 · decision trees
k-means, centroids, distortion, choosing $K$ unsupervised 1 · clustering
The Gaussian, density estimation, the threshold $\epsilon$ unsupervised 2 · anomaly detection
Anomaly detection vs a classifier (fraud vs spam) unsupervised 2 · anomaly detection
Ratings matrices, $r(i,j)$ and $y^{(i,j)}$, cold start recommenders · collaborative filtering
Learning item features from ratings alone recommenders · collaborative filtering
"People who liked this also liked", related items recommenders · collaborative filtering
Return, discount factor $\gamma$, policies RL 1 · foundations
$Q(s,a)$, $V^\ast(s)$, the Bellman equation, MDPs RL 1 · foundations
Replay buffer, DQN loop, target networks RL 2 · deep Q-learning
$\varepsilon$-greedy exploration and annealing RL 2 · deep Q-learning

The appendices — the long way round on backprop

These two are not part of the numbered path, and nothing later depends on them. They were written before the reference and were then merged into its Part IV — so Part IV is the live copy and the one to read first. What survives here is length: Part IV states the derivation, these two walk it, one index and one figure at a time. Read them when Part IV moves faster than you want it to, and read A before B.

Appendix A · Backpropagation, step by step
The plain-language version: the chain rule stated before any symbols appear, the sum over paths argument for why a shared neuron accumulates gradient from every branch it feeds, a per-neuron backward zoom, and a colour-coded backflow figure. One figure per stage.
Appendix B · Forward and backward, entry by entry
The index-level version: notation conventions, forward propagation for a single example and then for all $m$ at once, the matrices written out entry by entry, bias broadcasting, and the multi-output seed. This is where a shape you don't believe gets checked.

If you only read one: Part IV. It is the same derivation, kept current, and it is numbered into the reference's cross-reference scheme. The appendices are kept because deleting a longer explanation you might still want is a bad trade.


Track 2 · Unsupervised learning

Everything in the reading path above was supervised: every training example arrived with the answer attached. This track drops the answers. The data is just $\vec{x}$, and the question changes from "predict $y$" to "what is the structure here?" The two notes ask it two ways: which points belong together, and which points do not belong at all.

Assumes: note 1 (feature scaling, and what a cost function is). Nothing else — you can read this straight after the reading path, or before the network reference if you prefer.

1 · Clustering and k-means
Two steps repeated until nothing moves: assign each point to its nearest centroid, move each centroid to the mean of its points. The distortion $J$, why both steps lower it, local optima and multiple restarts, and how to choose $K$ (and why not by minimising $J$).
2 · Anomaly detection
The other question about unlabelled data: which points do not belong? The Gaussian, maximum-likelihood fitting, the independence product over features, choosing $\epsilon$ on a cross-validation set that holds a handful of labelled failures, and when to use this instead of a classifier.

Track 3 · Recommender systems

A third shape of problem: not "predict $y$ from $\vec{x}$", and not "find the structure in $\vec{x}$", but fill in a matrix that is mostly empty. Users rate a few items each, and everything interesting is in the entries nobody supplied.

Assumes: note 1 (it is a linear regression per user) and note 2 for the binary-label variant. Reading track 2 first helps — the item-similarity computation is the same squared distance k-means uses.

1 · Collaborative filtering
The ratings matrix and its holes, predicting with known item features, the cost function per user and over all users, then the step that makes it collaborative: learning the item features and the user parameters at the same time, from ratings alone. Ends with related items as a distance computation.

Track 4 · Reinforcement learning

No dataset at all. An agent acts, the world answers with a number, and nobody ever says which action was right — the reward for a good decision may arrive hundreds of steps after the decision was made.

Assumes: notes 1 and 3 (gradient descent, and a network to approximate a function with). Nothing from tracks 2 or 3.

1 · Foundations
The Mars rover: states, actions, rewards and the $(s, a, R, s')$ tuple; the discounted return and what $\gamma$ does to it; policies; the Markov decision process; the state-action value $Q^\ast(s,a)$ and the Bellman equation; and what changes when actions sometimes slip.
2 · Deep Q-learning
When the state is a vector and no table can be stored: approximating $Q$ with a network, turning Bellman into a supervised target, the replay buffer and the DQN loop, $\varepsilon$-greedy exploration, and target networks with Polyak averaging. Worked on the lunar lander.

As this grows

Track 2 is the pattern for everything that follows. A new subject gets its own track with its own numbering rather than becoming notes 7, 8, 9 — because the dependencies are not a single line, and "note 9 of 12" would claim an ordering that isn't real: a note on policy gradients does not need decision trees.

So this page grows a section per track, each with its own cards and its own "what it assumes" line, and the strip at the top of every note says which track it is in and where. The reading path stays exactly what it is — the way in, for anyone starting from nothing.

That source is now fully covered — all 55 pages of it, across tracks 2, 3 and 4. The next addition will come from new material, and the obvious candidate is deep learning: convolutions, sequences, attention. It gets a dl- prefix and a section of its own here.

The folder name survives all of that: deep learning and reinforcement learning are machine learning. It only becomes wrong if something that isn't turns up here.


Not reading material

CLAUDE.md is the authoring guide for this folder (house style, the verify loop, the gotchas), build-reference.py is the one-time script that bootstrapped the reference — do not rerun it, it predates Parts III and IV — and images/ holds the figures the notes embed.

Browsing. /files lists every note the server can see, which is the quickest way in when you don't know the filename.