## Notes on EM and pLSA

(Appendix added on August 4th, 2014, see at the end)

## Introduction to EM

EM (Expectation Maximization) is a general technique for solving model learning problem including latent variables. Given a set of observed data and a set of latent variables , we want to learn the parameters by maximizing the log-likelihood of data, i.e. , including latent variable, we have the objective function for learning:

(1) However, this makes it difficult for us to utilize some standard optimization techniques like Gradient Descent, etc.. Facing this difficulty, we can include two ideas to help: 1, we can do the the whole learning step by step, i.e. iteratively, so that at each step we will have a old set of parameters, from the -th iteration, that we can use; 2, we can find an lower bound for objective function 1, and we optimize towards it, since it is an lower bound that we can guarantee to improve (or not decrease), we can (somehow) guarantee the objective function to be increasing (or not decreasing). Keep these two ideas in mind, we can do the derivation as below:

(2) In the above derivation, we use last iteration estimated parameters to find a lower bound, which we can just maximize to indirectly improve the original likelihood function. The equality holds when in Jensen’s inequality is a constant variable, in above case that is , is a constant. This equality gives us a estimate of latent variable under the model:

(3) Many textbook about EM utilizes the so-called Q-function:

(4) Where we can view as the complete data log-likelihood ( is incomplete data, are latent variables), as predictions of latent variables by using current estimated parameters, and Q-function as an expectation of the log-likelihood of the complete data. Then we can formalize the procedure for applying the EM algorithm:

Pre-Initialization:

Prepare the Q-function 4

Initialization:

Randomly initialize the parameters E step:

Estimate latent variables according current estimated parameters: M step:

Maximize the Q-function 4 w.r.t. the parameters given last estimated parameters Some properties about EM: it is proved that under EM procedure, if the lower bound Q-function is increasing (or not decreasing), then the log-likelihood function will be increasing (or not decreasing) and the iteration will finally go to a converged point (one way to see it is subtract with ). It is worth noting that EM can only find local maxima (a steady high point, but not the highest one), and so the initialization of EM matters.

## Applying EM in pLSA

pLSA (Probabilistic Latent Semantic Analysis [1, 2]) is a technique for mining topics of texts. In pLSA, the log-likelihood function is:

(5) Where indicates documents, denotes words, means topic assignments. is the number of documents, is the size of vocabulary, is number of topics.

In the log-likelihood function 5, we find a structure with latent variable that is very similar to the log-likelihood function 1 of a general EM problem, so we can utilize the similar derivation that utilized by EM to further derive the log-likelihood function 5, however, we can also do it by applying EM algorithm. To do so, we need to derive Q-function for EM. First, as the equation 5 is not the complete data log-likelihood, which is:

(6) To apply Q-function, we have to be very careful now, as it will get very tricky as we include the random variable , which is a multivariate random variable that has slots with each slot of states. In Q-function, we have to sum over all possible , which in this case seems lead to an exponential of terms. However that is not the case, as is independent to each other. We can write the Q-function as:

(7) (Still, the above derivation is not at the most detailed level compared to how tricky it is).

Now we have prepared the Q-function 7 and established the E step, which is to calculate (using Bayes’ Rule), we can go ahead and optimize the Q-function. Before doing so, we should notice the constraints: and , we can include Lagrange multipliers and into the Q-function to form a complete objective function:

(8) Setting equation 8 to zero w.r.t. to parameters and yields:

(9) By substituting equation 9 into normalization constraints and , we find a closed form to our maximized parameters estimation:

(10) To summarize, the EM algorithm for solving pLSA is:

Initialization:

Initialize the parameters and (note that implementation-wise, for , random is better than uniform, which will get stuck, for , uniform is better than random)

E step: M step  ## Appendix

Two more general ways of understanding EM:

Lower bound optimization: given we are optimizing an objective function includes latent variables , since this is directly difficult, we apply Jensen’s inequality in a specific way (see E.q. 2) to get a lower bound of original objective, now the trick of EM is that we improve the objective function by improving the tight lower bound: in E step, we estimate the distribution of latent variable such that (after E step) lower bound is equal to the objective (to do so, the equality condition of Jensen’s equality is used); in M step, we optimize the lower bound w.r.t. parameters (getting rid of constant, M step is optimizing Q-function), since from E step, the objective is tightly lower bounded, the improvement of the objective in M step is guaranteed to be greater or equal to the improvement of the lower bound. Repeat E and M steps, you can see 1. the objective will not decrease (as the lower bound will not decrease) 2. the objective will converge, since it will not decrease, and there must be a upper limit.

Similar to lower bound optimization point of view, what is shown on Bishop’s book “Pattern Recognition and Machine Learning”, chapter 9.4 is even more general. I very much recommend readers to take a look at it.

The end.

 T. Hofmann, “Probabilistic latent semantic analysis,” in Proceedings of the fifteenth conference on uncertainty in artificial intelligence, 1999, pp. 289-296.
[Bibtex]
@inproceedings{hofmann1999probabilistic,
title={Probabilistic latent semantic analysis},
author={Hofmann, Thomas},
booktitle={Proceedings of the Fifteenth conference on Uncertainty in artificial intelligence},
pages={289--296},
year={1999},
organization={Morgan Kaufmann Publishers Inc.}
}
 T. Hofmann, “Unsupervised learning by probabilistic latent semantic analysis,” Machine learning, vol. 42, iss. 1-2, pp. 177-196, 2001.
[Bibtex]
@article{hofmann2001unsupervised,
title={Unsupervised learning by probabilistic latent semantic analysis},
author={Hofmann, Thomas},
journal={Machine learning},
volume={42},
number={1-2},
pages={177--196},
year={2001},
publisher={Springer}
}