Your technical library
Machine Learning
14 modules · 87 topics
About this book
Machine Learning
This course teaches classical machine learning — everything up to, but not including, neural networks. Given examples, it chooses a family of models, states the error being minimised, derives the procedure that minimises it, judges how well the result will do on data it has not seen, and decides when a simpler or different model wins. Every method is derived rather than asserted: least squares, ridge regression, logistic regression, the support vector machine, AdaBoost, expectation–maximisation and principal component analysis each get a full derivation. The course teaches none of its own mathematics; each lesson names the Mathematics topics it needs.
It is one chain of problems. The learning problem says what learning from examples means, linear regression fits the simplest model, and model selection decides how complex a model should be. Linear classification and nearest neighbours predict categories, and evaluating classifiers measures them honestly; a reader who wants only the core supervised picture can stop there. Margins and kernels builds the support vector machine, learning theory says when good performance on new data can be guaranteed, and trees and ensembles builds decision trees, bagging and boosting.
Unsupervised learning finds structure without labels, and probabilistic modelling treats a model as a probability distribution. The last modules face deployment: distribution shift, when live data differs from training data; interpretability and fairness, for explaining and auditing a model; and case studies that put the pieces together. Deep Learning picks up where this course stops.
87 topics across 14 modules, in dependency order.
This course teaches none of its own mathematics. Calculus, linear algebra, probability, statistics, optimisation and information theory are Mathematics topics, and every lesson names the ones it needs under “Before this topic”. What stays here is machine learning’s own material: risk and empirical risk minimisation, the Bayes-optimal predictor, the estimators and their fitting procedures, evaluation, learning theory, kernels, ensembles and probabilistic models.
87 of 87 topics are authored; the rest are labelled planned and excluded from progress. Glossary and decision-guide entries cover the authored material and grow with the course.
Read at your own pace. Each topic is one continuous page; mark it done as you finish.
Start with 01.1 · What learning is: prediction from examples drawn from a distributionReview what you have finished↷ 0 skipped topics- 01.1What learning is: prediction from examples drawn from a distribution
- 01.2Features: what the model is allowed to see
- 01.3Loss and risk: pricing a hypothesis over the whole distribution
- 01.4The Bayes-optimal predictor: the best any model could do
- 01.5Empirical risk minimisation: the bet that a sample stands in for the world
- 01.6Measuring performance: the held-out estimate and its error bar
- 01.7Cross-validation: honest estimates from finite data
- 02.1Least squares: the closed form and the geometry
- 02.2Regression metrics: MSE, MAE and R² answer different questions
- 02.3Feature scaling: why units change how fast a model fits
- 02.4Least squares is maximum likelihood: the Gaussian noise story
- 02.5Basis expansion: linear in parameters, not in the input
- 02.6Bias–variance: the decomposition behind overfitting
- 02.7Ridge regression: shrinking weights to cut variance
- 02.8Lasso: an ℓ₁ penalty that selects features
- 03.1Model selection: the best validation score is optimistic
- 03.2Comparing models: is the difference real?
- 03.3Hyperparameter search: grid, random and early stopping of bad trials
- 03.4Learning curves: diagnosing bias versus variance from data size
- 03.5Data leakage: information that should not reach training
- 03.6Feature selection: filter, wrapper and embedded methods
- 04.1Linear classifiers: a hyperplane as the decision boundary
- 04.2The perceptron: learning from mistakes, and its mistake bound
- 04.3Logistic regression: a probability model for a binary label
- 04.4Fitting logistic regression: convexity, IRLS, and separable data
- 04.5Generalised linear models: one recipe for linear, logistic and Poisson regression
- 04.6Softmax regression: probabilities over k classes
- 04.7Gaussian discriminant analysis: classifying through Bayes' rule
- 04.8Naive Bayes: assume conditional independence, win anyway
- 04.9Generative versus discriminative: fewer samples or lower asymptotic error
- 06.1Precision, recall and F1: when accuracy lies
- 06.2ROC curves and AUC: judging a ranking across all thresholds
- 06.3Precision–recall curves: evaluating rare positives
- 06.4Proper scoring rules: log loss and Brier score reward honest probabilities
- 06.5Calibration: making predicted probabilities mean what they say
- 06.6Decision thresholds: choosing the operating point by cost
- 06.7Class imbalance: reweighting, resampling, and when neither is needed
- 07.1Support vector machines: maximise the margin
- 07.2The SVM dual: support vectors emerge
- 07.3Soft margins and the hinge loss: when data will not separate
- 07.4Surrogate losses: hinge, logistic, exponential and squared as stand-ins for 0–1
- 07.5The kernel trick: inner products in a feature space you never build
- 07.6The representer theorem: why kernelised solutions live on the data
- 09.1Decision trees: recursive splits on the most informative feature
- 09.2Tree pruning: cost-complexity as regularisation
- 09.3Bagging: averaging bootstrap models to cut variance
- 09.4Random forests: decorrelating trees with random feature subsets
- 09.5AdaBoost: reweight the mistakes, add weighted weak learners
- 09.6Gradient boosting: gradient descent in function space
- 09.7XGBoost and LightGBM: second-order splits and histogram search
- 09.8Stacking: learning how to combine models
- 09.9Choosing a model for tabular data: linear, forest or boosted
- 10.1k-means: alternating assignment and update
- 10.2Gaussian mixtures: soft clusters with probabilities
- 10.3EM: fitting models with hidden variables, and the ELBO
- 10.4Hierarchical clustering: a tree of merges and what linkage decides
- 10.5DBSCAN: clusters as dense regions, with noise
- 10.6Evaluating clusterings: silhouette, stability and external indices
- 10.7PCA: the best linear low-dimensional summary, derived twice
- 10.8t-SNE and UMAP: neighbour embeddings and what they distort
- 10.9Matrix factorisation: recommendation as low-rank completion
- 10.10Anomaly detection: scoring how unusual a point is
- 11.1Bayesian linear regression: a posterior over the weights
- 11.2The marginal likelihood: choosing models by evidence
- 11.3Gaussian processes: a distribution over functions
- 11.4Bayesian optimisation: searching expensive functions with a GP surrogate
- 11.5Bayesian networks: a joint distribution factorised along a graph
- 11.6d-separation: reading conditional independence off a graph
- 11.7Hidden Markov models: a Markov chain you observe through noise
- 11.8Viterbi decoding: the most likely hidden path
- 11.9Baum–Welch: EM for hidden Markov models
- 13.1Interpretable models: what coefficients and trees really say
- 13.2Permutation importance: what the model's accuracy depends on
- 13.3Shapley values and SHAP: attributing one prediction to its features
- 13.4Group fairness metrics: parity, equalised odds and calibration by group
- 13.5Why fairness criteria conflict: the impossibility results
01.2Features: what the model is allowed to see
01.3Loss and risk: pricing a hypothesis over the whole distribution
01.4The Bayes-optimal predictor: the best any model could do
01.5Empirical risk minimisation: the bet that a sample stands in for the world
01.6Measuring performance: the held-out estimate and its error bar
01.7Cross-validation: honest estimates from finite data
02.1Least squares: the closed form and the geometry
02.2Regression metrics: MSE, MAE and R² answer different questions
02.3Feature scaling: why units change how fast a model fits
02.4Least squares is maximum likelihood: the Gaussian noise story
02.5Basis expansion: linear in parameters, not in the input
02.6Bias–variance: the decomposition behind overfitting
02.7Ridge regression: shrinking weights to cut variance
02.8Lasso: an ℓ₁ penalty that selects features
03.1Model selection: the best validation score is optimistic
03.2Comparing models: is the difference real?
03.3Hyperparameter search: grid, random and early stopping of bad trials
03.4Learning curves: diagnosing bias versus variance from data size
03.5Data leakage: information that should not reach training
03.6Feature selection: filter, wrapper and embedded methods
04.1Linear classifiers: a hyperplane as the decision boundary
04.2The perceptron: learning from mistakes, and its mistake bound
04.3Logistic regression: a probability model for a binary label
04.4Fitting logistic regression: convexity, IRLS, and separable data
04.5Generalised linear models: one recipe for linear, logistic and Poisson regression
04.6Softmax regression: probabilities over k classes
04.7Gaussian discriminant analysis: classifying through Bayes' rule
04.8Naive Bayes: assume conditional independence, win anyway
04.9Generative versus discriminative: fewer samples or lower asymptotic error
05.1k-nearest neighbours: predict from the closest examples
05.2The curse of dimensionality: when nearest stops meaning near
06.1Precision, recall and F1: when accuracy lies
06.2ROC curves and AUC: judging a ranking across all thresholds
06.3Precision–recall curves: evaluating rare positives
06.4Proper scoring rules: log loss and Brier score reward honest probabilities
06.5Calibration: making predicted probabilities mean what they say
06.6Decision thresholds: choosing the operating point by cost
06.7Class imbalance: reweighting, resampling, and when neither is needed
07.1Support vector machines: maximise the margin
07.2The SVM dual: support vectors emerge
07.3Soft margins and the hinge loss: when data will not separate
07.4Surrogate losses: hinge, logistic, exponential and squared as stand-ins for 0–1
07.5The kernel trick: inner products in a feature space you never build
07.6The representer theorem: why kernelised solutions live on the data
08.1PAC learning: a generalisation bound for a finite hypothesis class
08.2VC dimension: capacity for infinite hypothesis classes
08.3Capacity control: structural risk minimisation and the classical picture
08.4No free lunch: every learner wins only by assuming something
09.1Decision trees: recursive splits on the most informative feature
09.2Tree pruning: cost-complexity as regularisation
09.3Bagging: averaging bootstrap models to cut variance
09.4Random forests: decorrelating trees with random feature subsets
09.5AdaBoost: reweight the mistakes, add weighted weak learners
09.6Gradient boosting: gradient descent in function space
09.7XGBoost and LightGBM: second-order splits and histogram search
09.8Stacking: learning how to combine models
09.9Choosing a model for tabular data: linear, forest or boosted
10.1k-means: alternating assignment and update
10.2Gaussian mixtures: soft clusters with probabilities
10.3EM: fitting models with hidden variables, and the ELBO
10.4Hierarchical clustering: a tree of merges and what linkage decides
10.5DBSCAN: clusters as dense regions, with noise
10.6Evaluating clusterings: silhouette, stability and external indices
10.7PCA: the best linear low-dimensional summary, derived twice
10.8t-SNE and UMAP: neighbour embeddings and what they distort
10.9Matrix factorisation: recommendation as low-rank completion
10.10Anomaly detection: scoring how unusual a point is
11.1Bayesian linear regression: a posterior over the weights
11.2The marginal likelihood: choosing models by evidence
11.3Gaussian processes: a distribution over functions
11.4Bayesian optimisation: searching expensive functions with a GP surrogate
11.5Bayesian networks: a joint distribution factorised along a graph
11.6d-separation: reading conditional independence off a graph
11.7Hidden Markov models: a Markov chain you observe through noise
11.8Viterbi decoding: the most likely hidden path
11.9Baum–Welch: EM for hidden Markov models
12.1Distribution shift: when deployment stops looking like training
12.2Covariate shift: importance-weighted risk
12.3Label shift: re-estimating the class prior after deployment
13.1Interpretable models: what coefficients and trees really say
13.2Permutation importance: what the model's accuracy depends on
13.3Shapley values and SHAP: attributing one prediction to its features
13.4Group fairness metrics: parity, equalised odds and calibration by group
13.5Why fairness criteria conflict: the impossibility results
14.1Case study: a churn model from schema to monitoring
14.2Case study: error analysis — bias, variance, data or leakage
Skipped topics
Moved past without finishing. A skipped topic still closes its module, and Continue goes on without it — open one to read it or mark it understood.
Glossary
The vocabulary of the authored lessons, grouped by subject and linked to the topic that derives each idea.
Input space
The set of inputs a hypothesis may be asked about.
More detail
Written X. A hypothesis must answer for every element of it, so what the records contain — weekday, temperature, tariff plan — decides which questions a rule can even be asked.
Output space
The set of answers a prediction can take.
More detail
Written Y. Its shape names the task before any model is chosen: a real number for regression, a label for classification, an ordering for ranking.
Hypothesis
A function from input space to output space, committed before it is scored.
More detail
h : X → Y names a rule, not yet a good one — the memorising table and the constant rule are both hypotheses, and the memoriser's perfect record on its own stored rows is the module's first cautionary tale.
Sample
The observed sequence of labelled pairs the learner works from.
More detail
A sequence, not a set: written D = {(x_i, y_i)} for i = 1..n, where repeats matter and each draw must share the world's distribution before it may speak for the future.
i.i.d. assumption
The clause that makes the past informative about the future: independent draws from one fixed distribution.
More detail
Both halves can fail — dependence between consecutive rows, or a distribution that drifts over time — and either route breaks the bridge from a sample average to an expectation.
Supervised learning
Learning a mapping when every example carries its label.
More detail
The labels supervise the search: the sample's (x_i, y_i) pairs are exactly what a loss can score a candidate hypothesis against, which is what makes a training error computable.
Unsupervised learning
Working from inputs alone, with no label to predict.
More detail
The tasks change shape — cluster the rows, or model the distribution that produced them — and there is no y to be wrong about, so the loss-and-risk machinery does not apply directly.
Regression
Predicting a real-valued output.
More detail
On the meter data, predicting tomorrow's kWh — a number whose misses are priced by a continuous loss such as squared or absolute error, not by a count of wrong labels.
Classification
Predicting a label from a finite set of classes.
More detail
On the meter data, predicting whether usage reached 30 kWh — a decision scored by the 0–1 loss, where a near-miss and a wild miss cost identically.
Ranking
Predicting an ordering over candidates rather than a value or a label.
More detail
The deliverable is a sorted list — documents for a query, in the Manning text, which frames it as ordinal regression supervised by relevance judgments on query–document pairs.
Clustering
Grouping inputs into similar clusters with no labels given.
More detail
On the meter data, gathering weekday-like and weekend-like days from temperature and usage alone — unsupervised, so there is no answer key to score against.
Density estimation
Modelling the distribution that produced the inputs themselves.
More detail
The task estimates P(x) — what a typical day looks like — rather than a rule h(x) from inputs to labels; the least supervised of the module's five families.
Feature map
The function turning a raw record into the numeric vector the model sees.
More detail
phi : X → R^d is the contract for what a model may see: two records agreeing on every column are indistinguishable downstream, no matter how different the raw days were.
One-hot encoding
Spending one binary column per category so no order is invented.
More detail
Three tariff plans become three columns with a single 1 — every level equidistant from every other, where an integer code would assert |A − C| = 2|A − B| for free.
Thermometer code
Encoding an ordered band by lighting its first j columns.
More detail
Adjacent levels differ in exactly one coordinate, so the code says where each band sits — warm is at least mild — without claiming the gaps between them are equally sized.
Factored code
An encoding that represents a field by its natural parts separately.
More detail
The date factors into day-of-week and day-of-year; MIT's example factors a blood type into group and Rh sign. The parts, not the label, are what a rule may need to weight.
Cyclic encoding
Representing a cyclic quantity by coordinates that keep neighbours close.
More detail
Day-of-week becomes (sin 2πd/7, cos 2πd/7): every day sits the same distance, 2 sin(π/7) ≈ 0.87, from the next — where an integer puts Monday and Sunday maximally far apart.
Interaction feature
A column computing the product of two features so one can modulate the other.
More detail
Temperature × weekend lets the same reading mean different usage on a Saturday; keep the main-effect columns too, so the product modulates rather than replaces them.
Baseline level
The dummy-coding convention of keeping one fewer column than categories.
More detail
The omitted level is read off the constant term, and the ambiguity is real only when a constant is present — the module's map keeps all three plan columns, since nothing there uses one.
Loss function
The price of a single prediction against its actual outcome.
More detail
ell(g, y) maps one (prediction, truth) pair to a nonnegative number — the per-case bill whose average over the whole distribution is risk.
Squared loss
The loss (g − y)², charging quadratically in the error.
More detail
Doubling a miss quadruples its price, so a few large errors dominate the average — on the three-band table the constant 20 pays 393.5 under it, against 292.5 for the band lookup.
Absolute loss
The loss |g − y|, charging one-for-one with the size of the error.
More detail
Every kWh of miss costs identically, so the average is gentler on extremes than the square — the same constant pays 15.65 here, in kWh rather than kWh².
0–1 loss
The loss that is 1 when g differs from y and 0 otherwise.
More detail
Its risk is exactly the probability of being wrong — the error rate — but as a function of the prediction it is flat almost everywhere, so descent methods read no direction; enumerable classes still minimise it directly, which is why the surrogate question is forwarded for the rest.
Risk
The expected loss of a hypothesis over the whole distribution.
More detail
R(h) = E[ell(h(x), y)] is a property of the triple — hypothesis, distribution, loss — and it cannot be computed, because the distribution is unknown; everything measurable is an estimate of it.
Bayes-optimal predictor
The rule minimising risk pointwise when the conditional law is known.
More detail
Its answer differs per loss — conditional mean under squared, median under absolute, most probable class under 0–1 — and it needs an unconstrained hypothesis, since a class cannot always take each slice's winner.
Bayes risk
The risk of the Bayes-optimal predictor: the floor no rule can beat.
More detail
The floor is scoped to this input space and this distribution, so 'irreducible' is never unqualified — but a deterministic feature map can only hold it or raise it (merging two bands moves the 0–1 floor from 0.425 to 0.475); lowering it takes information the thinner representation lacked, and never goes below the raw record's own floor.
Cost-sensitive decision
Choosing by expected cost when the two ways of being wrong are unequal.
More detail
The optimal rule thresholds the posterior at the cost ratio, not at one half — a missed high day at 5:1 moves the alarm boundary to p > 1/6, at less than half the symmetric rule's expected cost (0.465 against 1.015).
Empirical risk
The average loss of a hypothesis over the sample's rows.
More detail
R̂_n(h) = (1/n) Σ ell(h(x_i), y_i) is the training score — unbiased for R(h) only when h was fixed before the data arrived, never when it won the search.
Empirical risk minimisation
Choosing the class member with the smallest empirical risk.
More detail
The module's whole learning algorithm: replace the expectation by the sample average and take the argmin over H — what the winning score certifies depends entirely on the class's reach.
Hypothesis class
The menu of hypotheses the learner is allowed to choose from.
More detail
Fixed before the data arrive — three constants, twenty-seven band lookups, or the memoriser — and its capacity controls what a low training score certifies about the world's risk: finite size in this module, finer measures when a class is infinite but still learnable.
Inductive bias
The deliberate restriction of the hypothesis class, chosen in advance.
More detail
UML's name for the prejudice that bounds ERM's search — finite in this module's classes — and the only thing standing between the method and a memoriser's worthless perfect score.
Overfitting
A training score the world's risk does not back up.
More detail
In the lesson's tagged-input example, training and test share one joint law. The independent continuous tag lets a memoriser score zero on training rows but match none on fresh draws almost surely; its true risk is the fallback's, with no improvement to the Bayes floor.
Optimism
The winner's training score running below the best achievable risk in the class.
More detail
E[min_h R̂_n(h)] ≤ min_h R(h): a biased-low estimate of the class's best, and — the clause that saves it from overreach — no bound on how far the deployed rule's own risk sits above its score.
Excess risk
The gap between the chosen rule's true risk and the best in its class.
More detail
On the eight-draw sample ERM returned h ≡ 10 at true risk 0.62 while h ≡ 50 offered 0.605 — an excess of 0.015 paid for trusting eight rows.
Held-out set
Rows withheld from fitting and used to price the chosen rule.
More detail
Conditional on the fitted h, its losses are i.i.d. and their mean is unbiased for R(h) — the fixed-hypothesis argument restored by never letting h see the rows.
Validation set
The held-out rows consulted while choosing among candidates.
More detail
Spent freely because the test set is not: it exists to compare rules, and any set used to decide has been promoted out of measurement and into the hypothesis class.
Conditional test error
The risk of this particular fitted rule, estimated by a held-out set.
More detail
ESL's Err_T: a property of the rule in hand, fitted on this training set — not the expected test error, which averages the procedure's risk over the training sets it could have drawn.
Expected test error
The procedure's risk averaged over the training sets it could produce.
More detail
ESL's Err: a property of the recipe, not of one fitted rule. A single split is unbiased for it at its training size, but its usual conditional error bar counts only test-row spread. CV refits on overlapping subsets; it does not automatically estimate the missing training-set variance or provide a valid procedure-level interval.
Standard error of an error rate
The spread of a held-out error rate over repeated test samples.
More detail
For a 0–1 rate it is √(p̂(1−p̂)/m) — the standard deviation of a mean of m Bernoulli losses — and the quantity the ±1.96·SE error bar is built on.
Reported metric
The number published as the rule's performance.
More detail
It need not be the loss the rule was chosen under — an alarm picked at 5:1 can be reported as a plain error rate; the metric must be the one the decision cares about.
k-fold cross-validation
Splitting the rows into k folds, fitting on k−1, scoring the held-out fold, and averaging.
More detail
With i.i.d. rows and equal folds assigned independently of their values, CV_k is unbiased for expected test error at training size (k−1)n/k. Holdout also estimates expected test error at its own training size; CV reuses every row in both roles. Pessimism relative to full-size training requires expected risk to decrease with training size.
Leave-one-out cross-validation
The extreme k = n: each row held out alone, n fits in total.
More detail
Each fit sees n−1 rows, limiting training-size bias when the learning curve changes little near n. Near-identical training sets do not guarantee positive covariance or higher variance than smaller-k CV; uncertainty depends on the procedure and distribution. The computational cost is n fits.
Stratified folds
Folding so each fold carries a similar label mix.
More detail
The eight rows hold two weekend days; a split pocketing both leaves a training set with no weekend at all — stratifying by the flag forces the mix into every fold.
Grouped folds
Folding whole groups together when rows are not independent.
More detail
All readings from one household, or consecutive days of one week, belong on one side of every split — a group divided across folds lets the held-out rows' close relatives train the model.
Leakage
Information from held-out rows reaching the fit.
More detail
Two mechanisms appear in the lessons so far: preprocessing fitted outside the folds, and dependent rows split across them — ESL's wrong-way example reports 3% where the truth is 50%.
Design matrix
The n × d table of feature values the linear model multiplies.
More detail
X stacks the rows' feature vectors, so Xw is the vector of fitted scores and X^T X the Gram summary the normal equations invert. The eight-day meter fit produces the 2 × 2 matrix with determinant 2207 — small enough to solve by hand — and a singular X^T X is a bookkeeping failure (exact collinearity or too few rows), not a missing answer.
Normal equations
The system X^T X ŵ = X^T y that a zero gradient produces.
More detail
Two derivations meet here: setting the gradient of (1/n)‖Xw − y‖² to zero, and projecting y onto the columns' span — residual orthogonality X^T(y − Xŵ) = 0 is what makes them the same answer. The closed form costs O(nd² + d³).
Coefficient of determination
R² = 1 − SSE/SST: squared error relative to the best constant predictor.
More detail
SST is what predicting the mean would pay, so R² measures progress over doing nothing — 0.884 for the worked three-rule comparison. Out of sample it can go negative: a stale constant or a shifted day can lose to the mean outright.
Standardisation
The fitted transform x̃ = (x − μ̂)/σ̂ that puts features on one scale.
More detail
μ̂ and σ̂ are estimated, so the transform is a fitted component and belongs inside the fold like any other. The loss's Hessian rescales by the feature scales squared — metres against millimetres stretches the condition number by 10⁶, and descent zigzags accordingly.
Weighted least squares
Least squares with each row priced by the inverse of its noise variance.
More detail
When σ_i² is known to differ per row, Gaussian maximum likelihood returns ŵ = (X^T W X)^{-1}X^T W y with W = diag(1/σ_i²): quieter rows count more, in exact proportion to their precision. Laplace noise instead returns the absolute loss — the loss was a noise model all along.
Basis function
A fixed transform b_j(x) whose weighted sum stays linear in w.
More detail
Monomials, steps, hinges and truncated powers all feed the same solver: ŷ = Σ w_j b_j(x) keeps the closed form because the new design matrix Φ simply has different columns — linearity lives in the parameters, not the input. Enough columns (p + 1 = n) pin every training point exactly, which is interpolation, not skill.
Bias–variance decomposition
Expected squared error at a point splits into noise, squared bias and variance.
More detail
E_D[(y − f̂_D(x))²] = σ² + (E_D[f̂_D(x)] − f*(x))² + Var_D[f̂_D(x)] — the degree-15 fit's failure lives in the variance column, the degree-1 fit's in bias², and more data buys the variance term down alone. The trade-off is an accounting identity, not a seesaw — and squared loss is the only loss it splits.
Effective degrees of freedom
df(λ) = Σ_j σ_j²/(σ_j² + λ): the ridge dial measured in parameter units.
More detail
In the SVD basis each direction shrinks by σ_j²/(σ_j² + λ), so df goes from d at λ = 0 toward 0 as λ grows — a smooth complexity knob graded in fractions of a parameter rather than a discrete degree count. λ = σ²/τ² is also the noise-to-prior ratio under the Gaussian-prior reading.
Soft threshold
S_λ(z) = sign(z)·max(|z| − λ, 0): the ℓ₁ solution's coordinatewise shape.
More detail
For orthonormal columns the lasso answer is the OLS estimate shrunk toward zero and clipped at it — the subgradient condition |ρ_j| ≤ λ is what lets w_j = 0 be optimal at all. The ℓ₂ analogue never reaches the axis, and the regularisation path it traces as λ sweeps is the sparsity dial.
Selection optimism
The winner's validation score is biased low: E[min_θ R̂_θ] ≤ min_θ E[R̂_θ].
More detail
Fifty identical candidates still produce a winner, and shared validation rows correlate the estimates without removing the effect. The fixes are structural: one untouched test set read once, or nested CV that scores the choosing procedure rather than the chosen model.
Nested cross-validation
An outer CV loop whose training folds each run a whole inner selection.
More detail
The outer scores measure the recipe — choose, then refit — not the model it happened to return, at a price of K_o(K_i|Θ| + 1) + K_f|Θ| + 1 fits (13.08 in the lesson's small worked run). What it does not buy is a verdict on the final candidate itself.
Paired test
Compare per-example losses on the same test rows, not two independent scores.
More detail
d_i = ℓ_A(i) − ℓ_B(i) cancels the test set's luck because both models faced the same days; SE(d̄) = s_d/√m. A t-test across k-fold scores overstates confidence — the folds' training sets overlap — and statistical significance still is not practical significance.
McNemar's test
Under 0–1 loss only the discordant pairs vote: a χ² on n_A versus n_B.
More detail
Agreement cells cancel — the entire difference between two classifiers lives in the days one errs and the other does not. With the continuity correction (|n_A − n_B| − 1)²/(n_A + n_B) it approximates χ²₁; the exact version is a binomial tail.
Random search
Sample hyperparameter points at random rather than on a grid.
More detail
A grid spends its budget re-sampling the unimportant axis; random buys a hit probability instead — P(at least one top-q hit) = 1 − (1 − q)^T, so T ≥ ln(1 − α)/ln(1 − q) trials reach a top-5% setting with confidence α. Search penalty-like knobs on a log scale, where each decade earns equal trials.
Successive halving
Race the candidates on a small budget, promote the best fraction, repeat.
More detail
Each round keeps the top share of the field and multiplies its budget — bad trials die cheap and the total spend stays near one full run's. It lies when a candidate's curve crosses late: a slow starter that would have won is eliminated before it shows.
Learning curve
Training and validation error plotted against training-set size.
More detail
The diagnosis is a shape, not a number: curves converging high together carry the high-bias signature, a persistent gap the high-variance one — the gap prices the estimation error extra data can still buy down. The validation curve's slope prices the next batch before it is bought.
Leakage taxonomy
The four channels across the fold boundary: preprocessing, temporal, target, duplicated entities.
More detail
A scaler fitted on all rows prices the fold it should be blind to; a feature computed from the future answers a different question; a column derived from the label is the answer; and one household's days on both sides of a split are one household. The discipline that blocks all four: everything fitted goes inside the fold.
Filter, wrapper and embedded selection
The three families of feature selection: fixed score, learner-graded subset, selection inside the fit.
More detail
Filters rank a column against the label alone (correlation, mutual information) and miss redundancy; wrappers spend O(d²) fits on forward-stepwise search with CV as the jury; embedded methods — lasso's zeroed weights, a tree's ignored features — arrive free but select for that model only. All three belong inside the fold: screening on all the data first reports pure noise as predictive.
Separating hyperplane
The boundary {x : w^T x + b = 0} where the classifier's score crosses zero.
More detail
w is the boundary's normal and (w^T x + b)/‖w‖ the signed distance to it; absorbing b as an extra coordinate passes the boundary through the origin in d + 1 dimensions. When no such hyperplane exists on the sample the data is not linearly separable — and a sign rule has nothing to return.
Perceptron rule
w ← w + y_i x_i, applied only on a misclassified point.
More detail
Learning only from mistakes turns minimisation into feasibility on separable data, and each update buys that point y_i w^T x_i → y_i w^T x_i + ‖x_i‖². Novikoff's bound caps the mistakes at (R/γ)² — dimension-free, priced in geometry — and on non-separable data the rule cycles forever.
Sigmoid
σ(z) = 1/(1 + e^{−z}): the squashing map from a real score to (0, 1).
More detail
The logistic model asserts the log-odds log(p/(1 − p)) are affine in the features, and the sigmoid is the logit's inverse — a smooth, strictly increasing squash where predicting p = w^T x + b outright would sometimes promise 1.3 or −0.2. The old sign boundary z = 0 is exactly even odds.
Log loss
−[y log p̂ + (1 − y) log(1 − p̂)]: the Bernoulli negative log-likelihood.
More detail
Maximum likelihood supplies the loss, and its gradient X^T(p̂ − y) is a residual — the same shape least squares carried. The 0–1 loss cannot see this fit at all, and the truth is the loss's own favourite: reporting the actual frequency minimises it.
Iteratively reweighted least squares
Newton on the logistic NLL, rearranged into a weighted least-squares solve per step.
More detail
w_{t+1} = (X^T S_t X)^{-1}X^T S_t z_t with S_t = diag(p̂_i(1 − p̂_i)) and working response z_t — each iterate regresses a locally linearised target. Fisher scoring is the same iteration read statistically, and on separable data there is no minimiser: the weights run to infinity unless a quadratic penalty restores one.
Generalised linear model
A three-choice recipe: an exponential-family response, a mean μ = A′(η), a linear predictor η = w^T x.
More detail
Choose the family (Bernoulli, Poisson, Gaussian) and the link; the canonical link wires the natural parameter itself linearly and leaves the score equation a bare residual X^T(μ̂ − y) = 0 — the same certificate OLS carried. One IRLS fitter serves the whole table; offsets, dispersion and the link choice are the freedom it does not spend for you.
Linear discriminant analysis
Gaussian class-conditionals sharing one covariance: the boundary comes out linear.
More detail
The discriminant δ_c(x) = x^TΣ^{-1}μ_c − ½μ_c^TΣ^{-1}μ_c + log π_c is affine in x, and the posterior is a logistic of the score difference — logistic regression's functional form arrived at from the generative side, fitted by the plug-in principle: closed-form counts and averages, no iteration. Give each class its own Σ_c and the discriminant gains −½(x − μ_c)^TΣ_c^{-1}(x − μ_c) — QDA's parabola.
Generative–discriminative crossover
The generative route wins on few samples; the discriminative asymptote never loses.
More detail
Ng–Jordan's comparison: the discriminative model's asymptotic risk is never worse, but it approaches it like √(d/n) where the generative reaches its (higher) floor in samples logarithmic in d — scarce data rewards the stronger assumption. The worked two-synonym text dataset shows the curves crossing exactly as the rates predict.
Naive Bayes assumption
Conditional independence of the features given the class: p(x | c) = ∏_j p(x_j | c).
More detail
The covariance is what does not scale, so the assumption replaces it with per-class marginals — false almost always, and the product still ranks right often. The probabilities are overconfident even when the ranking is right (repeated evidence multiplies), so read the output as a score, not a probability; smoothing — θ̂_jc = (count + α)/(N_c + α|V|) — keeps an unseen word from vetoing a class.
Softmax
P(y = c | x) = e^{z_c}/Σ_j e^{z_j}: the log-odds model with K wires.
More detail
z = Wx carries the logits and the loss is lse(z) − z_y — feed it logits, not probabilities, because raw scores overflow. Only differences are fitted: shifting every logit by a constant changes nothing, so pin a reference class or keep all K rows and regularise. One-vs-rest answers a different question — K independent fits, no shared normaliser — and is the right shape for multi-label data.
k-nearest neighbours
Predict by the k closest training rows: their mode for classification, their mean for regression.
More detail
Nonparametric — nothing is fitted, the sample is the model and prediction pays the whole bill at query time. 'Near' is a norm's opinion: the same records re-measured in different units get different neighbours and a different answer, and a Voronoi cell is what one point's neighbourhood looks like.
Cover–Hart bound
R* ≤ R_{1NN} ≤ 2R*(1 − R*): 1-NN's asymptotic error within twice the Bayes floor.
More detail
The strongest guarantee any simple classifier owns — the nearest neighbour's label is a decent proxy for the point's own, when neighbours are near. In dimension d the premise fails, which is why the bound is asymptotic and the curse is next door.
Curse of dimensionality
In high dimension, local stops being local: a mass-p neighbourhood needs edge length p^{1/d}.
More detail
Three effects compound — a cube holding a fixed share of the mass spans nearly every feature's whole range, the nearest of n points sits near the boundary, and distances concentrate until the farthest is barely farther than the nearest. What survives is low intrinsic dimension — the exponent that matters is the data's own — and models that are not local.
Confusion matrix
The 2 × 2 of TP, FP, FN, TN that a threshold produces from a score.
More detail
Every headline metric is a ratio over these four counts, and each rate conditions on a different half of the table: TPR and FPR on the truth's side (stable under prevalence), precision and NPV on the prediction's side (carrying it). Undefined is a real score — a rule that flags nothing has no precision.
Precision and recall
Precision = TP/(TP + FP) prices the flags; recall = TP/(TP + FN) prices coverage of the positives.
More detail
The fraud-screen worked example inverts two rules' verdict depending on which rate is read — and precision is a posterior, so it carries the prior inside where recall does not. F_β prices the trade as a weighted harmonic mean, and macro-F_1 averages per-class F_1's rather than F_1 of the averaged counts.
ROC curve
The parametric trace (FPR(t), TPR(t)) as the threshold sweeps the score's range.
More detail
Both axes condition on the truth, so prevalence never enters — invariant to the class mix, and blind to what a flag actually costs. Crossing curves mean the better ranker depends on where on the axis you stand, and the convex hull marks which points are optimal under some cost ratio.
AUC
Area under the ROC curve — equal to P(s_+ > s_-), a correct-ranking probability.
More detail
One sorted pass over the audit set computes both the staircase and its area. Equal AUC does not mean equal ranking — two curves can share the area and trade places region by region — and the number says nothing about thresholds or costs.
Precision–recall curve
Precision against recall as the threshold moves, with prevalence inside every point.
More detail
A 1-in-1,000 screener's precision collapses at useful recalls — the moving baseline is the feature, not a defect, showing what ROC's truth-conditioned axes hide exactly when positives are rare. Average precision compresses it to Σ_k (R_k − R_{k−1})P_k, and between two measured points precision is not a straight line — no interpolation.
Proper scoring rule
A score of a probability report that honesty minimises: E_S(q, q) ≤ E_S(p, q).
More detail
Strictly proper makes the truth the unique minimiser: log loss pays the cross-entropy of the report, the Brier score completes the same square. Accuracy and the linear score reward exaggeration, so a thresholded metric never sees the overconfidence a proper score prices.
Calibration
r(p) = E[y | p̂ = p] = p: among cases scored p, the frequency really is p.
More detail
The reliability diagram plots acc(b) against conf(b) per bin and ECE = Σ_b(|b|/n)|acc − conf| prices the gaps; the held-out Brier score splits into calibration plus refinement. Measure and repair on data the model never saw.
Cost-ratio threshold
Flag iff p ≥ t* = (C_FP − C_TN)/((C_FP − C_TN) + (C_FN − C_TP)).
More detail
Every threshold is a claim about costs — the p ≥ ½ default silently prices a false alarm equal to a miss. On the screening table the ratio lands inside a gap in the score's range, and the default can be worse than reviewing everyone; with a headcount instead of costs, the review budget is the threshold.
Class weighting
Price each row by a per-class weight — 'balanced' uses w_c = n/(2n_c).
More detail
Deterministic oversampling applied to the loss rather than the data: same ledger, no synthetic rows. It teaches the model a different prior, so the reported probabilities inherit the artificial mix unless rescaled — and SMOTE's interpolated minorities assume the segment between two rare points is safe to cross.
Functional and geometric margin
γ̂_i = y_i(w^T x_i + b) counts confidence; γ_i = γ̂_i/‖w‖ measures distance.
More detail
The functional margin scales with ‖w‖, the geometric one is invariant — one spare degree of freedom is spent fixing min_i γ̂_i = 1 (the canonical scale), and then maximising the worst-case margin is the quadratic programme min ½‖w‖². The margin hyperplanes are where y_i(w^T x_i + b) = ±1.
Support vector
A point on the margin: α_i > 0 and y_i(w^T x_i + b) = 1 — a constraint that shapes the boundary.
More detail
w* = Σ_i α_i y_i x_i is rebuilt from them alone; complementary slackness zeroes every other multiplier, so solving the dual is a support-set guess and KKT sorts the soft-margin points into free, bounded and interior. Six points in the worked example, and only three of them matter.
Slack variable
ξ_i ≥ 0: margin debt bought back from an infeasible constraint at price C.
More detail
y_i(w^T x_i + b) ≥ 1 − ξ_i lets a point sit inside the margin or past the boundary — ξ_i > 1 is a misclassification under the margin's units. The primal charges C·Σξ_i, the dual merely caps α_i ≤ C, and eliminating the debts reveals the hinge loss that was being minimised all along.
Hinge loss
φ(m) = (1 − m)_+: the surrogate the soft-margin objective was hiding.
More detail
Minimising ½‖w‖² + CΣξ_i over the slacks is exactly minimising Σ(1 − y_i f_i)_+ — margin debt and surrogate loss are one machine read two ways. Its flat region for m ≥ 1 is what buys the sparse dual.
Surrogate loss
A convex upper bound on the 0–1 loss that a descent method can follow.
More detail
On the margin axis each stand-in buys and bills differently: hinge buys sparsity and sells probabilities, logistic buys probabilities and never stops paying, exponential buys smoothness and sells robustness, squared is the only non-monotone entry. Classification-calibrated is the property that the surrogate's minimiser returns the right sign — the four floors over the three-band table show the surcharge each pays.
Kernel
K(x, z) = φ(x)^T φ(z): an inner product in feature space, computed without the map.
More detail
The polynomial kernel (x^T z + c)^p prices p-way interactions in one evaluation; the Gaussian e^{−γ‖x−z‖²} corresponds to an infinite-dimensional φ. The kernel matrix K_ij = K(x_i, x_j) is the quadratic-sized table the method actually pays — fit keeps it, prediction consults it.
Mercer condition
K is a valid kernel iff every Gram matrix it induces is positive semidefinite.
More detail
The test admits kernels without naming φ — and the algebra helps build them: sums, positive scaling, products, g(x)g(z) factors and pointwise limits all preserve it. The older 'Mercer kernel' class is narrower than the PSD kernels used here; for the kernels of this course the tests agree.
Representer theorem
Every regularised empirical-risk minimiser over a kernel class has w = Σ_i α_i φ(x_i).
More detail
Split w into the span of the training images plus a perpendicular part: the loss's inner products cannot see the perpendicular part and the penalty only grows from it, so it must be zero. The objective reduces to functions of the kernel matrix — kernel ridge regression is the theorem's closed form, paying in n rather than the feature dimension.
PAC guarantee
P(R(ĥ) ≤ min_ℋ R + ε) ≥ 1 − δ: a certificate priced in probability over the sample.
More detail
The guarantee is about the sample, not the world — n ≥ (ln|ℋ| + ln(1/δ))/ε rows suffice for a realizable finite class, because a bad rule must look perfect on every draw. The bound is a certificate, not the truth: the worked stumps over a four-point grid show both the union bound and what it buys.
VC dimension
The largest set size the class can shatter — produce all 2^n labellings on.
More detail
Thresholds: 1. Intervals: 2. Half-planes: 3. Axis-aligned rectangles: 4. Hyperplanes in ℝ^d: d + 1 — a property of the class, not its parametrisation. One shattered set gives the lower bound; the no-labelling obstruction gives the upper.
Growth function
Π_ℋ(n) = max over n-point sets of |ℋ restricted to them|: labellings, not hypotheses.
More detail
Infinity overcounts — what matters is how many binary patterns the class produces on n points. Sauer–Shelah bounds it polynomially past the VC dimension d: Π_ℋ(n) ≤ Σ_{i ≤ d} C(n, i), which is what lets d_VC replace ln|ℋ| in the bound.
Structural risk minimisation
Choose h by minimising R̂_n(h) + pen(ℋ_{k(h)}): certify each class, then spend confidence across them.
More detail
Splitting δ across a nested family by a weight function buys one simultaneous bound — the weight schedule is a prior over classes — and bound by bound the choice has a floor, producing the classical U. A norm penalty is a constraint read sideways, and a margin is capacity measured in geometry.
No free lunch
Averaged over all tasks, every learner scores identically — off-training-set error is conserved.
More detail
On any unseen input, half of all labellings refute the prediction; the finite-sample form says some realizable task gives every learner R ≥ 1/8 with probability ≥ 1/7 — the four-point arena counts all sixteen labellings. The theorem buys humility, not nihilism: inductive bias is the only source of advantage.
Impurity
The per-node price Q(S) a split reduces: Gini, entropy, or squared error for regression.
More detail
Gini prices a random guess at the node's own odds, entropy gain is the mutual information between question and label, and misclassification error cannot see purity — a split that only rearranges errors scores zero. The tree predicts the constant of the rectangle you land in: f̂(x) = Σ_m ĉ_m 1[x ∈ R_m] over axis-aligned cells.
Cost-complexity pruning
R_α(T) = R̂(T) + α|T|: tax each leaf, then collapse the weakest link first.
More detail
Early stopping cannot see past the next split, so the tree is grown deep and pruned: the weakest link is the subtree whose collapse costs least per leaf, its break-even α computable exactly, and the nested collapse order is fixed before α is chosen — which is itself a model-selection problem.
Bagging
Bootstrap-resample, refit, average: Var(f̄) = ρσ² + (1 − ρ)σ²/B.
More detail
Independent resamples would drive the variance to zero; the shared sample correlates the trees, so the average floors at ρσ². Each resample leaves about e^{−1} ≈ 36.8% of rows unseen — the out-of-bag set that grades the ensemble without a holdout, slightly pessimistically since each voter saw less data.
Feature lottery
At each node, draw m of the d features and split only among them.
More detail
All the trees' correlation rides through the shared sample; forcing every split to ignore most columns decorrelates the votes, so a forest's variance falls further than bagging's floor. The bias cost is real — a given feature sits a draw out with probability (d − m)/d — and impurity-based importance counts in-sample credit, which is not the same as importance.
AdaBoost
F_M(x) = Σ α_m f_m(x): weak learners added stagewise, each voting α_m = ½ln((1 − e_m)/e_m).
More detail
The exponential loss e^{−yF} turns focus into weight — each round re-weights rows by their current margin, so the training error falls exponentially in rounds on separable data. A stump suffices as the weak learner; the recipe is tied to its loss, which hears label noise as insistence.
Pseudo-residual
r_im = −∂ℓ(g, y_i)/∂g at the current fit: the gradient the next weak learner mimics.
More detail
The loss's gradient is a vector over the n rows, but the model must be a function — so each stage fits a tree to the pseudo-residuals by least squares and prices its leaves γ_jm exactly. Shrinkage ν < 1 scales each stage's contribution, trading steps for stability.
Second-order stage
Approximate each stage's loss by a quadratic in the leaf's output: Σ[g_i f_i + ½h_i f_i²] + γT + ½λΣw_j².
More detail
Then the leaf weight is closed form, w_j* = −G_j/(H_j + λ), and a split's gain is the children-minus-parents score — the fit reduces to accumulated gradient sums, which is what histogram binning, leaf-wise growth, one-side sampling and exclusive feature bundling make fast.
Out-of-fold predictions
Z_im = f_m^{(−F(i))}(x_i): each base learner's prediction on rows it never trained on.
More detail
In-sample predictions leak — a learner's score on its own training rows flatters it — so stacking's level-1 design matrix is built cross-validated. The combiner is a small constrained regression over Z; blending, a single holdout instead of k folds, is the cheaper cousin.
Monotone invariance
A tree's predictions do not change under strictly monotone transforms of a feature.
More detail
A split threshold reads rank order only — take logs, square positives, rescale: nothing moves. A tabular column carries no geometry for a distance to measure, which is why trees hold the tabular benchmark: irrelevant features are filtered, not averaged, and mixed types need no common scale.
Lloyd's algorithm
Alternate assigning points to nearest centres and re-centring: coordinate descent on J.
More detail
Both half-steps decrease J, so the iteration terminates — at a local minimum the six-point grid demonstrates. Nearest-centre regions are Voronoi cells; k-means++ seeds centres far apart with probability ∝ D(x)², skipping the starts that land badly.
Silhouette
s(i) = (b(i) − a(i))/max(a(i), b(i)): how well one point fits its cluster versus the next.
More detail
a is the mean distance to its own cluster, b to the nearest foreign one; the score averages s(i) over all n. The silhouette prefers blobs — a ring around a disk reads poorly — and the elbow heuristic it complements reads the bend in an always-falling SSE curve.
Core point
|N_ε(x)| ≥ minPts: a point with enough neighbours inside radius ε.
More detail
Core points anchor DBSCAN's clusters, border points sit in a core's neighbourhood without owning enough, and noise owns neither — density-reachability chains the rest, so the core partition is order-invariant while contested border points go to whichever cluster arrives first. The k-distance plot's knee chooses ε; one radius cannot serve two densities.
Responsibility
r_ik = P(z_i = k | x_i): the posterior over the hidden component label.
More detail
π_k N(x_i; μ_k, Σ_k) renormalised over the components — softness lives at the boundary, and the effective membership N_k = Σ_i r_ik the M-step divides by need not match the mixing weights. A component pinning a single point drives its variance to zero and the likelihood to infinity: the collapse singularity the fit bounds rather than solves.
Expectation–maximisation
Alternate pricing the hidden labels (E-step) and refitting on the prices (M-step).
More detail
Each step is an exact maximisation that cannot decrease the likelihood — the guarantee buys ascent, not a good answer: the climb is monotone and the summit local, and initialisation is part of the model. At zero variance the responsibilities harden to assignments and the iteration is exactly k-means.
ELBO
ℒ(q, θ) = Σ_z q(z) log p(x, z; θ)/q(z): the bound any guess over hidden labels buys.
More detail
log p(x; θ) = ℒ(q, θ) + KL(q ‖ p(z | x; θ)) — the gap is exactly the KL to the true posterior, so the E-step sets q to that posterior and the M-step maximises the expected complete log Q(θ; θ_old). A decrease after either step is a bug in the code, not the theorem.
Principal component analysis
The k-dimensional affine subspace keeping the most variance — equivalently, the least reconstruction error.
More detail
One SVD of the centred matrix answers both questions: S = X_c^T X_c/n = V(D²/n)V^T, with direction v_j carrying λ_j = d_j²/n of projected variance. The explained-variance ratio ρ_j reads the scree; the Kaiser rule keeps components above the correlation matrix's average. The answer is a subspace, not a signed arrow — and whitening (decorrelate, then equalise) is the same directions made spherical.
t-SNE
Match Student-t map affinities q_ij to Gaussian input affinities p_ij by KL divergence.
More detail
Each point's σ_i is calibrated so its neighbourhood hits a fixed perplexity — the effective neighbour count 2^{H(p_i)} — and the heavy tail buys room in the plane against the crowding problem. Cluster sizes are normalised away and between-cluster distances are free variables: the plot is for hypothesis generation, not evidence.
Alternating least squares
Fix V, solve each u_i as a ridge problem; fix U, solve each v_j; alternate.
More detail
Only the observed entries Ω enter the sums — a ratings matrix is a table of holes — and each half-sweep is an ordinary regularised least squares. Implicit feedback prices presence against absence with a confidence c_ij = 1 + αr_ij: a missing play is weak evidence, not a zero rating.
Isolation forest
Random splits isolate points; anomalies need few: s(x, n) = 2^{−E[h(x)]/c(n)}.
More detail
c(n) = 2H(n − 1) − 2(n − 1)/n is a random tree's mean external depth, making 0.5 unremarkable and 1 immediate. Distance methods mask (a dense anomaly cluster hides its members) and swamp (normals near the crowd look anomalous); isolation replaces distance with depth — the one-day-ten-meters trace scores the spike 0.792.
Linkage
The price tag on a merge: single, complete, group-average or Ward's added SSE.
More detail
Single linkage chains — it merges at the closest pair and can string scattered points together; complete prices the worst pair; average sits between; Ward pays Δ = n_G n_H/(n_G + n_H)·‖μ_G − μ_H‖², the SSE the merge adds. The dendrogram remembers every merge's height, and the Lance–Williams update re-prices the matrix without rescanning it.
Weight posterior
p(w | D) = N(μ_N, Σ_N) with Σ_N = (σ^{-2}X^T X + τ^{-2}I)^{-1}: Gaussian in closed form.
More detail
Prior w ~ N(0, τ²I) plus Gaussian likelihood completes the square; the posterior mean μ_N is exactly the ridge solution with λ = σ²/τ² — the penalty was a prior all along. The predictive law adds x_*^T Σ_N x_* to the noise floor: an interval that widens away from the data.
Marginal likelihood
p(y | X) = ∫p(y | X, w)p(w)dw: the likelihood of the model, parameters integrated out.
More detail
The log evidence splits into a best-fit term minus a complexity term — the Occam penalty lives there, because a flexible model spreads its prior thin. Log-evidence differences are log Bayes factors, empirical Bayes fits the prior's knobs to the evidence itself, and the worked degree sweep shows evidence choosing where fit alone cannot.
Gaussian process
A prior over function values: any finite set of f(x_i) is jointly Gaussian with covariance k(x_i, x_j).
More detail
Conditioning gives the predictive law μ_* = k_*^T K_y^{-1}y, σ_*² = k_{**} − k_*^T K_y^{-1}k_* — the band is prior belief, not measured error. The length-scale ℓ decides how far correlation reaches and the evidence picks it; exactness bills as n³.
Acquisition function
The cheap score the optimiser maximises to choose the next expensive trial.
More detail
Expected improvement EI(x) = (μ(x) − f⁺)Φ(z) + σ(x)φ(z) prices promising means and uncertain ones together — the loop spends computation instead of trials, and still loses to random search when the surrogate's prior is wrong.
Bayesian network
A joint written as a product of small conditionals: p(x) = ∏_i p(x_i | pa_i).
More detail
Missing edges are what the graph saves — the full table is exponential in the variables the factorisation avoids. Fitting the conditional probability tables is counting within rows; ancestral sampling runs the net as a machine for synthetic days; inference sums the hidden variables out. Arrows describe, they do not prove.
Chain, fork and collider
The three ways two edges meet — and which conditioning blocks each.
More detail
Seeing the middle blocks a chain or a fork; a collider is silent until you look at it — then conditioning opens it, the cold explaining away the allergy, and a conditioned descendant opens it just the same. d-separation checks every node on every path: blocked when a non-collider is conditioned, or a collider is unconditioned with no conditioned descendant.
Hidden Markov model
A latent chain z_t with transitions A and emissions b_j(x_t); only the emission is seen.
More detail
Scoring a sequence naively means summing K^T hidden paths — the forward pass prices each prefix once and reuses it: α_t(j) = p(x_1..x_t, z_t = j), computed in K²T. Long products underflow, so every column is rescaled on the way through.
Viterbi decoding
The best single hidden path: argmax over z_{1:T}, not a sum over all of them.
More detail
V_t(j) = b_j(x_t)·max_i[V_{t−1}(i)A_ij] — the forward pass with a max and a memory, ψ_t(j) keeping the winning predecessor for the backtrace. The per-position mode can name an impossible path: decoding is a joint question.
Baum–Welch
EM on a hidden chain: posterior-price every cell and every edge, then recount.
More detail
γ_t(i) = p(z_t = i | x) prices the cell, ξ_t(i, j) = p(z_t = i, z_{t+1} = j | x) the edge — the backward pass is what makes them cheap — and the M-step re-estimates π, A and b with fractional counts. The climb is monotone and the summit is local: initialisation is part of the model.
Covariate shift
p(x) moves while p(y | x) stays: the inputs' law changes under a fixed rule.
More detail
A July model repriced on December rows — the risk certificates were all computed inside one distribution, and the factorisations p(y|x)p(x) versus p(x|y)p(y) name which piece moved. Detection is a two-sample problem over unlabelled streams: a domain classifier's AUC_dom is the statistic that can see it.
Label shift
p(y) moves while p(x | y) stays: a different mix of seasons, the same physics per label.
More detail
Only the class prior drifts, so the correction reweights the posterior at the new mix — provided p(x|y) truly held. Counting predictions is not counting labels, but predictions carry the prior through a known linear map, which is the handle the correction pulls.
Concept drift
p(y | x) itself moves: same days, new physics — and no trace in the inputs.
More detail
The one shift no input statistic can see, since x's law never changed; only the outcome errors over time carry the signal. Monitoring can promise detection of input drift and cannot promise it for meaning drift.
Importance weighting
R̂_w(h) = (1/n)Σ w(x_i)ℓ(h(x_i), y_i) with w(x) = p_test(x)/p_train(x).
More detail
Reweighting retargets the average: E_train[w·ℓ] = E_test[ℓ] under support inclusion — a test region the training never saw cannot be reweighted in. The ratio is a domain posterior up to constants, and the worked two-rule example flips their ranking between training and deployment pricing.
Effective sample size
ESS(w) = (Σw_i)²/Σw_i²: how many rows the weighted sample is really worth.
More detail
Weights are paid for in effective samples — a few huge ratios leave the estimate carried by a handful of rows. Clipping buys rows back at the price of bias, and flattening the ratio is the dial between the two.
Prior-ratio reweighting
q(y | x) ∝ w(y)·p_t(y | x) with w(y) = q(y)/p(y): correct the posterior by the deployed prior's ratio.
More detail
The prediction distribution is the confusion matrix times the deployed prior — counting predictions and solving the linear system recovers q, and the two-class case collapses to a single subtraction. Where the confusion matrix is near-singular the inversion misleads; the EM variant uses posteriors instead of decisions.
Regression coefficient
w_j reads the effect of x_j holding the other coefficients' variables fixed — the unexplained part of its feature.
More detail
The marginal slope of y on x_1 is w_1 + w_2·Cov(x_1, x_2)/Var(x_1): with correlated columns the coefficient prices only the orthogonal remainder, so correlated features flip signs and VIF_j = 1/(1 − R_j²) prices the inflation. Magnitude as importance, selection as discovery, and any causal claim all outrun what the glass box licenses.
Permutation importance
I_j(h) = E_π[R̂_test^{(j,π)}] − R̂_test: the risk increase when column j is shuffled.
More detail
The shuffled rows become impossible inputs and the model reads the copy — that is the measurement. Correlated columns break the shuffle twice, understating a redundant twin, and the repeat variance over π is part of the answer, not noise.
Shapley value
φ_j = Σ_{S ⊆ F∖j}|S|!(|F| − |S| − 1)!/|F|!·[v(S∪j) − v(S)]: the average marginal contribution.
More detail
Efficiency, symmetry, dummy and additivity pin down this one split — the proof builds the game space from unanimity games. 'Not knowing a feature' is a modelling choice: interventional and conditional shuffles answer different questions, and TreeSHAP beats the 2^d sum only by exploiting the model's shape.
Independence
Ŷ ⊥ A: equal acceptance rates across groups — demographic parity.
More detail
The decision ignores the protected attribute entirely; on the lesson's shared-threshold scorecard it fails even for a calibrated score. Fairness through unawareness is not a route — the group coordinate leaks through correlates whether or not the model reads it.
Separation
Ŷ ⊥ A | Y: equal TPR and FPR within each stratum of the truth.
More detail
Equalised odds in full; equal opportunity is the positive half (TPR parity). On the shared-threshold scorecard separation fails asymmetrically — the errors each group pays are different kinds — and a per-group confusion matrix still cannot see inside a score's construction.
Sufficiency
Y ⊥ A | Ŷ: the prediction means the same in every group — predictive parity.
More detail
For a score R rather than a decision the demand is calibration by group: P(Y = 1 | R = r, A = a) = r. Sufficiency is about the map's meaning, not its provenance — the score can be perfectly calibrated per group and still collide with the error-rate criteria.
Chouldechova's identity
FPR = [p/(1 − p)]·[(1 − PPV)/PPV]·(1 − FNR): inside one group, the four rates are not free.
More detail
One line of conditional probability applied twice — bookkeeping, not ethics — and it forces the impossibility: equal PPV and equal error rates across two groups coexist only at equal base rates or a perfect predictor. The COMPAS debate ran exactly along the fault line: the FPR gap and the calibration were both accurately measured.
Decision record
The ledger of what was decided, on what evidence, at each pipeline stage — the actual deliverable.
More detail
Schema, baseline, features, audit, comparison, calibration, threshold, monitoring, explanation: each row names the decision and the numbers that justified it, so a retrain or an audit checks the reasoning, not just the artifact.
Operating point
The score threshold at which a flag is worth its price, set by intervention economics.
More detail
t* = c/(ρV): offer cost over saveable margin. A constraint on how many flags the team can work changes the selection rule (top-k by score), not the price.
Error analysis
Pricing why a deployed model misses before buying any fix.
More detail
The battery: a learning curve's plateau bounds what more data earns, sliced errors locate the mass, a label audit questions the ground truth itself, leakage and shift checks certify the meter, and paired ablations price each component. The four-way spend — data, features, capacity, metric — is answered from priced evidence, not preference.
Ceiling analysis
Plugging ground truth into one pipeline stage to measure its headroom.
More detail
Applied to the label feed in the case study: sampling both disagreement and agreement cells recovered a third of the observed miss — the bug was in the meter, not the model.
Which method do I reach for?
A decision the reader faces, the recommendation, and the topic that derives the trade-off. Model families appear as their lessons are written.
Name the task from the data you have
Read the output's shape: a real number is regression, a label is classification, an ordering is ranking.
More detail
Ask first whether labels exist at all — without them the task is unsupervised (clustering or density estimation) — then what one answer looks like. The shape of Y, not the algorithm, names the task.
Encode an unordered category
Use one-hot: one binary column per category, so no order is invented.
More detail
Three tariff plans become three columns with a single 1 — every level equidistant. An integer code asserts spacing the data never gave; with a constant term, keep k−1 columns and read the baseline off the intercept.
Encode an ordered band
Use a thermometer code: cumulative 1s convey the order without claiming equal gaps.
More detail
Band j of m lights its first j columns, so adjacent levels differ in one coordinate — 'warm is at least mild' without a numeric scale. An integer code would claim unit spacing the bands do not have.
Encode a cyclic quantity
Map it to sine and cosine on the circle so neighbours stay neighbours.
More detail
Weekday d becomes (sin 2πd/7, cos 2πd/7): every day sits the same distance, 2 sin(π/7) ≈ 0.87, from the next. An integer code puts Monday and Sunday maximally far apart.
Let one feature modulate another
Add a product column: the interaction lets one feature scale the other's effect.
More detail
Temperature × weekend lets the same reading mean different usage on a Saturday. Keep the main-effect columns too, so the product modulates rather than replaces them.
Choose a loss for a numeric target
Squared for errors paid quadratically, absolute for one-for-one pricing.
More detail
The choice decides which summary is optimal — squared risk is minimised by the conditional mean, absolute by the median — and a few large misses dominate the square where the absolute shrugs them off.
Choose a loss for a labelled target
Use 0–1 loss: it counts wrong labels, and its risk is the error rate.
More detail
Every wrong label costs 1, near-miss or not — the honest score for classification, but a flat shape descent methods cannot follow; enumerable classes still minimise it directly, which is what ERM does, and the surrogate question is forwarded for the rest.
Judge whether a model is near the best possible
Compare its risk with the Bayes floor: the pointwise minimiser's price.
More detail
On the three-band table the floors are 243.375 squared, 11.25 absolute and 0.425 under 0–1 — the earlier table's band lookup pays 0.55, already behind the best possible before any fitting is discussed.
Set a threshold when the two mistakes cost differently
Threshold the posterior at the cost ratio, not at one half.
More detail
Alarm when the miss's cost-weighted chance beats the false alarm's: at 5:1 the boundary is p > 1/6, and the symmetric rule pays 1.015 where the costed rule pays 0.465.
Report a performance number you can defend
Price the chosen rule once on rows it never saw, and attach the error bar.
More detail
The training score is biased low by construction; a held-out mean of m losses is unbiased for that rule's risk. Consulting the same set for decisions promotes it to a validation set — and the bias returns.
Size a test set for a target precision
Solve the half-width bound: m ≥ 1.96²p̂(1−p̂)/w², rounded up.
More detail
At an 8% error rate, ±0.01 needs 2828 rows and ±0.005 needs 11310 — half the width costs four times the rows. Planning blind, p̂ = 1/2 gives the conservative budget.
Estimate performance when data is scarce
Use k-fold CV — every row held out once, training k−1 times — with k = 5 or 10.
More detail
For equal folds it prices the procedure at (k−1)n/k rows; pessimism relative to full-size training depends on a decreasing learning curve. Shuffle interchangeable rows, stratify scarce levels, and group dependent rows. The naive fold-variance estimate is biased down with positive covariance and up with negative covariance; dependent refits do not automatically yield a valid error bar.
Reach for closed-form least squares when
the design matrix is well-conditioned and modest: X^T X inverts once at O(nd² + d³).
More detail
The normal equations give the exact minimiser in one solve; at large d, or where an iterative fit is anyway the machinery, gradient descent replaces it — and then the features' scales set the step count through the Hessian's condition number.
Standardise before
distance- or penalty-based fitting; skip it for closed-form OLS.
More detail
OLS's predictions do not change under rescaling the columns; a norm penalty's price and a distance's notion of near both do — metres against millimetres multiplies the condition number by 10⁶. Fit the scaler on the training rows and carry it inside the fold.
Add basis functions when
the truth has shape a line cannot: polynomials for smooth curves, hinges for corners.
More detail
The solver is unchanged — ŷ = Σw_jb_j(x) is still linear in w — but p + 1 = n interpolates the noise, so pair the expansion with a penalty or a validation choice of degree.
Diagnose a bad fit as
bias or variance before paying for more complexity or more data.
More detail
The decomposition σ² + bias² + Var splits the expected error: high training error is the bias signature and buys nothing from extra rows; a train–test gap is variance, which data does buy down.
Pick a linear penalty by
what you want the weights to do: ridge shrinks every coefficient and keeps it; lasso selects.
More detail
The quadratic penalty is rotation-friendly, never zeroes a weight, and fades effective degrees of freedom smoothly; the ℓ₁ ball's corners put weights at exactly zero — selection inside the fit — but among correlated twins it picks arbitrarily, where the elastic net shares the credit.
Trust the winning validation score
never as the final estimate — selection optimism makes it biased low.
More detail
Reserve a test set touched once, or score the whole choosing procedure by nested CV; among candidates within one standard error of the best, take the simplest — overlapping CV error bars mean the edge is often noise.
Compare two models on
paired per-example losses on the same test rows, not two independent CV runs.
More detail
d_i = ℓ_A(i) − ℓ_B(i) cancels the test set's luck; for 0–1 losses McNemar counts only the discordant pairs; a t-test over fold scores overstates confidence because the training sets overlap.
Search hyperparameters
at random on log scales when a few knobs matter; successive-halve to kill bad trials early.
More detail
A grid re-samples the useless axis; random covers all axes per trial — T ≥ ln(1 − α)/ln(1 − q) trials buy a top-q hit at confidence α. Halving wins when curves separate early; it lies for slow starters that cross late.
Keep a fold honest by
fitting every transform inside it, splitting time forward and groups whole.
More detail
The four leak channels — preprocessing fitted outside, features from the future, label-derived columns, repeated entities across the split — are all blocked by the same rule: the pipeline is one composite object, fitted on the fold's training share only.
Select features with
a filter for a cheap screen, a wrapper when the learner's verdict is worth O(d²) fits, an embedded method when the model already selects.
More detail
Whatever the family, run the screen inside the CV loop — selecting on all rows and then validating reports pure noise as predictive (0.548 against 0.048 in the lesson's simulation).
Reach for logistic regression when
you need a probability, not just a sign.
More detail
The perceptron and the SVM return verdicts; the logistic fit prices confidence — the price is that its log loss keeps charging overconfidence forever. And always fit it penalised: on separable data the unpenalised weights run to infinity.
Pick the generative route when
data is scarce, the factorisation is plausible, or p(x) itself is needed.
More detail
The generative model reaches its asymptote in roughly log(d) samples where the discriminative approaches its better floor like √(d/n) — the worked two-synonym dataset shows the curves crossing; plentiful data forgives the weaker assumption.
Use naive Bayes when
you need a fast count-based text classifier and can read its output as a score.
More detail
Conditional independence is false almost always, yet the ranking survives; the probabilities are overconfident because repeated evidence multiplies — smooth the tables (α pseudo-counts), and calibrate before the scores mean anything.
Pick softmax over one-vs-rest when
the classes are exclusive — one question with K answers.
More detail
Softmax's logits share a normaliser, so the outputs form a distribution over a partition; one-vs-rest trains K independent questions and suits multi-label data where labels are not exclusive.
Reach for k-NN when
the boundary is local, d is small, and search cost at query time is acceptable.
More detail
Nothing is trained — the sample is the model, and Cover–Hart guarantees asymptotic risk within twice the Bayes floor. Standardise first: 'near' is a norm's opinion, and in high dimension the nearest point stops being near.
Report a rate conditioned on
the truth (TPR/FPR) for a stable spec, the prediction (precision/PPV) for what a flag means.
More detail
Truth-conditioned rates ignore prevalence; prediction-conditioned ones carry it — the fraud screen's two rules swap verdicts depending on which is read, and F_β exists to price the trade explicitly.
Judge a ranker on
ROC/AUC when the class mix is stable; precision–recall when positives are rare.
More detail
AUC = P(s_+ > s_-) never sees prevalence — a feature for comparing rankers, a blind spot for pricing a deployed alert. The PR curve's moving baseline is the information: it shows what ROC hides exactly when a 1-in-1,000 screener is the question.
Score a probability report with
a strictly proper rule — log loss or Brier — never a thresholded accuracy.
More detail
Only proper rules make honesty the unique minimiser; accuracy and the linear score reward exaggeration. The Brier decomposition splits what you pay for miscalibration from what the forecast's resolution earns back — climatology is the anchor to beat.
Repair a miscalibrated model with
Platt scaling when data is thin and the distortion is sigmoid-shaped; isotonic when it is not and rows are plentiful.
More detail
Both are one more fit, on a calibration set the model never saw — Platt spends two parameters, isotonic spends monotonicity alone and can conform to any repair shape.
Handle class imbalance by
class weights first — deterministic oversampling in the loss — and SMOTE only where the learner cannot take weights.
More detail
Both teach the model a different prior, so rescale the reported probabilities afterwards or the scores inherit the artificial mix; SMOTE's interpolated minorities further assume the segment between two rare points is safe to cross.
Ask the dual for
which points shaped the boundary — or a window to kernelise through.
More detail
The dual sees the data only as inner products and prices n unknowns against the primal's d + 1, flipping the cost once a feature map inflates d; α_i > 0 names the support vectors the boundary depends on.
Choose a surrogate by
what it buys: hinge for sparsity, logistic for probabilities, exponential for smoothness, squared for a closed form.
More detail
Each sells something too — hinge sells probabilities, logistic never stops paying, exponential sells robustness to label noise, squared alone is non-monotone. Classification calibration is the guarantee that the minimiser returns the right sign.
Kernelise when
the boundary needs curvature and the inner-product view stays cheap — accepting the n² Gram table.
More detail
Polynomial kernels price finite interaction order in one evaluation; the Gaussian's feature map is infinite-dimensional. Any proposed kernel must induce positive-semidefinite Gram matrices — the Mercer condition — or it is not one.
Choose capacity by
structural risk minimisation: certify each nested class, then let the bound's U pick the winner.
More detail
Splitting δ across classes by a weight schedule buys one simultaneous guarantee; a norm penalty is the same control read as a Lagrange multiplier, and a margin is capacity measured in geometry.
Read no-free-lunch as
choose the class before the data: inductive bias is the only source of advantage.
More detail
Averaged over all tasks every learner ties — some realizable task gives any learner R ≥ 1/8 with probability ≥ 1/7 — so an apparent algorithmic edge is a bet on which tasks are real, not a free lunch.
Prune a tree rather than
stop early: grow deep, then collapse the weakest link at leaf price α.
More detail
Early stopping cannot see past the next split; cost-complexity R̂(T) + α|T| prices each leaf, and the collapse order is computable exactly before α is chosen — which is itself a model-selection problem.
Bag a high-variance learner — and lottery the features when
resampling alone cannot decorrelate the trees: one dominant column keeps winning every split.
More detail
Bagging's variance falls as ρσ² + (1 − ρ)σ²/B and floors at the shared-sample correlation — the out-of-bag rows are a free validation set. The random forest's per-node lottery of m of d columns breaks that correlation, at a real bias cost: a given feature sits a draw out with probability (d − m)/d.
Boost when
the base learner is biased rather than noisy: stages fit what the running sum still misses.
More detail
AdaBoost's exponential loss re-weights by the margin and hears label noise as insistence; gradient boosting takes any differentiable loss via pseudo-residuals, with shrinkage ν trading steps for stability. At scale, the quadratic stage — leaf weights −G/(H + λ), splits scanned over histogram bins, leaf-wise growth — is what makes exact split search affordable.
Stack models when
the members' errors differ and k refits per learner are affordable.
More detail
The combiner must train on out-of-fold predictions — in-sample scores leak into the level-1 matrix; a single holdout (blending) is the cheaper cousin when the refits are too dear.
Cluster with k-means when
clusters are convex blobs of one size and scale — and seed with k-means++.
More detail
Lloyd's iteration descends J to a local minimum, so the start matters; the squared distance inherits the metric (standardise first) and the objective never chooses k — that choice stays yours. Where points sit between clusters, a Gaussian mixture's responsibilities price the boundary softly — at zero variance it is k-means — but watch the collapse singularity: a component pinned to one point makes the likelihood unbounded.
Pick a cluster count by
elbow, silhouette, stability and a reference index together — no single criterion is a verdict.
More detail
SSE always falls, so the elbow reads the bend; the silhouette prefers blobs; bootstrap agreement prices repeatability not correctness; ARI needs a reference partition that is itself a choice.
Reach for DBSCAN when
clusters are dense islands separated by noise, all at one density.
More detail
The ε–minPts rule sorts points into core, border and noise; the k-distance plot's knee sets ε. One radius cannot serve two densities — that is hierarchical density's territory (HDBSCAN).
Reduce dimension with
PCA when variance and readable axes matter; t-SNE when a picture of neighbourhoods is the deliverable.
More detail
PCA answers with a subspace and explained-variance accounts; t-SNE normalises cluster sizes away and frees between-cluster distances — a hypothesis generator, not evidence.
Flag anomalies with
a density score when a model fits, neighbour distance without one, an isolation forest when masking matters.
More detail
A dense anomaly cluster hides its members from density and distance scores (masking) and marks normals near the crowd (swamping); isolation replaces distance with depth — s = 2^{−E[h]/c(n)} — and with almost no labels, judge the ranker by precision@k.
Go Bayesian on the weights when
intervals on the coefficients or the prediction are needed, not just the fit.
More detail
The posterior is closed form and ridge is its mean — the same answer with an honest uncertainty statement attached; at the boundary, where a distribution over functions is wanted, the Gaussian process takes over.
Reach for a Gaussian process when
n is small, the function is smooth, and exactness can be bought at n³.
More detail
The kernel is the prior — the model is the covariance you assert; the evidence picks the length-scale and noise. The band is prior belief, not measured error, and the cubic solve is the price of no approximation.
Factor a joint with a Bayes net when
the domain has a causal order and small readable conditionals are wanted.
More detail
Missing edges are the saving — the full joint is exponential in the variables the factorisation avoids; inference sums hidden variables out, exact but priced by the table widths.
Check before conditioning on
anything in a causal diagram — d-separation decides whether a path is open.
More detail
Conditioning on a collider or its descendant opens a path that was closed: 'adjust for X' can create the bias it was meant to remove. Enumerate paths; each is blocked by a conditioned non-collider or an unconditioned collider.
Model a sequence with an HMM when
the state is hidden but Markovian and emissions are all that is observed.
More detail
The forward pass prices a sequence in K²T, Viterbi decodes the single best path with a max and a memory, and Baum–Welch fits the tables on fractional counts — the climb is monotone, the summit local, so initialisation is part of the model.
Name the shift before correcting it
Factorise p(x, y) first: covariate shift moves p(x), label shift p(y), concept drift p(y|x).
More detail
The remedy depends on which piece walked — reweight the rows, re-prior the posterior, or retrain outright. A domain classifier's AUC detects input moves; concept drift leaves no trace in the inputs at all.
Correct covariate shift by
importance weights p_test/p_train — then check the ESS before trusting the estimate.
More detail
Support inclusion is load-bearing: a region of the test distribution the training never saw cannot be reweighted in; clipping the ratios buys effective rows back at the price of bias.
Correct label shift by
solving p(ŷ) = C·q for the deployed prior, then reweighting each posterior by q(y)/p(y).
More detail
Count predictions, not labels — the confusion matrix maps the deployed prior to the deployed prediction mix; the two-class case is one subtraction, and a near-singular C makes the inversion unreliable.
Read a glass box as
a set of conditional statements: a coefficient prices its feature's unexplained part, not its importance.
More detail
Correlated columns flip signs and inflate variances — VIF prices it — and the fitted structure is one draw of the data, so a tree's path or a weight's rank is a sample, not a mechanism.
Measure importance by
permutation for a cheap held-out answer, Shapley when a consistent split is required.
More detail
Permutation importance understates correlated twins twice over; Shapley's axioms pin one answer but 'not knowing a feature' is a modelling choice — interventional and conditional versions answer different questions.
Demand fairness criteria
one at a time, and say which harm each prices: independence the decision rate, separation the error rates, sufficiency the meaning of a score.
More detail
Fairness through unawareness is not a route — the attribute leaks through correlates — and each criterion can be bought only by trading another; a per-group confusion matrix still cannot see inside a score's construction.
Price a fairness collision with
Chouldechova's identity, then make the value judgement explicitly.
More detail
Equal PPV and equal error rates across groups coexist only at equal base rates or a perfect predictor — the COMPAS dispute ran exactly along this fault line. Relaxing one criterion is a choice; the mathematics can only price it.
Judge a flagging policy by its ledger, not its accuracy
At a rare positive class, expected value is the metric; accuracy scores the wrong exam.
More detail
Predict all-stay and accuracy looks superb while the value is zero. Price flags instead: caught positives times saveable margin minus flags times offer cost, and flag only above c/(ρV).
Diagnose the miss before spending on the model
Run the cheap diagnostics — curve, slices, label audit, leakage checks — before buying data, features, or capacity.
More detail
The case study's observed gap decomposed into label-feed bugs, a leaked split and a shifted mix; the model was fine. A bigger model bought against a corrupted plateau wastes the budget on the wrong component.