# Termination Condition(s) for Expectation Maximization

What are good criteria for deciding when to terminate the expectation-maximization algorithm.

I know that the idea is that you should terminate when the change in the data log likelihood is "small" or the change in the model parameters is "small" over one (or a few) iterations. But how do you determine "small"?

So far, my literature search has only provided papers that prove convergence under different conditions, or provide specialized techniques to improve the rate of convergence. I've not seen good, practical, results on when to terminate the algorithm in practical use.

You can use an absolute error criterion (e.g. difference between successive iterations $$|\ell(\theta_{n+1}) - \ell(\theta_n)|< 10^{-4}$$). You can also choose a relative error criterion, e.g. $$\frac{|\ell(\theta_{n+1}) - \ell(\theta_n)|}{|\ell(\theta_n)|}< 10^{-4}$$. This is somewhat more reasonable because you do not really know how large or small your log-likelihood is and normalizing makes your stopping condition independent of scale. Just make sure you do not set the desired tolerance too small or you will never achieve it.
TLDR: try a default threshold like $$10^{-3}$$ first. If that is slow, switch to a faster-than-linear algorithm that uses/approximates the Hessian.
It greatly depends. If your log likelihood has a low curvature, then you could be stuck waiting a long time for the objective function increments to fall below a fixed threshold like $$10^{-3}$$. This is because EM is only a first-order optimization method.
So, my advice would be to first run your EM algorithm using one of the default recommendations like $$10^{-3}$$. By the way, this default number should be with respect to the average objective (e.g., divide the ELBO sum by the sample size $$N$$). Ideally, it would terminate relatively quickly. However, if you get stuck in a long loop where each step is always increasing the objective function by only a small amount (but larger than your threshold), then you should look into an algorithm that has better convergence rate. For example, if you can compute the EM steps, you can probably calculate the gradient instead (eq. 8). With the gradient you can run a faster-than-linear algorithm like BFGS that is widely implemented. Personally, this trick has saved me countless hours.