Skip to content
AI360XpertBeta

Exponential Family Distributions

Many famous distributions share one algebraic shape. Learn that shape once and Bernoulli, Poisson, and Gaussian all run on the same estimation engine.

Bernoulli, Poisson, and Gaussian each factor into base measure, sufficient statistic, and log-partition, so one convex engine fits all three
Bernoulli, Poisson, and Gaussian each factor into base measure, sufficient statistic, and log-partition, so one convex engine fits all three

Why Does This Exist?

GLMs, conjugate priors, and variational inference all reuse the same trick: write the density as p(x∣η)=h(x)exp⁡(ηT(x)−A(η))p(x \mid \eta) = h(x)\exp(\eta T(x) - A(\eta)) and everything downstream becomes mechanical. Means come from ∇A\nabla A, variances from ∇2A\nabla^2 A, MLE matches moments, and conjugate priors multiply cleanly.

Without the shared form, each distribution needs bespoke algebra. With it, one proof covers Bernoulli flips, Poisson counts, and Gaussian noise. It generalizes probability distributions into a working toolkit for maximum likelihood estimation.

The one idea you need first. T(x)T(x) is the sufficient statistic, η\eta the natural parameter, A(η)A(\eta) the log-partition that normalizes. For Bernoulli with mean pp: η=log⁡(p/(1−p))\eta = \log(p/(1-p)) and A(η)=log⁡(1+eη)A(\eta) = \log(1 + e^\eta).

Think of It Like This

One charger for many phones

Bernoulli, Poisson, and Gaussian look like different phones with different ports. The exponential family is the discovery that all three charge over USB-C: same hh, TT, η\eta, AA pins in different positions.

One charger (moment matching, convex AA, conjugate updates) powers all of them. Where it stops: some phones need proprietary voltage. Uniform, Cauchy, and mixture models sit outside the family and the charger does not fit.

How It Actually Works

Members share: base measure h(x)h(x), sufficient statistic T(x)T(x), natural parameter η\eta, log-partition A(η)=log⁡∫h(x)eηT(x)dxA(\eta) = \log \int h(x) e^{\eta T(x)} dx. Then E[T(X)]=∇A(η)\mathbb{E}[T(X)] = \nabla A(\eta) and Cov[T(X)]=∇2A(η)\mathrm{Cov}[T(X)] = \nabla^2 A(\eta), with AA convex. MLE sets sample moments of TT equal to ∇A(η)\nabla A(\eta), a convex problem with one global optimum in η\eta.

Worked example

Bernoulli p=0.3p = 0.3: η=log⁡(0.3/0.7)=log⁡(0.4286)≈−0.8473\eta = \log(0.3/0.7) = \log(0.4286) \approx -0.8473. A(η)=log⁡(1+e−0.8473)=log⁡(1.4286)≈0.3567A(\eta) = \log(1 + e^{-0.8473}) = \log(1.4286) \approx 0.3567. Derivative check: A′(η)=eη/(1+eη)=0.4286/1.4286=0.3A'(\eta) = e^\eta/(1+e^\eta) = 0.4286/1.4286 = 0.3, the mean. Poisson λ=4\lambda = 4: η=log⁡4≈1.3863\eta = \log 4 \approx 1.3863, A(η)=eη=4A(\eta) = e^\eta = 4, and A′=4A' = 4, again the mean. Same differentiation, two distributions.

Code

The round trip below uses only the standard library and recovers the mean from the natural parameter, which is moment matching in miniature.

import math
p = 0.3eta = math.log(p / (1 - p))  # natural parametermean = math.exp(eta) / (1 + math.exp(eta))  # grad Aprint(round(eta, 4), round(mean, 4))  # -> (-0.8473, 0.3)

The round trip recovers 0.3 from −0.8473-0.8473. Moment matching inverts ∇A\nabla A the same way for every member.

Watch Out For

Forcing outsiders into the family

Uniform on [0,θ][0, \theta] has support depending on the parameter, so no fixed h(x)h(x) works. Cauchy has no mean, so ∇A\nabla A cannot exist. Fitting family machinery anyway gives silently wrong posteriors and convex-looking losses with kinks.

Checklist: fixed support, finite A(η)A(\eta), and sufficient statistic of fixed dimension. Mixtures fail the last one.

Optimizing the wrong parameterization non-convexly

A(η)A(\eta) is convex in η\eta, not necessarily in the everyday parameter like pp or σ\sigma. Running gradient descent on pp near the boundary 0 or 1 crawls or diverges, while η\eta space is smooth and unconstrained.

Optimize in η\eta (logits, log-rates), then map back. If the loss looks non-convex, suspect the parameterization first.

The Quick Version

  • One form h(x)exp⁡(ηT(x)−A(η))h(x)\exp(\eta T(x) - A(\eta)) covers Bernoulli, Poisson, Gaussian, gamma, and more.
  • Means and covariances are derivatives of AA; AA is convex in η\eta.
  • Bernoulli p=0.3p=0.3 gives η≈−0.847\eta \approx -0.847 and recovers the mean by differentiating.
  • MLE becomes moment matching with a unique optimum in natural parameters.
  • Uniform, Cauchy, and mixtures sit outside; check support and statistic dimension first.
  • Optimize in η\eta, not in bounded everyday parameters.