MIT 18.650 — Lecture 12
The EM Algorithm
§ Computing the MLE
In this lecture, we'll turn our attention to actually computing the MLE. For very simple models, computing the MLE as a function of the sample data is very easy; recall Lecture 9.
More generally, the MLE is the solution to an optimization problem: for what value is maximized?
There are two natural approaches to solving optimization problems.
Gradient Ascent. Assuming is computable, we can start at some guess and search for the maximum by picking some constant of our choice and updating our guesses like so:
Newton-Raphson (Root Finding). The idea is to find a root of and hope the critical point we find is a global maximum. The Newton-Raphson algorithm updates guesses for the root like so:
Fortunately, when our model is something like , the log likelihood is not very hard to optimize, because its derivative is simple. (This depends on normal distributions nicely having exponential PDFs!)
But there's a special kind of model that is particularly hard to work with: mixture models.
§ Mixture Models
If we measure the heights of a random group of people, a model like won't work perfectly anymore. One reason is that our sample is a mixture of men and women. We might (simplistically) assume the following:
Any given sample has some probability of being from a woman, and of being from a man.
The height of a randomly chosen man has some PDF from the model .
The height of a randomly chosen woman has some PDF from the model .
Our samples thus follow the PDF . This is a mixture model, with parameter . More generally…
Definition. In a mixture model, there are two models with parameters and , along with corresponding PDFs and . Every sample yields some data , where:
Note that we may only receive the data and don't even know the value of .
There are two challenges with finding the MLE for mixture models.
Challenge #1. We don't know the value of , so the log likelihood has a floating . This means we have a third parameter to worry about now.
Challenge #2. Even if we did assume, say, , the log likelihood still looks awful.
The difficulty is that the logarithm of a sum does not simplify well at all.
§ The EM Algorithm
It turns out there is a strategy for computing the MLE of a mixture model: the EM Algorithm.
Idea #1. If we know all of the , then estimating is doable.
Reasoning: Of course, if we know all the , we can just estimate directly.
As for , the rough idea is just to split the samples into two halves based on their value of . Then just use one half to estimate , and the other half to estimate . Formally, this looks like:
And these are a lot easier to compute.
Of course, we don't know all of the . But maybe we can at least estimate the …
Idea #2. If we have some prior estimate for , then we can estimate reasonably well.
Reasoning: Well, if we know , then can be estimated via Bayes' Rule.
Here, is not a discrete value in , but rather a continuous value in . Still, it's a good enough estimate that the reasoning in Idea #1 still holds.
We have a problem though: Idea #1 relies on Idea #2, and vice versa! Here's the trick, though: we don't care.
EM Algorithm. Start with some prior estimate . At time step , make the following updates:
E Step. In accordance with Idea #2, we estimate using last time step's estimates and Bayes' Rule.
M Step. In accordance with Idea #1, we compute using the estimates computed in the E Step.
Remark. Suppose that instead of a mixture of just distributions, we had a mixture of distributions.
There's an easy fix: instead of saying the sample only has the data , say it has the data , where for all , and . Then:
In the E step, make all estimates using a slightly-more-involved Bayes' Rule.
In the M step, update all probabilities and parameters by taking into account all estimates .
It turns out the following is true.
Theorem. (EM Algorithm Efficacy) The EM algorithm never decreases the log likelihood; that is,
Proof omitted—it's fairly involved.