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.
Why Does This Exist?
GLMs, conjugate priors, and variational inference all reuse the same trick: write the density as p(x \\mid \\eta) = h(x)\\exp(\\eta^\\top T(x) - A(\\eta)) and everything downstream becomes mechanical. Means come from , variances from , 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
is the sufficient statistic, the natural parameter, the log-partition that normalizes. For Bernoulli with mean : and 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 , , , pins in different positions.
One charger (moment matching, convex , 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 , sufficient statistic , natural parameter , log-partition A(\\eta) = \\log \\int h(x) e^{\\eta^\\top T(x)} dx. Then and , with convex. MLE sets sample moments of equal to , a convex problem with one global optimum in .
Worked example
Bernoulli : . . Derivative check: A'(\\eta) = e^\\eta/(1+e^\\eta) = 0.4286/1.4286 = 0.3, the mean. Poisson : , A(\\eta) = e^\\eta = 4, and , again the mean. Same differentiation, two distributions.
Code
import numpy as np
p = 0.3eta = float(np.log(p / (1 - p))) # natural parametermean = float(np.exp(eta) / (1 + np.exp(eta))) # grad Aprint(round(eta, 4), round(mean, 4)) # -> (-0.8473, 0.3)The round trip recovers 0.3 from . Moment matching inverts the same way for every member.
Watch Out For
Forcing outsiders into the family
Uniform on has support depending on the parameter, so no fixed works. Cauchy has no mean, so cannot exist. Fitting family machinery anyway gives silently wrong posteriors and "convex" losses with kinks.
Checklist: fixed support, finite , and sufficient statistic of fixed dimension. Mixtures fail the last one.
Optimizing the wrong parameterization non-convexly
is convex in , not necessarily in the everyday parameter like or . Running gradient descent on near the boundary 0 or 1 crawls or diverges, while space is smooth and unconstrained.
Optimize in (logits, log-rates), then map back. If the loss looks non-convex, suspect the parameterization first.
The Quick Version
- One form h(x)\\exp(\\eta^\\top T(x) - A(\\eta)) covers Bernoulli, Poisson, Gaussian, gamma, and more.
- Means and covariances are derivatives of ; is convex in .
- Bernoulli gives 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 , not in bounded everyday parameters.