1.4 Probability and statistics
1. Learn
Section titled “1. Learn”- Mathematics for Machine Learning (Deisenroth, Faisal, Ong)§6.1–6.4 Probability spaces through Summary Statistics and Independence (pp. 172–197), §6.5 Gaussian Distribution (pp. 197–205), §6.7 Change of Variables/Inverse Transform (pp. 214–221)
- Mathematics for Machine Learning (Deisenroth, Faisal, Ong)§8.3 Parameter Estimation, maximum likelihood (pp. 265–272)
- Seeing Theory (Brown University)chapters 1–3: Basic Probability, Compound Probability, Probability Distributions
2. Bridge
Section titled “2. Bridge”Models in this course output distributions, and losses are built from their probabilities, so you need to compute with them fluently.
A random variable has a probability mass function (discrete) or a density (continuous). The expectation expectationThe average of f(x) when x is drawn from p: ∑ p(x) f(x), or ∫ p(x) f(x) dx.Introduced in 1.4 Probability and statistics. is a probability-weighted average, and the variance is the expected squared distance from the mean meanThe mean (expected value) of a distribution.Introduced in 1.4 Probability and statistics. (MML §6.4). For vectors, the covariance matrix covariance matrixΣ_{ij} = Cov(x_i, x_j). Symmetric and positive semi-definite.Introduced in 1.4 Probability and statistics. Not to be confused with the summation sign ∑, or with the diagonal matrix of singular values in the SVD A = UΣVᵀ, which shares the symbol. MML §10 writes the data covariance as S. collects every pair’s covariance. It is symmetric and positive semi-definite.
The Gaussian GaussianNormal distribution with mean μ and variance σ² (the second argument is a variance, not a standard deviation).Introduced in 1.4 Probability and statistics. Some code libraries (numpy.random.normal) take the standard deviation instead. is the default: a sum of many small independent effects tends towards one (the central limit theorem, which you can watch below), and it has closed forms for almost everything (MML §6.5).
Sampling from uniforms. Computers give you uniform random numbers, and everything else is a transform of them. The inverse transform pushes through the inverse CDF: for an exponential, (MML §6.7). The Gaussian CDF has no closed-form inverse, so Box–Muller turns two uniforms into two independent standard normals with a polar trick (Box and Muller, 1958). For a multivariate Gaussian, factor (Cholesky, MML §4.3) and set . Then . The covariance widget shows exactly this.
Maximum likelihood picks the parameters under which the observed data is most probable. Maximise the log likelihood: products become sums and the optimum stays put (MML §8.3.1). For a Gaussian, the answer is the sample mean and the variance that divides by . That MLE is slightly biased. The unbiased estimate divides by , and the tests check which one you used. Module 2.4 derives the standard loss functions this way.
3. Explore
Section titled “3. Explore”Implement Box–Muller, inverse-CDF exponential sampling, the Gaussian MLE and log likelihood, the multivariate MLE, and Cholesky sampling. Some tests are statistical: they use fixed seeds and enough samples to make random failures essentially impossible.
stubs/m1_4_probability.pyLoading starter file…
Prefer your own editor? Edit exercises/stubs/m1_4_probability.py and run mlc check 1.4. The tests are identical; import the results on the progress page.
Locally: mlc check 1.4.
5. Check
Section titled “5. Check”- not yet: All tests pass (0/?)
- not yet: Checkpoint quiz ≥ 80%
Learner log: time spent and points of confusion
Every confusion you note becomes a fix before the module is marked stable. Export it from the progress page and attach it to an issue.