Week 11 · The exponential family
Read the words of the video
- Just like baking, many probability distributions share a secret "recipe card." You change the ingredients, but the basic layout stays the same. This means learning how to handle one distribution's recipe helps you understand many others, saving you lots of time and effort!
- This shared recipe card is called the 'exponential family'. It lets us write many distributions like coin flips or bell curves in one special form. The magic is, if you learn how to find the mean or fit one of these models using this recipe, you've learned it for all of them!
- Take the Poisson distribution, for counting things like buses. We can write its formula in our special recipe card form. Here, our natural parameter, 'eta', becomes 'log lambda', where 'lambda' is the average count. The 'T of x' part just becomes 'x', our actual count.
- While the name 'exponential family' might not appear on exams, its core ideas are super important for other topics like MLE and regression! Remember the recipe card, how 'A prime of eta' gives the mean, and how to find the best parameter by matching model mean to sample mean. Keep practicing!
The one-minute story
Bake cakes, bread and biscuits and you will notice they all start from the same kind of recipe card: flour, a sweetener, something to make it rise, a little oven time. The card has a fixed layout and you only change the amounts.
Many of the probability distributions you already know (coin flips, waiting times, counts of buses, the bell curve) secretly share one recipe card too. It is called the exponential family. The beauty: if you learn how to do something once on the recipe card (find the mean, find the best parameter from data, fit a model), you have learned it for all of them at once.
That is the reason logistic regression, linear regression and many other models look so alike: they are all the same recipe with different ingredients.
How much to invest in this week. Looking at every MLF paper on the practice site, the exponential family is not asked by name in any of them, but the ideas here (natural parameter, log-partition function, "model mean = sample mean") are the foundation of the MLE questions that are asked, and of logistic regression in MLT and MLP. Learn the recipe, practise the Bernoulli and Poisson conversions, and move on.
By the end of this week you can:
- write a distribution in the exponential-family form and name its parts;
- show that Bernoulli, Poisson, exponential and Gaussian (known variance) belong to the family;
- get the mean and variance from the log-partition function;
- find the maximum-likelihood estimate by matching the model mean to the sample mean.
Words you need
- Exponential family - distributions that can be written as .
- Natural parameter - the "dial" of the family, in its most convenient form.
- Sufficient statistic - the one summary of each data point that matters. For many data points you only need .
- Log-partition function - the "normaliser" that makes the total probability equal 1.
- Base measure - a background factor that does not depend on the parameter.
Idea 1: The recipe card
(One parameter for simplicity; with several, becomes a dot product .)
- : what you record from a data point.
- : the parameter that multiplies it inside the exponent.
- : whatever you must subtract so the probabilities add up to 1: .
- : leftover factor that does not involve .
To show a distribution is in the family: take its formula, write it as , and sort the terms into "involves both and the parameter" (), "involves only the parameter" (), and "involves only " ().
Sorting: , (the log-odds, or logit), , and since we get , so .
Now invert : . That is the sigmoid from week 9! Logistic regression is just "set for a Bernoulli".
, , , .
Exponential ( for ): write it as . So , (negative!), , .
Gaussian with variance 1 ( unknown): . So , , .
Distributions not in the family: the uniform on (its range depends on the parameter), the Cauchy, and the Student-.
Idea 2: The log-partition function knows the mean and variance
Differentiate :
One function holds the whole story. Check with what we found:
| Distribution | |||
|---|---|---|---|
| Bernoulli | |||
| Poisson | |||
| Exponential | |||
| Gaussian (var 1) |
Every row reproduces a mean and variance you already knew from week 10. And because a variance is never negative, , which means is a convex function (week 8). That convexity is exactly what makes fitting these models a nice optimisation problem.
Idea 3: Fitting the family by maximum likelihood
Suppose you observe independent data points . The log-likelihood of is
Differentiate and set to zero: , i.e.
Since , the log-likelihood is concave in , so this equation gives the global maximum. This is called moment matching.
Bernoulli. , so (the fraction of heads).
Poisson. , so . For the counts : .
Exponential. , so . For waiting times : , so .
Gaussian, variance 1. .
Notice the sufficient statistic at work: to estimate , or you only needed the total . The individual values were not needed.
Idea 4: Why this matters for the other courses
In a generalised linear model you choose a member of the family for the thing you are predicting, and set its natural parameter to a linear function of the inputs: .
| You predict | Family | Model |
|---|---|---|
| a real number with bell-shaped noise | Gaussian | linear regression (MLT week 5) |
| yes / no | Bernoulli | logistic regression (MLT week 9) |
| a count (0, 1, 2, ...) | Poisson | Poisson regression |
| one of categories | categorical | softmax (neural nets, MLT week 12) |
Your turn
Write the Poisson() distribution in exponential-family form and name , , and .
Need a hint?
Take of the formula .
Show the full solution
. So , , , .
For the Bernoulli, . Compute and check it is the mean.
Need a hint?
Differentiate with the chain rule.
Show the full solution
. With , , so . ✓
Defects per batch of a product are modelled as Poisson. Five batches show defects. What is the MLE of ?
Need a hint?
Poisson: model mean .
Show the full solution
.
Five service times (minutes) are . Estimate the rate of an exponential model, and the probability that a service takes over 3 minutes.
Need a hint?
and .
Show the full solution
, so . .
Is the uniform distribution on in the exponential family?
Need a hint?
Look at where appears.
Show the full solution
No. Its density is only on , so the support (where the density is non-zero) depends on . In the family the support cannot depend on the parameter.
Exam radar
Be honest about priorities. Across all MLF papers on the practice site, none of the concept summaries mention the exponential family, natural parameter or sufficient statistic. What is examined near this week: MLE (in 16 of the 42 End Term summaries), Poisson and Bernoulli facts (16 and 11), and the exponential distribution story problems (waiting times). So treat this week as the foundation behind those, and for logistic regression in MLT and MLP.
If your term's paper does ask about it, the likely question is "write this distribution in exponential-family form" or "find " (Examples 1 to 3).
- For the exponential distribution, is negative, and needs .
- is not always (for the Gaussian with unknown variance it is ).
- "Moment matching" means model mean = sample mean of , not of in general.
- A distribution whose range depends on the parameter is not in the family.
Quick quiz
For the Poisson distribution written in exponential-family form, the natural parameter eta is...
- lambda
- ln lambda
- 1 / lambda
- e to the lambda
For an exponential-family distribution, A prime of eta equals...
- the variance
- the expected value of T(X)
- the likelihood
- zero
The MLE of the Poisson rate from counts 1, 3, 2 is...
- 1
- 2
- 3
- 6
Select all TRUE. (select all that apply)
- The Bernoulli natural parameter is the log-odds.
- The log-partition function A is convex.
- The uniform distribution on [0, theta] is in the exponential family.
- The sufficient statistic is always a constant.
Recap
- Recipe card: .
- Bernoulli: (logit; inverse is the sigmoid). Poisson: . Exponential: . Gaussian (var 1): .
- , so is convex.
- MLE: , "model mean = sample mean". Log-likelihood is concave.
- Setting gives linear regression, logistic regression, Poisson regression, softmax.
- ,
- MLE:
- Bernoulli ; Poisson ; Exponential
- Logit: ; inverse:
- MLT week 9 - Perceptron and logistic regression: Logistic regression is a member of the exponential family of models.
Practise with real exam questions
These come straight from past papers (with the real figures and the official answer key). Open 2 real questions on this week All End Term papers