On Lines and Planes of Closest Fit to Systems of Points in Space
Karl Pearson
Metadata checked
Machine-learning notation becomes useful when every symbol has a geometric, probabilistic, or statistical meaning. This chapter develops that language around the operations that recur in models and papers; it is not a requirement to finish an entire mathematics degree before training a model.
Latest literature discovery audit: 2 October 2026. Existing paper reviews retain their individual source-check dates.
You should be comfortable with high-school algebra, functions, summation notation, and basic Python. Use the official NumPy documentation to practice shapes, broadcasting, indexing, and numerical data types alongside this chapter.
After this chapter, you should be able to:
Let X ∈ R^(n×d) contain n observations and d measured features. A supervised
target may be y ∈ R^n, and model parameters may be collected in θ. Keep four
levels separate:
Writing E[X] for a population expectation and x̄ for a sample mean prevents many
conceptual errors. A dataset is not the population, and a network probability is not
automatically a calibrated probability of correctness.
A vector is both an ordered list and a point or direction in a vector space. A matrix
A ∈ R^(m×d) represents a linear map from R^d to R^m. Matrix multiplication is
composition: if B ∈ R^(k×m), then BA maps R^d → R^k.
Track:
xᵀy measures signed alignment in Euclidean space;||x||₂ measures Euclidean length, while ||x||₁ and matrix norms impose
different geometry;Tensor dimensions are semantic contracts. In attention, for example, a product that is algebraically legal can still be scientifically wrong if it mixes patients instead of tokens.
For a square matrix, Av = λv identifies a direction preserved by the transformation.
The singular-value decomposition works for any matrix:
X = U Σ Vᵀ.The right singular vectors give feature-space directions, singular values give their
strength, and left singular vectors give observation coordinates. For centred data,
the first k principal components solve a reconstruction problem:
min over rank-k X̂ ||X - X̂||²_F.PCA is a linear variance-preserving projection, not a guarantee that visible clusters are biological classes. Standardization, outliers, batch effects, and the observation unit all change its result.
For a scalar function f: R^d → R, the gradient ∇f points in the direction of
steepest local increase under Euclidean geometry. A Jacobian contains partial
derivatives for a vector-valued function; a Hessian contains second derivatives of a
scalar function.
For a composition z = f(g(x)), the chain rule composes local derivatives. Backward
automatic differentiation evaluates vector–Jacobian products from a scalar loss toward
the inputs and parameters. It is an efficient application of the chain rule, not a
numerical approximation.
Forward mode propagates Jacobian–vector products and is efficient when there are few input directions; reverse mode propagates vector–Jacobian products and is efficient for a scalar loss with many parameters. Both operate on a recorded computation graph and differ from symbolic differentiation and finite differences. The automatic-differentiation survey connects these modes to backpropagation and differentiable programming.
For logits z = Wx + b, softmax probabilities
p_j = exp(z_j) / Σ_k exp(z_k)and one-hot target y, cross-entropy is L = -Σ_j y_j log p_j. The derivative with
respect to the logits is p - y; gradients for W follow by the chain rule. In code,
subtract max(z) before exponentiation to avoid overflow without changing the result.
For one parameter direction v, compare the analytic directional derivative with
[f(θ + εv) - f(θ - εv)] / (2ε).Large ε has truncation error; tiny ε has floating-point cancellation. Gradient
checking diagnoses an implementation at selected points—it does not prove the model or
objective is correct.
Probability represents uncertainty under a model. Joint, marginal, and conditional distributions answer different questions:
p(a | b) = p(b | a) p(a) / p(b).Reversing p(disease | test) and p(test | disease) ignores the base rate. In ML,
the same error appears when a class-conditional score is interpreted as a posterior
without specifying class prevalence.
Expectation is a distribution-weighted average. Variance measures squared deviation from the mean. Covariance records linear co-variation, and the covariance matrix must be positive semidefinite. Independence implies zero covariance when moments exist, but zero covariance does not generally imply independence.
The law of total expectation and law of total variance are useful for separating sources of uncertainty across sites, patients, and repeated measurements.
Given observations D, likelihood treats p(D | θ) as a function of θ. Maximum
likelihood estimates
θ̂_ML = arg maxθ log p(D | θ),while maximum a posteriori estimation adds log p(θ). A Bayesian posterior
p(θ | D) represents uncertainty over parameters under the model and prior. A
posterior predictive integrates predictions over that posterior.
Regularization may correspond to a prior in a particular probabilistic formulation, but the optimization penalty, prior belief, and resulting uncertainty statement should not be conflated automatically.
If an expectation is analytically unavailable, samples can approximate it. Record the sampling distribution, dependence between samples, effective sample size, and Monte Carlo error. Resampling data with the wrong unit—tiles instead of patients, for example—produces falsely narrow uncertainty.
An estimator’s bias is the difference between its expected estimate and the target quantity. Its variance measures change across hypothetical repeated samples. Model approximation, finite-sample estimation, label noise, and irreducible outcome variation are distinct sources of error.
The familiar bias–variance picture is a guide, not a complete theory of modern overparameterized networks. Always return to the population, estimator, sampling process, and loss being analyzed.
A frequentist confidence procedure has long-run coverage under repeated sampling and its assumptions; it is not the posterior probability that this realized interval contains a fixed parameter.
For ML comparisons:
Bootstrap intervals are flexible but are not assumption-free. Small samples, rare events, clustering, and site structure may require stratified, clustered, hierarchical, or exact procedures.
For a discrete distribution p, entropy is
H(p) = -Σ_x p(x) log p(x).Cross-entropy H(p, q) = -Σ p log q measures coding or predictive loss when q
approximates p. KL divergence
KL(p || q) = Σ_x p(x) log[p(x)/q(x)]is asymmetric and is not a distance. The identity H(p, q) = H(p) + KL(p || q)
explains why minimizing expected cross-entropy recovers the target distribution when
the model family and optimization allow it.
Mutual information measures departure from independence:
I(X;Y) = KL(p(x,y) || p(x)p(y)).Estimating mutual information in high dimensions is difficult. A lower bound or proxy objective should not be reported as the true information shared by representations.
An unconstrained problem minimizes f(θ); a constrained problem also requires
g_i(θ) ≤ 0 or h_j(θ) = 0. Convexity makes every local minimum global, but most
neural-network parameterizations are non-convex. Lagrangians and duality turn
constraints into analyzable objectives and underpin SVMs, entropy-constrained models,
and many fairness or resource constraints.
Gradient descent uses local first-order information. Newton and quasi-Newton methods use curvature. Stochastic optimization uses noisy estimates of the full gradient. Convergence of the optimization objective and generalization to new data remain different questions.
| Order | Level | Resource or primary reading · year · status | Read it for |
|---|---|---|---|
| 1 | L0–L1 | MIT 18.06 Linear Algebra — official MIT OpenCourseWare | vector spaces, systems, eigenvalues, and positive-definite matrices |
| 2 | L1 | Mathematics for Machine Learning — 2020 · Cambridge University Press book, author-hosted PDF | a direct bridge from linear algebra, geometry, calculus, probability, and optimization into ML |
| 3 | L1–L2 | Convex Optimization — 2004 · Cambridge University Press book, author-hosted | convex sets/functions, duality, constrained optimization, and algorithms |
| 4 | L1–L2 | Automatic Differentiation in Machine Learning: a Survey — 2018 · JMLR, peer reviewed | forward/reverse accumulation, computation graphs, and the relation to backpropagation |
| 5 | L1–L2 | Maximum Likelihood from Incomplete Data via the EM Algorithm — 1977 · JRSS Series B (journal) | latent variables, expected complete-data objectives, and iterative estimation |
| 6 | L2 | A Mathematical Theory of Communication — 1948 · Bell System Technical Journal (journal) | entropy and information as formal quantities rather than metaphors |
| 7 | L1–L3 | Probabilistic Machine Learning: An Introduction — 2022 · MIT Press book | a common notation for probability, prediction, inference, and decision making |
| 8 | L2–L3 | Probabilistic Machine Learning: Advanced Topics — 2023 · MIT Press book; author-maintained draft | variational inference, Monte Carlo methods, deep probabilistic models, and decisions |
Read textbooks for connected explanation and primary papers for the original claim, assumptions, and evidence. A primary paper is not always the best first tutorial.
Use a small synthetic dataset whose generating process you know.
k changes.ε.Record the random-number generator, dtype, tolerance, sample unit, and every shape.
Without notes, answer:
KL(p || q) different from KL(q || p)?Take one loss function from a current paper. Define every random variable and tensor shape, derive its gradient with respect to the model output, state the estimator and population target, and identify the assumptions behind its reported uncertainty. Then continue to classical machine learning or deep learning.
6 canonical readings · 1901–2025· route reviewed through October 2, 2026.
This is the complete structured list for this chapter, ordered chronologically from earlier foundations toward current work. The explanatory ladder above highlights the shortest conceptual route; this list also includes important branches, benchmarks, and current endpoints. It is generated from the same deduplicated catalog used by the AI background registry and My Library, so a future catalog update appears here automatically.
Karl Pearson
Metadata checked
Claude E. Shannon
Metadata checked
Herbert Robbins and Sutton Monro
Metadata checked
Arthur P. Dempster, Nan M. Laird, and Donald B. Rubin
Metadata checked
Atilim Gunes Baydin, Barak A. Pearlmutter, Alexey Andreyevich Radul, and Jeffrey Mark Siskind
Metadata checked
Lahav Dabah and Tom Tirer
Official artifacts: Final proceedings PDF · Author implementation · Author manuscript
Metadata checked