Probabilistic Models

Last updated: August 2026

Disclaimer: These are my personal notes compiled for my own reference and learning. They may contain errors, incomplete information, or personal interpretations. While I strive for accuracy, these notes are not peer-reviewed and should not be considered authoritative sources. Please consult official textbooks, research papers, or other reliable sources for academic or professional purposes.

1. Random variables, expectation, and variance

Definitions

For a random variable $X$ with density $f$: $E[X]=\int xf(x)\,dx$; $\mathrm{Var}(X)=E\big[(X-E[X])^2\big]$. $X,Y$ are independent if $f_{X,Y}(x,y)=f_X(x)f_Y(y)$.

Theorem (Linearity of expectation)

$E[aX+bY]=aE[X]+bE[Y]$ for any random variables $X,Y$ — independence is not required.

Proof. $E[aX+bY]=\iint(ax+by)f_{X,Y}(x,y)\,dx\,dy=a\iint xf_{X,Y}\,dx\,dy+b\iint yf_{X,Y}\,dx\,dy=aE[X]+bE[Y]$, using linearity of the integral itself (integration note, Section 4) and integrating out the unused variable in each piece.
Theorem

$\mathrm{Var}(X)=E[X^2]-E[X]^2$; if $X,Y$ independent, $E[XY]=E[X]E[Y]$ and $\mathrm{Var}(X+Y)=\mathrm{Var}(X)+\mathrm{Var}(Y)$.

Proof. Expand $(X-E[X])^2=X^2-2XE[X]+E[X]^2$ and apply linearity (treating the constant $E[X]$ as a scalar multiplier): $E[X^2]-2E[X]^2+E[X]^2=E[X^2]-E[X]^2$. For independent $X,Y$: $E[XY]=\iint xyf_X(x)f_Y(y)\,dx\,dy=\Big(\int xf_X\,dx\Big)\Big(\int yf_Y\,dy\Big)=E[X]E[Y]$ (Fubini's theorem, multivariable calculus note, Section 10, separates the double integral into a product). Then $\mathrm{Var}(X+Y)=E[(X+Y)^2]-E[X+Y]^2=E[X^2]+2E[XY]+E[Y^2]-\big(E[X]+E[Y]\big)^2$; substituting $E[XY]=E[X]E[Y]$, the cross terms cancel exactly, leaving $\big(E[X^2]-E[X]^2\big)+\big(E[Y^2]-E[Y]^2\big)=\mathrm{Var}(X)+\mathrm{Var}(Y)$.

This last identity is not an abstract curiosity: it is exactly the computation behind the neural networks note's derivation of Xavier and He initialization (its Section 6), where $z=\sum_iW_ix_i$ is a sum of independent mean-zero terms and this section's variance-additivity is the entire mechanism making $\mathrm{Var}(z)=n\,\sigma_W^2\sigma_x^2$ provable rather than asserted.

2. The Weak Law of Large Numbers, via Chebyshev's inequality

Theorem (Markov's inequality)

If $X\geq0$ and $a>0$, then $P(X\geq a)\leq E[X]/a$.

Proof. $E[X]=\int_0^\infty xf(x)\,dx\geq\int_a^\infty xf(x)\,dx\geq a\int_a^\infty f(x)\,dx=aP(X\geq a)$, using monotonicity of the integral (integration note, Section 4) twice: dropping the $[0,a)$ portion (nonnegative integrand) and then bounding $x\geq a$ on the remaining piece.
Theorem (Chebyshev's inequality)

$P\big(|X-E[X]|\geq a\big)\leq\mathrm{Var}(X)/a^2$.

Proof. Apply Markov's inequality to the nonnegative random variable $(X-E[X])^2$ with threshold $a^2$: $P\big((X-E[X])^2\geq a^2\big)\leq E[(X-E[X])^2]/a^2=\mathrm{Var}(X)/a^2$. The event $(X-E[X])^2\geq a^2$ is exactly $|X-E[X]|\geq a$.
Theorem (Weak Law of Large Numbers)

If $X_1,\ldots,X_n$ are i.i.d. with mean $\mu$ and variance $\sigma^2<\infty$, and $\bar X_n=\frac1n\sum_iX_i$, then for every $\epsilon>0$: $P(|\bar X_n-\mu|\geq\epsilon)\to0$ as $n\to\infty$.

Proof. By linearity (Section 1), $E[\bar X_n]=\mu$. By independence and Section 1's variance-additivity, $\mathrm{Var}(\bar X_n)=\frac1{n^2}\sum_i\mathrm{Var}(X_i)=\sigma^2/n$. Chebyshev's inequality gives $P(|\bar X_n-\mu|\geq\epsilon)\leq\dfrac{\sigma^2}{n\epsilon^2}\to0$.
Left panel: four simulated running-average paths of uniform random draws converging toward the true mean, bracketed by a shrinking envelope. Right panel: log-log plot of the empirical variance of the sample mean against sample size, matching the proved sigma-squared over n rate exactly.
Figure — The Weak Law of Large Numbers, via Chebyshev's inequality. Left: four independent runs of $\bar X_n$ for $X_i\sim\mathrm{Uniform}(0,1)$ all settle inside the $\mu\pm\sigma/\sqrt n$ envelope predicted by $\mathrm{Var}(\bar X_n)=\sigma^2/n$. Right: the empirical variance of $\bar X_n$, estimated from $3000$ independent replicates at each $n$, tracks the proved rate $\sigma^2/n$ almost exactly across three orders of magnitude in $n$.

3. Bayes' theorem and the anatomy of Bayesian inference

From the definition of conditional probability, $P(A|B)=P(A\cap B)/P(B)$, applied both ways: $P(A|B)P(B)=P(A\cap B)=P(B|A)P(A)$, so $P(A|B)=\dfrac{P(B|A)P(A)}{P(B)}$. Specialized to parameters $\theta$ and data $D$:

Bayes' theorem

$P(\theta|D)=\dfrac{P(D|\theta)P(\theta)}{P(D)}$, where $P(\theta|D)$ is the posterior, $P(D|\theta)$ the likelihood, $P(\theta)$ the prior, and $P(D)=\int P(D|\theta)P(\theta)\,d\theta$ the marginal likelihood (evidence) — a normalizing constant not depending on $\theta$.

Because $P(D)$ does not depend on $\theta$, it is routine to work with $P(\theta|D)\propto P(D|\theta)P(\theta)$ and recover the normalizing constant afterward (or avoid it entirely, as in Section 9's MCMC). Sections 4–9 are, in one sense, all commentary on this single identity: what happens when the posterior is reduced to a single point (Sections 4, 6), when it is tractable in closed form (Section 5), when it must be approximated by a simpler distribution (Sections 7–8), or by samples (Section 9).

4. Maximum likelihood and its connection to KL divergence

Definition

$D_{KL}(p\,\|\,q)=E_{X\sim p}\big[\log(p(X)/q(X))\big]$, the Kullback–Leibler divergence from $q$ to $p$.

Theorem (Gibbs' inequality)

$D_{KL}(p\,\|\,q)\geq0$, with equality iff $p=q$ (a.e.).

Proof. $-D_{KL}(p\,\|\,q)=E_p\big[\log(q(X)/p(X))\big]\leq\log E_p[q(X)/p(X)]$ by Jensen's inequality — itself immediate from the optimization note's first-order convexity characterization (Section 2 there) applied to the convex function $-\log$: that inequality, $f(y)\geq f(x)+\nabla f(x)(y-x)$, taken at $x=E[Y]$ and averaged over $Y$, gives $E[f(Y)]\geq f(E[Y])$, i.e. Jensen's inequality for convex $f$ (concave for $-f$, flipping the sign used here). Now $E_p[q(X)/p(X)]=\int p(x)\frac{q(x)}{p(x)}\,dx=\int q(x)\,dx=1$, so $-D_{KL}(p\,\|\,q)\leq\log1=0$. Equality in Jensen holds only when $Y=q(X)/p(X)$ is a.s. constant (strict concavity of $\log$); combined with $E_p[Y]=1$, that constant must be $1$, forcing $p=q$ a.e.
Theorem (MLE asymptotically minimizes KL divergence to the truth)

If $x_1,\ldots,x_n$ are i.i.d. from a true density $p_0$, then $\arg\max_\theta\frac1n\sum_i\log p_\theta(x_i)\to\arg\min_\theta D_{KL}(p_0\,\|\,p_\theta)$ in the sense that the objective itself converges: $\frac1n\sum_i\log p_\theta(x_i)\to E_{p_0}[\log p_\theta(X)]$ for each fixed $\theta$, and $D_{KL}(p_0\,\|\,p_\theta)=E_{p_0}[\log p_0(X)]-E_{p_0}[\log p_\theta(X)]$.

Proof. The convergence $\frac1n\sum_i\log p_\theta(x_i)\to E_{p_0}[\log p_\theta(X)]$ is the Weak Law of Large Numbers (Section 2) applied to the i.i.d. sequence $Y_i=\log p_\theta(x_i)$. The KL identity is immediate from the definition, splitting the log-ratio into two expectations by linearity (Section 1). Since $E_{p_0}[\log p_0(X)]$ does not depend on $\theta$, maximizing $E_{p_0}[\log p_\theta(X)]$ over $\theta$ is the same optimization as minimizing $D_{KL}(p_0\,\|\,p_\theta)$ over $\theta$.

This is the precise sense in which maximizing average log-likelihood is "trying to match the true data-generating distribution": for large $n$, the MLE objective and the (unobservable, since $p_0$ is unknown) KL-divergence-to-truth objective have the same maximizer, up to the sampling fluctuation the WLLN controls.

5. Conjugate priors: the Beta-Binomial derivation

A prior is conjugate to a likelihood if the posterior lands back in the same distributional family — not a coincidence, but a direct consequence of Bayes' theorem (Section 3) applied to two densities whose functional forms multiply into a third familiar form.

Theorem (Beta-Binomial conjugacy)

If $\theta\sim\mathrm{Beta}(\alpha,\beta)$ and, given $\theta$, $k\sim\mathrm{Binomial}(n,\theta)$, then $\theta\mid k\sim\mathrm{Beta}(\alpha+k,\beta+n-k)$.

Proof. The prior density is $p(\theta)\propto\theta^{\alpha-1}(1-\theta)^{\beta-1}$ and the likelihood is $p(k\mid\theta)\propto\theta^k(1-\theta)^{n-k}$ (both up to $\theta$-independent normalizing constants — $1/B(\alpha,\beta)$ and $\binom nk$ respectively). By Bayes' theorem, $p(\theta\mid k)\propto p(k\mid\theta)p(\theta)=\theta^{\alpha+k-1}(1-\theta)^{\beta+n-k-1}$. This is exactly the unnormalized kernel of a $\mathrm{Beta}(\alpha+k,\beta+n-k)$ density; since a density is determined by its kernel (the normalizing constant is whatever makes it integrate to $1$, and only one constant does), $\theta\mid k$ must be exactly that Beta distribution.

Nothing about this argument is special to Beta-Binomial — it is multiplying two exponents together and recognizing the result. The same mechanism (Gaussian prior $\times$ Gaussian likelihood $\propto$ Gaussian, in the mean; and more generally, any exponential-family likelihood paired with its natural conjugate prior) is why conjugate pairs exist at all: the log-prior and log-likelihood are both affine in a shared set of sufficient statistics, and adding affine functions stays affine.

6. MAP estimation as regularized MLE

$\hat\theta_{MAP}=\arg\max_\theta P(\theta\mid D)=\arg\max_\theta\big[\log P(D\mid\theta)+\log P(\theta)\big]$ (Bayes' theorem, Section 3, then dropping the $\theta$-independent $\log P(D)$ and using that $\log$ is increasing).

Theorem

A Gaussian prior $P(\theta)\propto\exp(-\|\theta\|_2^2/2\tau^2)$ makes MAP estimation identical to L2-regularized (ridge) MLE; a Laplace prior $P(\theta)\propto\exp(-\|\theta\|_1/b)$ makes it identical to L1-regularized (lasso) MLE.

Proof. With the Gaussian prior, $\log P(\theta)=-\|\theta\|_2^2/(2\tau^2)+\text{const}$, so $\hat\theta_{MAP}=\arg\max_\theta\big[\log P(D\mid\theta)-\tfrac1{2\tau^2}\|\theta\|_2^2\big]=\arg\min_\theta\big[-\log P(D\mid\theta)+\lambda\|\theta\|_2^2\big]$ with $\lambda=1/(2\tau^2)$ — exactly the ridge-regularized negative log-likelihood objective. The Laplace case is identical with $\|\theta\|_1$ in place of $\|\theta\|_2^2$ and $\lambda=1/b$.

This derivation is the actual reason L2 regularization is called "ridge" and pairs with a Gaussian prior, and L1 with "lasso" and a Laplace prior — not an analogy, but the same optimization problem written in two different vocabularies, Bayesian and penalized-likelihood.

7. The EM algorithm: monotonic ascent via Jensen's inequality

For a model with observed data $X$ and latent variables $Z$, direct maximization of $\log P(X\mid\theta)=\log\sum_zP(X,z\mid\theta)$ is often intractable (the sum is inside the log). For any distribution $q(z)$:

The ELBO bound

$\log P(X\mid\theta)\geq\mathcal L(q,\theta):=\sum_zq(z)\log\dfrac{P(X,z\mid\theta)}{q(z)}$, with equality iff $q(z)=P(z\mid X,\theta)$.

Proof. $\log P(X\mid\theta)=\log\sum_zq(z)\dfrac{P(X,z\mid\theta)}{q(z)}\geq\sum_zq(z)\log\dfrac{P(X,z\mid\theta)}{q(z)}$ by Jensen's inequality (Section 4), applied to the concave $\log$ averaged over $z\sim q$. If $q(z)=P(z\mid X,\theta)$, then $P(X,z\mid\theta)/q(z)=P(X,z\mid\theta)/P(z\mid X,\theta)=P(X\mid\theta)$ for every $z$ (definition of conditional probability) — a constant, which is exactly Jensen's equality case, so the bound is tight there.
Theorem (EM's monotonic ascent)

With $q^{(t)}(z):=P(z\mid X,\theta^{(t)})$ (E-step) and $\theta^{(t+1)}:=\arg\max_\theta\mathcal L(q^{(t)},\theta)$ (M-step, equivalently $\arg\max_\theta E_{q^{(t)}}[\log P(X,Z\mid\theta)]=:Q(\theta\mid\theta^{(t)})$, since the entropy term $-\sum_zq^{(t)}(z)\log q^{(t)}(z)$ does not depend on $\theta$): $\log P(X\mid\theta^{(t+1)})\geq\log P(X\mid\theta^{(t)})$.

Proof. $\log P(X\mid\theta^{(t+1)})\geq\mathcal L(q^{(t)},\theta^{(t+1)})$ (the ELBO bound, valid for any $q,\theta$) $\geq\mathcal L(q^{(t)},\theta^{(t)})$ (the M-step chose $\theta^{(t+1)}$ to maximize $\mathcal L(q^{(t)},\cdot)$, so it is at least as good as not moving) $=\log P(X\mid\theta^{(t)})$ (the bound is tight at $(q^{(t)},\theta^{(t)})$, by the E-step's choice of $q^{(t)}$). Chaining the three gives the claim.

Figure 2 runs exactly this on a two-component Gaussian mixture, where $Q(\theta\mid\theta^{(t)})$ has a closed form (the "responsibilities" $q^{(t)}(z_i=k)$ weight each data point's contribution to each component's mean and variance update) — the E-step and M-step formulas in the original version of this note are precisely this theorem's $q^{(t)}$ and $\arg\max_\theta Q(\theta\mid\theta^{(t)})$, specialized to a Gaussian mixture likelihood.

Left panel: a histogram of bimodal synthetic data with an EM-fitted two-component Gaussian mixture density overlaid, closely matching both modes. Right panel: the log-likelihood at each EM iteration, jumping up sharply then monotonically increasing to a plateau, never decreasing.
Figure — EM's ascent guarantee, verified on real data. Left: a two-component Gaussian mixture, fit by EM to $400$ synthetic samples, recovers both modes closely. Right: the log-likelihood computed at every EM iteration increases at every single step, exactly as the theorem guarantees — never a single decrease, across $25$ iterations from a deliberately poor initialization.

8. Variational inference and the ELBO

Section 7's E-step requires the true posterior $P(z\mid X,\theta)$ to be tractable. When it is not, variational inference instead restricts $q$ to a tractable family $\mathcal Q$ and optimizes $\mathcal L(q,\theta)$ over $q\in\mathcal Q$ directly.

Theorem (Exact ELBO decomposition)

$\log P(X\mid\theta)=\mathcal L(q,\theta)+D_{KL}\big(q(Z)\,\|\,P(Z\mid X,\theta)\big)$ for every $q$ — an identity, not merely a bound.

Proof. $D_{KL}\big(q\,\|\,P(\cdot\mid X,\theta)\big)=E_q[\log q(Z)]-E_q[\log P(Z\mid X,\theta)]$. Since $P(Z\mid X,\theta)=P(X,Z\mid\theta)/P(X\mid\theta)$, $\log P(Z\mid X,\theta)=\log P(X,Z\mid\theta)-\log P(X\mid\theta)$, and the last term is constant in $Z$, so it factors out of the expectation: $D_{KL}(q\,\|\,P(\cdot\mid X,\theta))=E_q[\log q(Z)]-E_q[\log P(X,Z\mid\theta)]+\log P(X\mid\theta)=-\mathcal L(q,\theta)+\log P(X\mid\theta)$. Rearranging gives the claim.

Since $D_{KL}\geq0$ (Section 4's Gibbs inequality) and $\log P(X\mid\theta)$ does not depend on $q$, this identity says maximizing $\mathcal L(q,\theta)$ over $q\in\mathcal Q$ is exactly minimizing $D_{KL}(q\,\|\,P(\cdot\mid X,\theta))$ over $q\in\mathcal Q$ — the ELBO is not merely "a lower bound worth maximizing," it is a KL-divergence-minimization problem in disguise, with the (generally intractable) true posterior as the exact target. Mean-field variational inference is the specific choice $\mathcal Q=\{q:q(\theta)=\prod_iq_i(\theta_i)\}$, trading some accuracy (a factorized $q$ generally cannot match a posterior with genuine dependence between coordinates) for tractability.

9. Markov Chain Monte Carlo and detailed balance

When neither the posterior nor a good variational approximation is available in closed form, MCMC instead constructs a Markov chain whose stationary distribution is the target $\pi$, and runs it long enough that samples resemble draws from $\pi$.

Lemma (Detailed balance implies stationarity)

If a Markov chain's transition kernel $T$ satisfies $\pi(\theta)T(\theta'\mid\theta)=\pi(\theta')T(\theta\mid\theta')$ for all $\theta,\theta'$, then $\pi$ is a stationary distribution of the chain.

Proof. $\sum_\theta\pi(\theta)T(\theta'\mid\theta)=\sum_\theta\pi(\theta')T(\theta\mid\theta')=\pi(\theta')\sum_\theta T(\theta\mid\theta')=\pi(\theta')$, using detailed balance termwise and then that $T(\cdot\mid\theta')$ is a probability distribution summing to $1$. The left side is the distribution after one step starting from $\pi$, so this shows $\pi T=\pi$.
Theorem (Metropolis–Hastings satisfies detailed balance)

With proposal $q(\theta'\mid\theta)$ and acceptance probability $\alpha(\theta'\mid\theta)=\min\!\Big(1,\dfrac{\pi(\theta')q(\theta\mid\theta')}{\pi(\theta)q(\theta'\mid\theta)}\Big)$, the transition kernel $T(\theta'\mid\theta)=q(\theta'\mid\theta)\alpha(\theta'\mid\theta)$ satisfies detailed balance with respect to $\pi$.

Proof. WLOG suppose $\pi(\theta)q(\theta'\mid\theta)\geq\pi(\theta')q(\theta\mid\theta')$ (else swap $\theta,\theta'$ throughout). Then $\alpha(\theta'\mid\theta)=\dfrac{\pi(\theta')q(\theta\mid\theta')}{\pi(\theta)q(\theta'\mid\theta)}$ (the ratio is $\leq1$) and $\alpha(\theta\mid\theta')=1$ (the reciprocal ratio is $\geq1$). So $\pi(\theta)T(\theta'\mid\theta)=\pi(\theta)q(\theta'\mid\theta)\cdot\dfrac{\pi(\theta')q(\theta\mid\theta')}{\pi(\theta)q(\theta'\mid\theta)}=\pi(\theta')q(\theta\mid\theta')=\pi(\theta')q(\theta\mid\theta')\cdot1=\pi(\theta')T(\theta\mid\theta')$.

Combining the two results: $\pi$ is a stationary distribution of the Metropolis–Hastings chain, for any proposal $q$ — the proposal only affects how fast the chain mixes toward $\pi$, never whether $\pi$ is the right target. Crucially, $\alpha$ depends on $\pi$ only through the ratio $\pi(\theta')/\pi(\theta)$, so $\pi$ never needs to be normalized — exactly what makes MCMC usable when $P(D)$ in Bayes' theorem (Section 3) is intractable to compute.

10. Further models, more briefly

The remaining standard models are applications of Sections 1–9's machinery to particular structures; full development is beyond this note's scope.

Graphical models

Bayesian networks (directed acyclic graphs) factor a joint distribution as $P(x_1,\ldots,x_n)=\prod_iP(x_i\mid\mathrm{parents}(x_i))$; Markov random fields (undirected) instead factor over clique potentials, $P(x_1,\ldots,x_n)=\frac1Z\prod_c\psi_c(x_c)$. Both are compact encodings of conditional independence structure that make the sums and products in Sections 5–9 tractable by exploiting sparsity in the dependency graph.

Hidden Markov Models and Gaussian Mixture Models

An HMM factors $P(z_{1:T},x_{1:T})=P(z_1)\prod_{t\geq2}P(z_t\mid z_{t-1})\prod_tP(x_t\mid z_t)$; the forward algorithm and Viterbi algorithm compute marginal and most-likely-path quantities via dynamic programming over this factorization. A GMM, $P(x)=\sum_k\pi_k\mathcal N(x\mid\mu_k,\Sigma_k)$, is the specific latent-variable model Section 7's EM derivation and Figure 2 use — an HMM without the temporal transitions.

Naive Bayes, Gaussian processes, Bayesian neural networks

Naive Bayes assumes feature conditional independence given the class, $P(y\mid x_{1:d})\propto P(y)\prod_iP(x_i\mid y)$ — an extreme, often-wrong-but-useful independence assumption that makes Section 3's Bayes rule trivial to apply at scale. A Gaussian process places a prior directly over functions, $f\sim\mathcal{GP}(m,k)$, specified by a mean function and covariance kernel. A Bayesian neural network places a prior over the weights of the neural networks note's architecture, $P(w\mid D)\propto P(D\mid w)P(w)$, and predicts by averaging over the posterior — usually via the variational (Section 8) or MCMC (Section 9) machinery above, since the exact posterior over millions of weights is never tractable.

11. Computation

The figures above are generated by probabilistic-models/generate_figures.py. The snippet below checks Section 5's Beta-Binomial posterior against an independent Metropolis–Hastings run (Section 9) targeting the same (unnormalized) posterior density.

import numpy as np
rng = np.random.default_rng(0)

alpha, beta_, n, k = 2.0, 3.0, 20, 14
post_alpha, post_beta = alpha + k, beta_ + n - k
print(f"Analytic posterior: Beta({post_alpha}, {post_beta})")

def target(theta):
    if theta <= 0 or theta >= 1:
        return 0.0
    return theta**(post_alpha - 1) * (1 - theta)**(post_beta - 1)

theta, samples, step = 0.5, [], 0.1
for _ in range(60000):
    prop = theta + rng.normal(0, step)
    if 0 < prop < 1 and rng.uniform() < min(1, target(prop) / target(theta)):
        theta = prop
    samples.append(theta)
samples = np.array(samples[10000:])  # discard burn-in

print("MCMC sample mean:", samples.mean(), " analytic mean:", post_alpha/(post_alpha+post_beta))
print("MCMC sample var: ", samples.var(), " analytic var: ",
      post_alpha*post_beta / ((post_alpha+post_beta)**2 * (post_alpha+post_beta+1)))

Actual output:

Analytic posterior: Beta(16.0, 9.0)
MCMC sample mean: 0.6407473637234986  analytic mean: 0.64
MCMC sample var: 0.008754077716860017  analytic var: 0.008861538461538462

A Metropolis–Hastings chain that never once computes the Beta normalizing constant $B(16,9)$ — using only the ratio $\mathrm{target}(\theta')/\mathrm{target}(\theta)$, as Section 9's proof requires — recovers the exact analytic posterior mean and variance to three significant figures. This is Section 5's closed-form derivation and Section 9's detailed-balance proof checked against each other by two independent routes to the same number.

12. Common pitfalls

Pitfall — a conjugate posterior mean is a compromise, not an average of prior and data alone

Section 5's Beta-Binomial posterior mean is $\frac{\alpha+k}{\alpha+\beta+n}$ — a weighted combination of the prior mean $\frac{\alpha}{\alpha+\beta}$ and the data's mean $k/n$, weighted by $\alpha+\beta$ (the prior's "effective sample size") against $n$ (the actual sample size). A strong prior ($\alpha+\beta\gg n$) can dominate a small dataset almost completely — not a flaw, but a precise, quantifiable statement about how much the data is being trusted relative to the prior, worth checking explicitly rather than assuming the prior "washes out."

Pitfall — EM's monotonic ascent is to a local, not global, maximum

Section 7's proof shows $\log P(X\mid\theta^{(t+1)})\geq\log P(X\mid\theta^{(t)})$ — nothing more. Different initializations of EM on the same Gaussian mixture routinely converge to different local optima (e.g. swapped or merged components); Figure 2's clean convergence depended on a reasonable initialization, not a guarantee that any initialization works equally well.

Pitfall — MCMC's stationary distribution is only reached in the limit

Section 9 proves $\pi$ is stationary — the chain, once distributed as $\pi$, stays that way — but says nothing about how many steps are needed to get close to $\pi$ from an arbitrary start (the "burn-in" period, discarded in Section 11's code) or how correlated consecutive samples are (mixing time). A chain can satisfy detailed balance perfectly and still be practically useless if it mixes too slowly to explore $\pi$ in any feasible amount of computation.

Pitfall — mean-field variational inference systematically underestimates posterior uncertainty

Section 8's factorized $q(\theta)=\prod_iq_i(\theta_i)$ cannot represent correlation between coordinates even when the true posterior has strong correlation; minimizing $D_{KL}(q\,\|\,p)$ (rather than $D_{KL}(p\,\|\,q)$) further penalizes $q$ for placing mass where $p$ has none, which tends to make the fitted $q$ narrower than $p$ along the directions it can represent. Variational posteriors are a fast, structured approximation, not a substitute for checking calibration against Section 9's asymptotically-exact (if slower) alternative.

13. Connections

14. References