Distributions

Dive into Deep Learning · §36.3

Common Probability Distributions: From a Single Coin Flip to the Multivariate Gaussian
Bernoulli & binomial · Poisson & exponential · categorical & softmax · Gaussian & CLT · Laplace · multivariate Gaussian & conditioning

Every Training Loss Is a Probability Distribution

Motivation

  • Loss = Negative Log-Likelihood: Every predictive network implicitly chooses a distribution p(y \mid \hat{y}) for its targets and minimizes -\log p(y \mid \hat{y}).
  • Four canonical pairings: Bernoulli \to binary cross-entropy; Categorical \to multi-class cross-entropy; Gaussian \to squared error (L_2); Laplace \to absolute error (L_1).
  • Beyond point predictions: Misspecifying variance (e.g., Poisson on bursty counts) makes confidence intervals dangerously overconfident.

One Coin Flip Generates the Entire Family Tree

The Generative Lineage

  • Every distribution in this section is constructed from a single \mathrm{Bernoulli}(p) coin flip:
    • Finite sum of n flips: \mathrm{Binomial}(n, p).
    • Rare-event limit (n \to \infty, np \to \lambda): \mathrm{Poisson}(\lambda).
    • Waiting time in a Poisson stream: \mathrm{Exp}(\lambda) (1st arrival) and \mathrm{Gamma}(k, \lambda) (k-th arrival).
    • Random sign \times exponential: \mathrm{Laplace}(\mu, b).
    • Standardized sum (n \to \infty): \mathcal{N}(\mu, \sigma^2) (CLT) and correlated vector \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}).
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Four Discrete Distributions on Our Running Examples

Discrete Probability Mass Functions

  • A discrete PMF assigns mass P(X = k) \ge 0 to countable outcomes with \sum_k P(X = k) = 1:
    1. \mathrm{Bernoulli}(9/13): One flip matching the empirical coin frequency (0.692 vs. 0.308).
    2. \mathrm{Binomial}(13, 1/2): Number of heads in 13 fair flips, peaking at 6 and 7 (\mu = 6.5).
    3. \mathrm{Poisson}(4): Web server requests per minute at rate \lambda = 4, unbounded on \{0, 1, 2, \dots\}.
    4. \mathrm{Categorical}(\mathbf{p}): Four-class softmax distribution from logits \mathbf{z} = (2, 1, 0.1, -1).
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

The Bernoulli Distribution: One Binary Trial

Single 0/1 Outcome

P(X = x) = p^x(1 - p)^{1 - x}, \qquad x \in \{0, 1\}

  • Moments via X^2 = X: \mathbb{E}[X] = p and \mathrm{Var}(X) = \mathbb{E}[X^2] - p^2 = p(1 - p).
  • Variance parabola: \mathrm{Var}(X) = p(1-p) vanishes at p \in \{0, 1\} and peaks at 1/4 = 0.25 for a fair coin (p = 1/2), compared with 0.213 at p = 9/13.

The Binomial Distribution: Counting Heads in n Flips

Sum of Independent Bernoulli Trials

P(X = k) = \binom{n}{k} p^k (1 - p)^{n - k}, \qquad k \in \{0, 1, \dots, n\}

  • Combinatorial structure: \binom{n}{k} distinct orderings of k heads and n-k tails, each having probability p^k(1-p)^{n-k}.
  • Moments from X = \sum_{i=1}^n X_i: \mathbb{E}[X] = np and, by independence, \mathrm{Var}(X) = np(1 - p) (if all 13 flips copied one fair flip, variance would jump 13\times from 3.25 to 42.25).

Factorial-Free Binomial Evaluation via Ratios

Numerical Stability & Unimodality

Evaluating n! overflows 64-bit floats for n > 170. Taking the ratio of consecutive probabilities cancels all factorials:

\frac{P(X = k + 1)}{P(X = k)} = \frac{n - k}{k + 1}\cdot\frac{p}{1 - p}, \qquad P(X = 0) = (1 - p)^n

  • Combinatorial meaning & peak: From k heads, any of n - k tails can flip to a head in k + 1 equivalent ways; the ratio exceeds 1 iff k + 1 < (n + 1)p, proving the binomial rises to a single peak near np.

Factorial-Free Binomial Evaluation via Ratios (cont.)

Numerical Stability & Unimodality

def binomial_pmf(n, p, kmax):
    """P(X=k) for k = 0..kmax, built from P(X=0) by the successive ratio."""
    pmf = [(1 - p) ** n]
    for k in range(kmax):
        pmf.append(pmf[-1] * max(n - k, 0) / (k + 1) * p / (1 - p))
    return np.array(pmf)

n, p = 13, 0.5
pmf = binomial_pmf(n, p, n)
print(f'P(X=9): by the ratio {pmf[9]:.4f}, by counting {math.comb(13, 9) / 2**13:.4f}')
print(f'P(X>=9) = {pmf[9:].sum():.4f}')
print(f'mean np = {n * p}, variance np(1-p) = {n * p * (1 - p)}')
P(X=9): by the ratio 0.0873, by counting 0.0873
P(X>=9) = 0.1334
mean np = 6.5, variance np(1-p) = 3.25

The Law of Rare Events: From Binomial to Poisson

Unbounded Counts in Continuous Time

P(X = k) = \lim_{n \to \infty} \binom{n}{k}\left(\frac{\lambda}{n}\right)^k\left(1 - \frac{\lambda}{n}\right)^{n-k} = \frac{\lambda^k e^{-\lambda}}{k!}

  • Slicing continuous time: Divide a minute into n tiny slots of arrival probability p_n = \lambda/n; as n \to \infty, (1 - \lambda/n)^n \to e^{-\lambda} and \binom{n}{k}n^{-k} \to 1/k!.
  • Mean equals variance: For X \sim \mathrm{Poisson}(\lambda), \mathbb{E}[X] = \mathrm{Var}(X) = \lambda.

Convergence to the Poisson Limit & Overdispersion

Approximation Rate & Modeling Diagnostics

  • Rate of convergence: Total-variation distance \frac{1}{2}\sum_k |P_{\mathrm{Bin}}(k) - P_{\mathrm{Poi}}(k)| shrinks as O(1/n) (0.056 at n=20 \to 0.010 at n=100 \to 0.001 at n=1000).
  • Server traffic at \lambda = 4\text{ req/min}:
    • Silent minute: P(X = 0) = e^{-4} \approx 0.0183.
    • Peak count: P(X = 4) = \frac{4^4}{4!}e^{-4} \approx 0.195.
    • Burst (\ge 10): P(X \ge 10) \approx 0.008.
  • Overdispersion diagnostic: If empirical count variance exceeds the mean (\mathrm{Var} \gg \mathbb{E}), arrival rates fluctuate or cluster (use a Gamma–Poisson / negative binomial mixture instead).

n =   20: total-variation distance 0.056
n =  100: total-variation distance 0.010
n = 1000: total-variation distance 0.001

Categorical, Softmax, and Multinomial Distributions

Multi-Class Labels and Token Counts

A K-class classifier or language model generalizes the Bernoulli coin to K outcomes:

  • Categorical & Softmax (n = 1 draw): Maps unconstrained logits \mathbf{z} \in \mathbb{R}^K to probabilities P(X = k) = p_k: p_k = \frac{e^{z_k}}{\sum_{j=1}^K e^{z_j}}, \qquad -\log P(\mathbf{y}) = -\sum_{k=1}^K y_k \log p_k
  • Discrete Uniform (\mathrm{Unif}\{1, \dots, n\}): p_k = 1/n has mean \frac{n+1}{2} and variance \frac{n^2 - 1}{12} (3.5 and \frac{35}{12} for a die).
  • Multinomial (n independent draws): Tally vector \mathbf{x} = (x_1, \dots, x_K) with \sum_k x_k = n has PMF \frac{n!}{x_1!\cdots x_K!}\prod_{k=1}^K p_k^{x_k}, mean n\mathbf{p}, and covariance n(\mathrm{diag}(\mathbf{p}) - \mathbf{p}\mathbf{p}^\top) (off-diagonals -np_j p_k < 0).

Evaluating softmax on logits \mathbf{z} = (2, 1, 0.1, -1) and verifying frequencies across 10{,}000 draws:

z = np.array([2.0, 1.0, 0.1, -1.0])          # logits for K = 4 classes
p_cat = np.exp(z) / np.exp(z).sum()           # softmax
draws = rng.choice(4, size=10000, p=p_cat)
print('softmax p   =', p_cat.round(3))
print('frequencies =', (np.bincount(draws, minlength=4) / 10000).round(3))
softmax p   = [0.638 0.235 0.095 0.032]
frequencies = [0.639 0.234 0.095 0.033]

The Poisson Process and Exponential Waiting Times

Counts in Windows vs. Gaps Between Arrivals

  • In a continuous-time Poisson process of rate \lambda, the count in any window of length t is N(t) \sim \mathrm{Poisson}(\lambda t).
  • The fundamental duality: The waiting time T until the first request exceeds t if and only if zero requests arrive in [0, t]: P(T > t) = P\bigl(N(t) = 0\bigr) = e^{-\lambda t}, \quad t \ge 0
  • Differentiating F(t) = 1 - e^{-\lambda t} yields the exponential distribution T \sim \mathrm{Exp}(\lambda): p(t) = \lambda e^{-\lambda t} \quad (t \ge 0), \qquad \mathbb{E}[T] = \frac{1}{\lambda}, \qquad \mathrm{Var}(T) = \frac{1}{\lambda^2}
  • At \lambda = 4\text{/min}: mean wait is 15\text{ s}, while median wait F^{-1}(0.5) = \frac{\log 2}{\lambda} is 10.4\text{ s}.
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Memorylessness, Gamma Waits, and Sampling

Continuous-Time Stream Verification

  • Memoryless property: Past waiting time s conveys zero information about remaining wait t: P(T > s + t \mid T > s) = \frac{P(T > s + t)}{P(T > s)} = \frac{e^{-\lambda(s+t)}}{e^{-\lambda s}} = e^{-\lambda t} = P(T > t)
  • Time of the k-th arrival (T_k \sim \mathrm{Gamma}(k, \lambda)): Since T_k > t \iff N(t) \le k - 1, differentiating \sum_{j=0}^{k-1} e^{-\lambda t}\frac{(\lambda t)^j}{j!} telescopes to the Gamma density p(t) = \frac{\beta^\alpha t^{\alpha-1}e^{-\beta t}}{\Gamma(\alpha)} with mean \frac{\alpha}{\beta} and variance \frac{\alpha}{\beta^2}.
  • Inverse-transform sampling (T = -\log(1 - U)/\lambda): Writing 1 - U instead of U \in [0, 1) prevents -\log(0) = \infty:
requests per minute: mean 3.99, variance 4.00
silent minutes 0.0204,   waits over 1 min 0.0191,   e^-4 = 0.0183
mean wait 0.252 min,   minutes with at most 3 requests 0.434

The Continuous Uniform Distribution

Constant Density & Moments

p(x) = \frac{1}{b - a} \mathbf{1}_{x \in [a, b]}, \qquad \mathbb{E}[X] = \frac{a + b}{2}, \qquad \mathrm{Var}(X) = \frac{(b - a)^2}{12}

  • Variance by centering: Shifting [a, b] to [-c, c] with c = (b-a)/2 gives \mathrm{Var}(X) = \int_{-c}^c \frac{y^2}{2c}\,dy = \frac{c^2}{3} = \frac{(b-a)^2}{12}.
  • Key benchmarks: U(0, 1) has variance 1/12; U(-\sqrt{3}, \sqrt{3}) has mean 0 and unit variance 1.

From the Binomial Ratio to the Gaussian Parabola

De Moivre–Laplace Derivation

What shape does \mathrm{Binomial}(n, p) take near its mean np? Set q = 1 - p, measure count k = np + x by its offset x from the mean, and take the logarithm of the successive ratio using \log(1 + \epsilon) \approx \epsilon:

\log\frac{P(X = k + 1)}{P(X = k)} = \log\frac{1 - x/(nq)}{1 + (x + 1)/(np)} \approx -\frac{x}{nq} - \frac{x + 1}{np} = -\frac{x}{npq} - \frac{1}{np}

  • Linear slope \implies parabolic log-probability: Because each unit step in x changes \log P by -\frac{x}{npq}, summing steps integrates to the parabola \log P(X = np + x) \approx C - \frac{x^2}{2npq}, or P(X = np + x) \approx \frac{1}{\sqrt{2\pi npq}}e^{-x^2/(2npq)}:
n =   13: relative error at the peak 1.66%
n =  100: relative error at the peak 0.25%
n = 1000: relative error at the peak 0.03%
n = 13, k = 9: bell 0.0846, exact 0.0873

Gaussian Normalizer, Moments, and Squared Loss

The Polar Coordinate Integral Trick

To normalize the standard Gaussian density \phi(y) = \frac{1}{\sqrt{2\pi}}e^{-y^2/2}, we evaluate I = \int_{-\infty}^\infty e^{-x^2/2}\,dx by squaring it into a 2D integral and switching to polar coordinates (x, y) = (r\cos\theta, r\sin\theta) with dx\,dy = r\,dr\,d\theta:

I^2 = \int_{-\infty}^{\infty}\!\int_{-\infty}^{\infty} e^{-(x^2 + y^2)/2}\,dx\,dy = \int_0^{2\pi}\!\!\int_0^{\infty} e^{-r^2/2}\,r\,dr\,d\theta = 2\pi\bigl[-e^{-r^2/2}\bigr]_0^{\infty} = 2\pi \implies I = \sqrt{2\pi}

  • Unit variance by parts (u = x, dv = xe^{-x^2/2}dx): \int_{-\infty}^{\infty} x^2 \phi(x)\,dx = \frac{1}{\sqrt{2\pi}}\left(\bigl[-xe^{-x^2/2}\bigr]_{-\infty}^{\infty} + \int_{-\infty}^{\infty} e^{-x^2/2}\,dx\right) = 0 + 1 = 1
  • General Gaussian X = \mu + \sigma Y \sim \mathcal{N}(\mu, \sigma^2): Change of variables gives p(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right), whose negative log-likelihood -\log p(y \mid \hat{y}) = \frac{(y - \hat{y})^2}{2\sigma^2} + \frac{1}{2}\log(2\pi\sigma^2) is squared-error loss.

The Central Limit Theorem in Action

Universal Convergence of Standardized Sums

  • Central Limit Theorem (CLT): For any i.i.d. sequence X_1, X_2, \dots with mean \mu and finite variance 0 < \sigma^2 < \infty, the standardized sum S_n = \sum_{i=1}^n X_i converges in distribution to \mathcal{N}(0, 1): \lim_{n \to \infty} P\!\left(\frac{S_n - n\mu}{\sigma\sqrt{n}} \le y\right) = \Phi(y) = \int_{-\infty}^y \phi(u)\,du
  • Watching uniforms become Gaussian: A single U(0, 1) (n=1) is a flat box; n=2 is a triangle; by n=8 and n=32, the standardized sum is visually indistinguishable from \phi(y).
  • Why finite variance is mandatory: Cauchy draws (\sigma^2 = \infty) never converge under averaging.

The Laplace Distribution, L1 Loss, and Heavy Tails

A Random Sign Times an Exponential

  • Construction: Multiply an independent fair sign S \in \{\pm 1\} by an exponential E \sim \mathrm{Exp}(1/b) and shift by \mu to get X = \mu + SE \sim \mathrm{Laplace}(\mu, b): p(x) = \frac{1}{2b}\exp\!\left(-\frac{|x - \mu|}{b}\right)
  • Moments from X = \mu + SE: Since S^2 = 1 and \mathbb{E}[S] = 0, \mathbb{E}[X] = \mu and \mathrm{Var}(X) = \mathbb{E}[E^2] = 2b^2.
  • Role in deep learning:
    • Negative log-density is L_1 / MAE loss |y - \hat{y}|/b (minimized by the outlier-robust sample median).
    • As a weight prior, it yields LASSO \ell_1 regularization \|\mathbf{w}\|_1.
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Simulating Laplace vs. Gaussian Tail Mass

Five Times More Probability Beyond 3σ

At matched variance \sigma^2 = 2b^2, the Laplace tail decays as e^{-|x|/\sigma \cdot \sqrt{2}} rather than e^{-x^2/(2\sigma^2)}, placing P(|X - \mu| > 3\sigma) = e^{-3\sqrt{2}} \approx 1.43\% beyond 3\sigma vs. 0.27\% for a Gaussian (5.3\times heavier):

b, m = 1.0, 200000
lap = rng.choice([-1.0, 1.0], m) * rng.exponential(b, m)   # S * E
sigma = math.sqrt(2) * b                                    # matched sd
gau = rng.normal(0.0, sigma, m)
print(f'sample variances: Laplace {lap.var(ddof=1):.2f}, '
      f'Gaussian {gau.var(ddof=1):.2f}   (2b^2 = 2)')
print(f'P(|X| > 3 sd): Laplace {np.mean(np.abs(lap) > 3 * sigma):.4f}, '
      f'Gaussian {np.mean(np.abs(gau) > 3 * sigma):.4f}')
sample variances: Laplace 1.98, Gaussian 2.00   (2b^2 = 2)
P(|X| > 3 sd): Laplace 0.0140, Gaussian 0.0027

Why squared loss is sensitive to outliers: On a 10\sigma outlier, Gaussian NLL incurs penalty \frac{1}{2}(10)^2 = 50, whereas Laplace NLL incurs 10\sqrt{2} \approx 14.1 with a bounded constant gradient \pm 1/b.

The Multivariate Gaussian and Eigen-Ellipsoids

Geometry of Correlated Random Vectors

  • A vector \mathbf{x} \sim \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) in \mathbb{R}^d with symmetric positive definite covariance \boldsymbol{\Sigma} \succ \mathbf{0} has density: p(\mathbf{x}) = \frac{1}{(2\pi)^{d/2}|\boldsymbol{\Sigma}|^{1/2}}\exp\!\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^\top\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)
  • Spectral diagonalization: Writing \boldsymbol{\Sigma} = \mathbf{V}\mathrm{diag}(\gamma_1, \dots, \gamma_d)\mathbf{V}^\top and rotating to \mathbf{u} = \mathbf{V}^\top(\mathbf{x} - \boldsymbol{\mu}) decouples the exponent into independent 1D Gaussians: (\mathbf{x}-\boldsymbol{\mu})^\top\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu}) = \sum_{i=1}^d \frac{u_i^2}{\gamma_i}
  • Running example \boldsymbol{\Sigma} = \begin{pmatrix}2&1\\1&2\end{pmatrix}: Eigenvectors \mathbf{v}_{1,2} = \frac{1}{\sqrt{2}}(1, \pm 1)^\top have eigenvalues \gamma_1 = 3, \gamma_2 = 1 (45^\circ ellipse with half-axes \propto \sqrt{3} : 1).
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Linear Maps and the Cholesky Reparameterization

Affine Closure & Sampling Correlated Vectors

Proposition (Affine Closure): If \mathbf{x} \sim \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) in \mathbb{R}^d and \mathbf{A} \in \mathbb{R}^{m \times d} has full row rank m \le d, then

\mathbf{A}\mathbf{x} + \mathbf{b} \sim \mathcal{N}\bigl(\mathbf{A}\boldsymbol{\mu} + \mathbf{b},\ \mathbf{A}\boldsymbol{\Sigma}\mathbf{A}^\top\bigr)

  • Sampling via Cholesky factorization (\boldsymbol{\Sigma} = \mathbf{L}\mathbf{L}^\top): Draw standard normal noise \mathbf{z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}_d) and set \mathbf{x} = \boldsymbol{\mu} + \mathbf{L}\mathbf{z}, where \mathbf{L} is lower triangular (\mathbf{L}\mathbf{I}\mathbf{L}^\top = \boldsymbol{\Sigma}). For \boldsymbol{\Sigma} = \begin{pmatrix}2&1\\1&2\end{pmatrix}, \mathbf{L} = \begin{pmatrix}\sqrt{2} & 0 \\ 1/\sqrt{2} & \sqrt{3/2}\end{pmatrix}.
  • The VAE reparameterization trick: Because \mathbf{x} = \boldsymbol{\mu} + \mathbf{L}\mathbf{z} is differentiable with respect to \boldsymbol{\mu} and \mathbf{L} for fixed \mathbf{z}, gradients backpropagate cleanly through stochastic Gaussian layers.
L = [[1.414, 0.0], [0.707, 1.225]]
sample covariance = [[1.99, 0.99], [0.99, 1.99]]
its eigenvalues   = [1.   2.99]

Conditioning a Gaussian Is Linear Regression

The Orthogonal Residual Trick & Schur Complement

Partition \mathbf{x} = (\mathbf{x}_1, \mathbf{x}_2) with mean (\boldsymbol{\mu}_1, \boldsymbol{\mu}_2) and block covariance \boldsymbol{\Sigma} = \begin{pmatrix}\boldsymbol{\Sigma}_{11} & \boldsymbol{\Sigma}_{12} \\ \boldsymbol{\Sigma}_{21} & \boldsymbol{\Sigma}_{22}\end{pmatrix}. Choose the regression matrix \mathbf{B} = \boldsymbol{\Sigma}_{12}\boldsymbol{\Sigma}_{22}^{-1} so the residual \mathbf{r} = \mathbf{x}_1 - \mathbf{B}\mathbf{x}_2 is uncorrelated with \mathbf{x}_2:

\mathrm{Cov}(\mathbf{r}, \mathbf{x}_2) = \boldsymbol{\Sigma}_{12} - \mathbf{B}\boldsymbol{\Sigma}_{22} = \mathbf{0} \implies \mathbf{r} \perp \mathbf{x}_2 \quad \text{(by joint Gaussianity!)}

  • Since \mathbf{x}_1 = \mathbf{r} + \mathbf{B}\mathbf{x}_2 and \mathbf{r} \perp \mathbf{x}_2, conditioning on \mathbf{x}_2 simply shifts \mathbf{r} by \mathbf{B}\mathbf{x}_2, yielding \mathbf{x}_1 \mid \mathbf{x}_2 \sim \mathcal{N}(\boldsymbol{\mu}_{1\mid 2}, \boldsymbol{\Sigma}_{1\mid 2}): \boldsymbol{\mu}_{1\mid 2} = \boldsymbol{\mu}_1 + \boldsymbol{\Sigma}_{12}\boldsymbol{\Sigma}_{22}^{-1}(\mathbf{x}_2 - \boldsymbol{\mu}_2), \qquad \boldsymbol{\Sigma}_{1\mid 2} = \boldsymbol{\Sigma}_{11} - \boldsymbol{\Sigma}_{12}\boldsymbol{\Sigma}_{22}^{-1}\boldsymbol{\Sigma}_{21}
  • Running example (x_2 = 2, B = 1/2): x_1 \mid x_2 = 2 \sim \mathcal{N}\!\left(0 + \frac{1}{2}(2),\ 2 - \frac{1^2}{2}\right) = \mathcal{N}\!\left(1,\ \frac{3}{2}\right):
Cov(r, x2) = -0.003,  Var(r) = 1.499
4091 samples with x2 near 2: mean of x1 0.97, variance 1.52

Concept Check: Poisson Waits, CLT & Conditioning

Check Your Understanding

Test your intuition on three calculations from the distribution catalog:

  1. Poisson counts vs. exponential waits: Requests arrive at a Poisson rate of \lambda = 4 per minute. What is the probability of a silent minute (0 requests), and what is the probability of waiting more than 30 seconds (t = 0.5\text{ min}) for the next request?
  2. Bivariate Gaussian conditioning: Let (X_1, X_2) be jointly Gaussian with mean \mathbf{0}, unit variances \Sigma_{11} = \Sigma_{22} = 1, and correlation \rho \in (-1, 1). What is the conditional distribution X_1 \mid X_2 = x_2?
  3. Why joint Gaussianity matters: If Z \sim \mathcal{N}(0, 1) and S \in \{\pm 1\} is a fair random sign, both Z and Y = SZ are marginally \mathcal{N}(0, 1) with \mathrm{Cov}(Y, Z) = 0. Why isn’t Y \mid Z = 2 distributed as \mathcal{N}(0, 1)?

Answers:

  1. P(N(1) = 0) = \mathbf{e^{-4} \approx 0.0183}. Waiting more than t = 0.5\text{ min} is the event N(0.5) = 0, which has probability e^{-4(0.5)} = \mathbf{e^{-2} \approx 0.1353}.
  2. Here B = \Sigma_{12}\Sigma_{22}^{-1} = \rho, so X_1 \mid X_2 = x_2 \sim \mathcal{N}(\rho x_2,\ 1 - \rho^2). Notice that the conditional variance 1 - \rho^2 never depends on the observed value x_2.
  3. (Y, Z) is not jointly Gaussian (all mass sits on the two lines y = \pm z). Given Z = 2, Y can only take values +2 or -2 with probability 1/2 each.

Summary: Discrete Probability Distributions

Key Takeaways (Part I)

Distribution PMF P(X = k) Mean \mathbb{E}[X] Variance \mathrm{Var}(X) Deep Learning & Modeling Role
\mathrm{Bernoulli}(p) p^x(1-p)^{1-x}, x \in \{0,1\} p p(1-p) Binary classification & binary cross-entropy
\mathrm{Binomial}(n, p) \binom{n}{k}p^k(1-p)^{n-k} np np(1-p) Correct predictions on an n-example test set
\mathrm{Poisson}(\lambda) \lambda^k e^{-\lambda}/k!, k \ge 0 \lambda \lambda Rare-event arrival counts & count regression
\mathrm{Categorical}(\mathbf{p}) p_k = e^{z_k}/\sum_j e^{z_j} \mathbf{p} (one-hot) \mathrm{diag}(\mathbf{p}) - \mathbf{p}\mathbf{p}^\top Multi-class softmax & LLM token prediction
\mathrm{Multinomial}(n, \mathbf{p}) \frac{n!}{x_1!\cdots x_K!}\prod_{k=1}^K p_k^{x_k} n\mathbf{p} n(\mathrm{diag}(\mathbf{p}) - \mathbf{p}\mathbf{p}^\top) Bag-of-words histograms & class count tallies
\mathrm{Unif}\{1, \dots, n\} 1/n \frac{n+1}{2} \frac{n^2 - 1}{12} Random minibatch indexing & shuffling

Summary: Continuous Probability Distributions

Key Takeaways (Part II)

Distribution Density p(x) Mean \mathbb{E}[X] Variance \mathrm{Var}(X) Deep Learning & Modeling Role
\mathrm{Exp}(\lambda) \lambda e^{-\lambda t} (t \ge 0) 1/\lambda 1/\lambda^2 Memoryless inter-arrival waiting times
\mathrm{Gamma}(\alpha, \beta) \frac{\beta^\alpha t^{\alpha-1}e^{-\beta t}}{\Gamma(\alpha)} (t > 0) \alpha/\beta \alpha/\beta^2 Sum of \alpha waits; conjugate prior for rates
\mathrm{Unif}(a, b) \frac{1}{b-a} on [a, b] \frac{a+b}{2} \frac{(b-a)^2}{12} Base RNG seed for inverse-transform sampling
\mathcal{N}(\mu, \sigma^2) \frac{1}{\sqrt{2\pi\sigma^2}}e^{-(x-\mu)^2/(2\sigma^2)} \mu \sigma^2 CLT limit, squared-error loss & weight init
\mathrm{Laplace}(\mu, b) \frac{1}{2b}e^{-\|x-\mu\|/b} \mu 2b^2 Robust L_1 / MAE loss & LASSO \ell_1 sparsity
\mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) (2\pi)^{-d/2}\|\boldsymbol{\Sigma}\|^{-1/2}e^{-\frac{1}{2}\|\mathbf{x}-\boldsymbol{\mu}\|_{\boldsymbol{\Sigma}^{-1}}^2} \boldsymbol{\mu} \boldsymbol{\Sigma} VAE Cholesky reparameterization & GP conditioning