Probabilistic latent semantic analysis (pLSA; Hofmann, 1999b) models each document's words as a mixture of $K$ topics, $P(w \mid d) = \sum_z P(w \mid z) P(z \mid d)$, and fits the topics and mixtures by expectation-maximization. It derives EM's updates from a lower bound on the log-likelihood, proves no iteration lowers the likelihood, and shows the limits: EM stops at a point its steps cannot improve, and a parameter that reaches zero stays zero. On six toy documents with $K = 2$, 20 random starts ended at four log-likelihood values; the best, −10.55, splits a sea topic from a travel topic. pLSA overfits, with $K(M-1) + N(K-1)$ parameters that grow with the collection, and gives a new document no probability: the weaknesses LDA addresses.
On the six documents, latent semantic indexing separated the sea from travel and brought $d_2$ (boat ocean) and $d_3$ (ship) together. But its rank-2 matrix gives $d_2$ $-0.39$ of the word trip, and its coordinates are not proportions of anything. What would the same idea look like if every number in it were a probability?
Probabilistic latent semantic analysis (pLSA) is that model. Hofmann (1999a, 1999b) kept LSI's idea, a small number of latent factors explaining word co-occurrence, and replaced its squared error, which has no natural interpretation for word counts, with a probability model. pLSA, called probabilistic latent semantic indexing (pLSI) when used for retrieval, was the first model to describe documents as mixtures of topics, each topic a distribution over words.
First we state the model and draw it in a triangle. Then we derive the expectation-maximization algorithm that fits it, and run two iterations by hand on the six documents. Finally we find the two weaknesses that led to its successor. The course first met EM in the 2-Poisson model, which stated its steps for one mixture. Model-based clustering is the site's home for the general derivation of EM: the lower bound from Jensen's inequality, the two steps, and the proof that the likelihood never decreases. This article carries that derivation out for pLSA, with the model's own E-step and both M-step updates in full.
The aspect model
pLSA introduces a hidden variable $z$, the topic or aspect, taking one of $K$ values. Each word occurrence in a document is explained by a topic: the document chooses a topic, and the topic chooses a word. The probability of word $w$ appearing in document $d$ is
$$P(w \mid d) = \sum_{z=1}^{K} P(w \mid z)\, P(z \mid d).$$
- $P(w \mid z)$ is the topic's distribution over words, shared by all documents.
- $P(z \mid d)$ is the document's mixture of topics, its own set of proportions.
The generative story
Hofmann (1999b, §3.1, eq. 1) defines the model as a joint distribution over document-word pairs, $P(d, w) = P(d) P(w \mid d)$, with $P(w \mid d)$ the mixture above. Read as a recipe, it generates the collection's word occurrences one $(d, w)$ pair at a time:
- Pick a document $d$ with probability $P(d)$.
- Pick a topic $z$ with probability $P(z \mid d)$.
- Pick a word $w$ with probability $P(w \mid z)$.
Only the pair $(d, w)$ is recorded; $z$ is discarded. The probability of a pair is $P(d, w) = P(d) \sum_z P(w \mid z) P(z \mid d)$. The model's one structural assumption is that $d$ and $w$ are conditionally independent given $z$. Once the topic is known, which document the word came from tells nothing more about which word it is. Since $K$ is much smaller than the number of documents or words, $z$ acts as a bottleneck through which everything a document says about its words must pass.
By Bayes' rule, the same model can be written symmetrically in documents and words (Hofmann, 1999b, eq. 2):
$$P(d, w) = \sum_{z} P(z)\, P(d \mid z)\, P(w \mid z).$$
Here a topic is picked first, and it generates both a document and a word. The two forms define the same set of distributions, and the symmetric one makes the resemblance to LSI plain, as Hofmann points out. Written as matrices, it is $\hat{P} = U_z \Sigma_z V_z^{\mathsf{T}}$, with $U_z$ holding $P(d \mid z)$, $\Sigma_z$ the diagonal of $P(z)$, and $V_z$ holding $P(w \mid z)$. That is a factorization with the shape of the SVD, but with every entry a probability.
The next subsection draws the bottleneck and shows what it costs.
The geometry
Each document's word distribution is a weighted average of $K$ topic distributions. With a vocabulary of $M$ words, every word distribution is a point in an $(M-1)$-dimensional simplex. The model forces all of a collection's document distributions into the sub-simplex whose corners are the $K$ topics, of at most $K-1$ dimensions. That sub-simplex is the probabilistic counterpart of LSI's rank-$k$ subspace (Hofmann, 1999b, §3.3). Unlike LSI's dimensions, the topics and the mixture weights are probabilities: nonnegative, summing to 1, and readable as "this document is two-thirds about the sea".
With three words the simplex is a triangle and can be drawn. Restrict the example to ship, ocean, and voyage (dropping $d_6$, which contains none of them) and fit two topics:
The best fit (log-likelihood −4.68, from 20 random starts) puts one topic at ship 0.5, ocean 0.5 and the other at voyage 1.0. Documents that the segment cannot reach are moved to the point on it that loses least likelihood, and that loss is the price of describing five documents with two topics.
Example (documents the fit does not move). Restricted to these three words, $d_4$ and $d_5$ both say only voyage. They sit at the voyage corner of the triangle and stay there: that corner is itself a topic, so the model reproduces them exactly. Only $d_2$ and $d_3$ pay the price of the bottleneck here. The next section shows how such a fit is found.
Fitting the model
With $n(d, w)$ the number of times word $w$ occurs in document $d$, the parameters are chosen to maximize the log-likelihood of the collection:
$$\mathcal{L} = \sum_{d} \sum_{w} n(d, w) \log \sum_{z} P(w \mid z)\, P(z \mid d).$$
(The factor $P(d)$ is dropped: its maximum-likelihood value is each document's share of the words, and it does not interact with the other parameters.) The sum inside the logarithm makes this hard to maximize directly. If the topic of every word occurrence were known, the estimates would be simple counts. They are not known. That is the situation expectation-maximization (EM) handles (Dempster, Laird, and Rubin, 1977), as it did for the 2-Poisson model. Starting from random parameters, EM alternates two steps:
- E-step. For each document and word, compute the probability that each topic produced it (a posterior of the kind the RAG models compute over retrieved passages): $$P(z \mid d, w) = \frac{P(w \mid z)\, P(z \mid d)}{\sum_{z'} P(w \mid z')\, P(z' \mid d)}.$$
- M-step. Re-estimate the parameters from the expected counts, as if each occurrence were divided among topics in those proportions: $$P(w \mid z) \propto \sum_{d} n(d, w)\, P(z \mid d, w), \qquad P(z \mid d) \propto \sum_{w} n(d, w)\, P(z \mid d, w).$$
Each round never decreases the log-likelihood, as the derivation below proves. The log-likelihood is a sum of logarithms of probabilities, so it is at most 0, and a sequence that never decreases and is bounded above converges. So the values of $\mathcal{L}$ settle. Where they settle depends on the start, as with k-means. If the parameters settle, they settle at a point that EM's two steps cannot improve, which need not be the best fit. The derivation does not prove that the parameters must settle; in every run on this page they do. Hofmann (1999b, eqs. 3 to 6) gives the same steps for the symmetric form, with $P(d \mid z)$ and $P(z)$ in place of $P(z \mid d)$.
Deriving the two steps
The updates are not guesses; they follow from a lower bound on $\mathcal{L}$. Here is the plan of the derivation. We build a function $F$ below the log-likelihood everywhere. The E-step lifts $F$ to touch $\mathcal{L}$ at the current parameters, and the M-step climbs $F$; since $\mathcal{L}$ lies above $F$, it climbs at least as far.
- Introduce a distribution over topics for each pair. For every $(d, w)$, let $q_{dw}(z)$ be any probability distribution over the $K$ topics. Multiply and divide inside the logarithm: $$\log \sum_z P(w \mid z) P(z \mid d) = \log \sum_z q_{dw}(z)\, \frac{P(w \mid z) P(z \mid d)}{q_{dw}(z)}.$$
- Apply Jensen's inequality. The logarithm is concave, so the log of an average is at least the average of the logs (Probability Inequalities proves the inequality for every concave function): $$\log \sum_z q_{dw}(z)\, \frac{P(w \mid z) P(z \mid d)}{q_{dw}(z)} \;\ge\; \sum_z q_{dw}(z) \log \frac{P(w \mid z) P(z \mid d)}{q_{dw}(z)}.$$ Weighting by $n(d, w)$ and summing gives a lower bound $F(q, \text{parameters}) \le \mathcal{L}$ that holds for every choice of $q$.
- The E-step makes the bound tight. The bound is an equality when $q_{dw}(z)$ is the posterior $P(z \mid d, w)$ of the E-step; model-based clustering proves the general statement, for any mixture. For pLSA, substituting the posterior shows it directly: with $q_{dw}(z) = P(w \mid z) P(z \mid d) / \sum_{z'} P(w \mid z') P(z' \mid d)$, the ratio inside the logarithm on the right is $\sum_{z'} P(w \mid z') P(z' \mid d)$ for every $z$, so the right side is the logarithm of that sum, which is the left side. With that $q$, $F = \mathcal{L}$ at the current parameters.
- The M-step maximizes the bound. With $q$ fixed, $F$ is
$$F = \sum_{d,w} n(d,w) \sum_z q_{dw}(z) \left[ \log P(w \mid z) + \log P(z \mid d) \right] - \sum_{d,w} n(d,w) \sum_z q_{dw}(z) \log q_{dw}(z),$$
and the parameters appear only in the first sum. That sum splits into one piece for each topic's word distribution and one piece for each document's mixture. Each piece has its own constraint and can be maximized by itself.
- The topics. Write $a_{zw} = \sum_d n(d,w)\, q_{dw}(z)$, the expected number of occurrences of word $w$ credited to topic $z$. The piece for topic $z$ is $\sum_w a_{zw} \log P(w \mid z)$, to be maximized subject to $\sum_w P(w \mid z) = 1$. With a Lagrange multiplier $\lambda_z$, set the derivative of $\sum_w a_{zw} \log P(w \mid z) - \lambda_z \left( \sum_w P(w \mid z) - 1 \right)$ with respect to $P(w \mid z)$ to zero: $a_{zw} / P(w \mid z) - \lambda_z = 0$, so $P(w \mid z) = a_{zw} / \lambda_z$. Summing over $w$ and using the constraint gives $\lambda_z = \sum_w a_{zw}$. So $P(w \mid z) = a_{zw} / \sum_{w'} a_{zw'}$, the first update.
- The mixtures. Write $b_{dz} = \sum_w n(d,w)\, q_{dw}(z)$, the expected number of document $d$'s occurrences credited to topic $z$. The piece for document $d$ is $\sum_z b_{dz} \log P(z \mid d)$, to be maximized subject to $\sum_z P(z \mid d) = 1$. With a multiplier $\mu_d$, the derivative of $\sum_z b_{dz} \log P(z \mid d) - \mu_d \left( \sum_z P(z \mid d) - 1 \right)$ with respect to $P(z \mid d)$ is $b_{dz} / P(z \mid d) - \mu_d$. Setting it to zero gives $P(z \mid d) = b_{dz} / \mu_d$, and the constraint gives $\mu_d = \sum_z b_{dz}$. Each $q_{dw}$ sums to 1 over $z$, so $\mu_d = \sum_w n(d,w)$, the length of the document. So $P(z \mid d) = b_{dz} / \sum_w n(d,w)$, the second update.
- Why each stationary point is the maximum. Both pieces have the form $\sum_i c_i \log p_i$, with weights $c_i \ge 0$ of total $c > 0$ and $p$ a probability distribution. The updates set $p_i = c_i / c$. For any other distribution $p$, Jensen's inequality over the indices with $c_i > 0$ gives $$\sum_i c_i \log p_i - \sum_i c_i \log \frac{c_i}{c} = c \sum_{i:\, c_i > 0} \frac{c_i}{c} \log \frac{p_i}{c_i / c} \le c \log \sum_{i:\, c_i > 0} p_i \le c \log 1 = 0.$$ So no distribution gives a piece a larger value than its update does. Later articles use this fact again; call it the weighted-log inequality.
- Why the likelihood cannot fall. With $\theta$ the old parameters and $\theta'$ the new, $\mathcal{L}(\theta') \ge F(q, \theta') \ge F(q, \theta) = \mathcal{L}(\theta)$, by steps 2, 4 and 3. This is the monotonicity of EM, proved in general in model-based clustering, and for models with any kind of missing data in The EM Algorithm.
Two consequences are visible in the derivation. First, EM climbs, but only to a point where no single E-step and M-step can improve; nothing guarantees that this is the global maximum. The second is easier to miss.
Example (a zero stays zero). If a start sets $P(\text{boat} \mid z_2) = 0$, EM can never give boat positive probability in topic 2. The E-step's numerator for topic 2 contains $P(\text{boat} \mid z_2)$, so every boat gets posterior 0 for that topic, and the M-step gives it an expected count of 0. A parameter that reaches zero stays at zero, since every update multiplies by it, so a start with zeros can never discover the words or topics it excluded.
Two iterations by hand
Back to the six documents: run EM with $K = 2$ from a fixed start that leans slightly toward the sea in topic 1 and toward travel in topic 2, with every document's mixture even:
| ship | boat | ocean | voyage | trip | |
|---|---|---|---|---|---|
| $P(w \mid z_1)$ | 0.30 | 0.20 | 0.20 | 0.15 | 0.15 |
| $P(w \mid z_2)$ | 0.15 | 0.15 | 0.20 | 0.30 | 0.20 |
and $P(z_1 \mid d) = P(z_2 \mid d) = 0.5$ for all six documents. Every document then has the same predicted distribution, $P(w \mid d) = (0.225, 0.175, 0.200, 0.225, 0.175)$. The log-likelihood of the ten word occurrences is $\mathcal{L} = -15.906$. Values below are from plsa_trace.py in tools/experiments/topics/, rounded to three or four decimals.
Iteration 1, E-step. For ship in $d_1$ the numerators are $P(\text{ship} \mid z_1) P(z_1 \mid d_1) = 0.30 \times 0.5 = 0.150$ and $0.15 \times 0.5 = 0.075$. So $P(z_1 \mid d_1, \text{ship}) = 0.150 / 0.225 = 0.667$. Because every mixture is still even, the posterior depends only on the word, and it is the same in every document:
| Word | ship | boat | ocean | voyage | trip |
|---|---|---|---|---|---|
| $P(z_1 \mid d, w)$ | 0.667 | 0.571 | 0.500 | 0.333 | 0.429 |
Iteration 1, M-step. Each occurrence is split between the topics in those proportions. ship occurs twice, so it contributes $2 \times 0.667 = 1.333$ expected occurrences to topic 1 and 0.667 to topic 2. voyage, three times, contributes 1.0 and 2.0. Topic 1 receives 4.762 expected occurrences in all and topic 2 receives 5.238. Dividing each word's expected count by its topic's total:
| ship | boat | ocean | voyage | trip | |
|---|---|---|---|---|---|
| $P(w \mid z_1)$ | 0.280 | 0.120 | 0.210 | 0.210 | 0.180 |
| $P(w \mid z_2)$ | 0.127 | 0.082 | 0.191 | 0.382 | 0.218 |
Each document's mixture is its share of expected occurrences. $d_3$ (ship) has one occurrence, 0.667 of it in topic 1, so $P(z_1 \mid d_3) = 0.667$. $d_1$ has 1.5 of its 3 occurrences in topic 1, so it stays at 0.5:
| $d_1$ | $d_2$ | $d_3$ | $d_4$ | $d_5$ | $d_6$ | |
|---|---|---|---|---|---|---|
| $P(z_1 \mid d)$ | 0.500 | 0.536 | 0.667 | 0.381 | 0.333 | 0.429 |
The log-likelihood rises to $-15.242$. The bound of the derivation shows the mechanism at work:
- at the old parameters, with $q$ the posterior, $F = -15.906 = \mathcal{L}$;
- at the new parameters with the same $q$, $F = -15.397$;
- the true log-likelihood at the new parameters, $-15.242$, is higher still.
Iteration 2. Now the mixtures differ, so the same word gets different posteriors in different documents. For ship in $d_3$ the numerators are $0.280 \times 0.667 = 0.187$ and $0.127 \times 0.333 = 0.042$, so the posterior is 0.815. For ship in $d_1$, whose mixture is still even, it is 0.688. A document's other words pull each of its words toward the document's dominant topic:
| Occurrence | $P(z_1 \mid d, w)$ | Occurrence | $P(z_1 \mid d, w)$ |
|---|---|---|---|
| $d_1$ ship | 0.688 | $d_3$ ship | 0.815 |
| $d_1$ ocean | 0.524 | $d_4$ voyage | 0.253 |
| $d_1$ voyage | 0.355 | $d_4$ trip | 0.337 |
| $d_2$ boat | 0.629 | $d_5$ voyage | 0.216 |
| $d_2$ ocean | 0.559 | $d_6$ trip | 0.382 |
Example (the mixture of a one-word document). $d_3$'s new mixture is $P(z_1 \mid d_3) = 0.815$, and it can be read off before the M-step is run. $d_3$ contains a single word, ship, whose posterior in iteration 2 is 0.815. A document's mixture is its share of expected occurrences, and $d_3$ has only one, so its mixture is that occurrence's posterior, as in iteration 1.
The M-step gives $P(w \mid z_1) = (0.316, 0.132, 0.228, 0.173, 0.151)$ and $P(w \mid z_2) = (0.095, 0.071, 0.175, 0.415, 0.244)$. The mixtures are $P(z_1 \mid d) = (0.522, 0.594, 0.815, 0.295, 0.216, 0.382)$, with 0.815 for $d_3$ as the example said, and the log-likelihood is $-14.678$.
Afterward. The separation feeds on itself. The log-likelihood over the first ten iterations is $-15.906$, $-15.242$, $-14.678$, $-13.571$, $-12.050$, $-10.970$, $-10.650$, $-10.589$, $-10.571$, $-10.563$, $-10.558$. It settles at $-10.549$ by iteration 50. The parameters approach a limit that puts ship 0.4, ocean 0.4, boat 0.2 in topic 1 and voyage 0.6, trip 0.4 in topic 2, with every other probability tending to zero. From a start in which every parameter is positive, every update keeps them positive: each E-step numerator is a product of positive numbers, so each expected count is positive. The zeros are therefore reached only in the limit. Some are approached very fast. The smallest parameter is $5.5 \times 10^{-4}$ after 5 iterations and about $4 \times 10^{-49}$ after 10, and in the script's double-precision arithmetic it becomes exactly 0 at iteration 15, by underflow. The limit is the best solution, described next.
The example
Applied to the six documents with $K = 2$, EM run from 20 random starts ended at four different values of the log-likelihood. The best one, −10.55, belongs to this solution:
| Topic | Word probabilities |
|---|---|
| Sea | ship 0.40, ocean 0.40, boat 0.20 |
| Travel | voyage 0.60, trip 0.40 |
Documents $d_2$ (boat ocean) and $d_3$ (ship) are entirely sea, and $d_4$, $d_5$, and $d_6$ entirely travel. Document $d_1$, containing ship, ocean, and voyage, is two-thirds sea and one-third travel. The topics are the same division LSI's second dimension found, but expressed as distributions with no negative values.
Each probability is a simple count: the sea topic received the five sea-word occurrences (two of ship, one of boat, two of ocean), and the travel topic the three of voyage and two of trip. The other starts converged to worse solutions, with log-likelihoods −11.37, −11.61, and −12.14, showing the local maxima directly. The script is plsa_toy.py in tools/experiments/topics/.
The worse solutions divide the same ten occurrences differently (plsa_trace.py prints them). In each, as in the best one, every occurrence is credited wholly to one topic:
| Log-likelihood | Topic 1 | Topic 2 | Mixed documents |
|---|---|---|---|
| −11.37 | ship 2/7, voyage 3/7, trip 2/7 | boat 1/3, ocean 2/3 | $d_1$: 2/3 and 1/3 |
| −11.61 | ship 1/3, ocean 1/6, voyage 1/2 | boat 1/4, ocean 1/4, trip 1/2 | $d_4$: 1/2 and 1/2 |
| −12.14 | ship 1/3, voyage 1/2, trip 1/6 | boat 1/4, ocean 1/2, trip 1/4 | $d_1$: 2/3 and 1/3 |
| −12.14 | ship 1/2, ocean 1/4, voyage 1/4 | boat 1/6, ocean 1/6, voyage 1/3, trip 1/3 | none |
| −12.14 | ship 1/2, trip 1/2 | boat 1/6, ocean 1/3, voyage 1/2 | $d_1$: 1/3 and 2/3; $d_4$: 1/2 and 1/2 |
The first separates boat and ocean, the words of $d_2$, from everything else. The second puts the two occurrences of ocean in different topics. The lowest value is shared by three different solutions, whose likelihoods are all exactly $1/186{,}624$. So the 20 starts ended at six different solutions with four different values. Each is a point EM cannot leave, because of its zeros. Each also behaved as a local maximum under random search: of 9,000 small perturbations of each solution's parameters, none raised the log-likelihood. That is evidence from the script, not a proof.
Six of the 20 starts found the best solution, two reached −11.37, six −11.61, and six −12.14. The usual remedy is the one used here: run EM from many starts and keep the best.
Using it for retrieval
For retrieval, Hofmann (1999a) compared queries and documents through their topic mixtures, and combined the result with ordinary term matching. He reported better retrieval than LSI on four small test collections, among them Cranfield. That is his result; this site has not run pLSA for retrieval and reproduces none of his figures. A query, being a new document, has no $P(z \mid d)$ of its own. It is folded in by running EM on the query alone, with the topics $P(w \mid z)$ held fixed.
For the query boat ocean and the best solution above, both words have probability zero in the travel topic. In the E-step each query word therefore has posterior 1 for the sea topic, whatever the current mixture, provided the mixture gives the sea topic some weight. The M-step then sets the mixture to entirely sea, and further rounds change nothing. That is the mixture of $d_2$ and $d_3$, so both would be retrieved, as LSI retrieved them.
Relation to other methods
pLSA sits between LSI and the models that followed:
- LSI. Both factor the term-document matrix into $K$ factors. LSI minimizes squared error, which corresponds to Gaussian noise, and allows negative values. pLSA maximizes a multinomial likelihood, suited to counts, and keeps everything nonnegative.
- Nonnegative matrix factorization. This factors a nonnegative matrix into two nonnegative matrices. With the generalized Kullback–Leibler divergence as the measure of error, it optimizes the same objective as pLSA, and a pLSA solution is, after normalization, a solution of that NMF problem (Gaussier and Goutte, 2005). NMF is described in topic models beyond LDA.
- LDA. pLSA is a special case of LDA, the maximum a posteriori estimate when the Dirichlet prior on topic mixtures is uniform (Girolami and Kabán, 2003).
The best fit, though, is not what we want, as the next section shows.
Why pLSA was not the end
Example (a word the best fit rules out). Under the best solution, the model gives the word trip probability exactly 0 in $d_2$ (boat ocean). $d_2$ is entirely sea, the sea topic gives trip no probability, and $d_2$ has no travel in its mixture. That is overfitting, the first of two weaknesses, identified by Blei, Ng, and Jordan (2003), that led to latent Dirichlet allocation:
- The number of parameters grows with the collection. Every document has its own $K - 1$ free mixture weights, in addition to the $K(M - 1)$ topic parameters. A collection of $N$ documents therefore has $K(M-1) + N(K-1)$ parameters. In the example that is $2 \times 4 + 6 \times 1 = 14$ parameters for 10 word occurrences. A model with so much freedom fits the training documents closely and overfits. The best solution above gives five of the six documents a mixture of exactly 0 or 1. It says that $d_2$ and $d_3$ could never contain the word trip, or $d_4$ the word ship: $P(\text{trip} \mid d_2) = 0$. To reduce the problem, Hofmann used tempered EM, which raises the E-step's joint probabilities to a power $\beta < 1$ before normalizing (Hofmann, 1999b, §3.6, eq. 9, in the symmetric form): $$P_\beta(z \mid d, w) = \frac{\left[ P(z)\, P(d \mid z)\, P(w \mid z) \right]^{\beta}}{\sum_{z'} \left[ P(z')\, P(d \mid z')\, P(w \mid z') \right]^{\beta}}.$$ Since $P(z) P(d \mid z) = P(d) P(z \mid d)$ and $P(d)^\beta$ cancels, this is $[P(w \mid z) P(z \mid d)]^\beta$ normalized over $z$ in this article's notation. With $\beta = 1$ it is the ordinary E-step, and as $\beta$ falls toward 0 the posteriors move toward uniform, which softens the fit. For ship in $d_3$ at iteration 2 of the trace, the numerators 0.187 and 0.042 gave the posterior 0.815. With $\beta = 0.5$ their square roots, 0.4320 and 0.2060 before rounding the numerators, give $0.4320 / 0.6380 = 0.677$. Hofmann chose $\beta$ on held-out data: run ordinary EM with early stopping, then lower $\beta$ by a constant factor for as long as held-out performance improves.
- It is not a model of documents. The mixtures $P(z \mid d)$ are parameters attached to the training documents, with no account of where they come from. There is no principled probability for a new document, only the folding-in procedure, which fits new parameters for it.
LDA addresses both by treating each document's mixture as a random draw from a shared Dirichlet distribution. The number of parameters then depends only on $K$ and the vocabulary, and any document, seen or unseen, has a probability under the model.
The figures are drawn by tools/figures/probabilistic-latent-semantic-analysis.py.
Worked problems
The course had no assignment for this topic, and the course text has no exercises on pLSA. These four problems are posed on the six documents, and every number in them is checked by plsa_trace.py.
Problem 1 (the best solution, checked by hand). Show that the best solution of the example is left unchanged by one round of EM, and compute its log-likelihood.
The solution is a fixed point of EM, and its log-likelihood is $-10.549$. For the E-step, each word has positive probability in only one topic: ship, boat and ocean in the sea topic, voyage and trip in the travel topic. Every document that contains a word gives that word's topic positive weight, so every posterior $P(z \mid d, w)$ is 1 for the word's own topic and 0 for the other.
For the M-step, the expected counts are then plain counts. The sea topic receives ship twice, boat once and ocean twice, five occurrences, so $P(w \mid \text{sea}) = (2/5, 1/5, 2/5) = (0.4, 0.2, 0.4)$. The travel topic receives voyage three times and trip twice, so $P(w \mid \text{travel}) = (3/5, 2/5) = (0.6, 0.4)$. $d_1$ has two sea occurrences and one travel occurrence, so its mixture is $(2/3, 1/3)$, and every other document has all its occurrences in one topic. These are the parameters we started from.
For the log-likelihood, $d_1$'s word probabilities are $P(\text{ship} \mid d_1) = P(\text{ocean} \mid d_1) = \tfrac{2}{3} \times 0.4 = \tfrac{4}{15}$ and $P(\text{voyage} \mid d_1) = \tfrac{1}{3} \times 0.6 = 0.2$. The other documents take their probabilities straight from one topic:
| Document | Its occurrences' probabilities | Log-likelihood |
|---|---|---|
| $d_1$ = ship ocean voyage | $4/15$, $4/15$, $0.2$ | $2 \log \tfrac{4}{15} + \log 0.2 = -4.253$ |
| $d_2$ = boat ocean | $0.2$, $0.4$ | $-2.526$ |
| $d_3$ = ship | $0.4$ | $-0.916$ |
| $d_4$ = voyage trip | $0.6$, $0.4$ | $-1.427$ |
| $d_5$ = voyage | $0.6$ | $-0.511$ |
| $d_6$ = trip | $0.4$ | $-0.916$ |
The sum is $-10.549$, the value the trace converged to.
Problem 2 (folding in a new document). Fold the new document boat trip into the best solution: find its mixture with the topics held fixed, its log-likelihood, and the word distribution the model gives it.
The mixture is $(0.5, 0.5)$, reached in one round from any start that gives both topics some weight. boat has probability 0 in the travel topic and trip has probability 0 in the sea topic, so the E-step credits boat wholly to the sea and trip wholly to travel, whatever the current mixture. The M-step then gives each topic one of the two occurrences, and repeating the round changes nothing.
It is the maximum, not only a fixed point. With mixture $(\pi, 1 - \pi)$ the document's log-likelihood is $\log(0.2\pi) + \log(0.4(1 - \pi))$. Its derivative, $1/\pi - 1/(1 - \pi)$, is zero only at $\pi = 0.5$, positive below and negative above. The value there is $\log 0.1 + \log 0.2 = -3.912$. The fitted word distribution is the even mixture of the two topics, $(0.2, 0.1, 0.2, 0.3, 0.2)$ over ship, boat, ocean, voyage, trip. The model gives the new document probability for ship and voyage, which it does not contain. Unlike LSI's fold-in, which placed boat trip at $(0.39, 0.32)$ in a plane, the result is a pair of proportions.
Problem 3 (counting parameters on Reuters). The Reuters experiment of latent Dirichlet allocation has 7,769 training stories, a vocabulary of 6,855 words and 20 topics. Count pLSA's free parameters for it, and say what happens to the count if the collection doubles.
By the formula $K(M-1) + N(K-1)$, the topics take $20 \times 6{,}854 = 137{,}080$ parameters and the documents' mixtures $7{,}769 \times 19 = 147{,}611$, for $284{,}691$ in all. More than half belong to individual documents. With twice the stories and the same vocabulary, the mixtures take $15{,}538 \times 19 = 295{,}222$, and the total is $432{,}302$. The topic part stays fixed and the document part grows in proportion to the collection, which is the first weakness named above.
Problem 4 (a start that EM cannot improve). Start EM with both topics equal to the collection's overall word frequencies, $(0.2, 0.1, 0.2, 0.3, 0.2)$, and every document's mixture equal to $(0.5, 0.5)$. Find where EM goes.
Nowhere: this start is a fixed point, with log-likelihood $-15.571$, the unigram model's. In the E-step the two topics give every word the same probability, so the posterior of each occurrence is its document's mixture, $(0.5, 0.5)$. In the M-step each topic then receives half of every occurrence, so each topic's word distribution is again the overall word frequencies, and each document's mixture is again $(0.5, 0.5)$. The same happens for any common mixture $(\pi, 1 - \pi)$ in place of $(0.5, 0.5)$: each topic receives the share $\pi$ or $1 - \pi$ of every occurrence, and the shares cancel when the topic is normalized.
The point is far from a maximum. The best solution's log-likelihood is $-10.549$. EM stops wherever its two steps reproduce the parameters, and step 5 of the derivation promises only that the likelihood does not fall. This is why the trace began from a start in which the two topics lean different ways, and why practical runs start from random parameters.
What we have learned
pLSA keeps LSI's factorization and makes every factor a probability. It is fitted by EM, derived from a lower bound on the likelihood that the E-step makes tight and the M-step climbs. On the six documents, the best of 20 starts found a sea topic and a travel topic, with $d_1$ two-thirds sea; other starts stopped at five worse solutions, at three lower values of the likelihood.
The fit is too good: it gives $d_2$ no chance of ever containing trip, and it has no probability for a document it was not trained on. Latent Dirichlet allocation takes the next step: it draws each document's mixture from a distribution shared by the whole collection.
References
- Blei, D. M., Ng, A. Y., and Jordan, M. I. (2003). Latent Dirichlet allocation. Journal of Machine Learning Research, 3, 993–1022. record · 6 pages
- Dempster, A. P., Laird, N. M., and Rubin, D. B. (1977). Maximum likelihood from incomplete data via the EM algorithm. Journal of the Royal Statistical Society, Series B, 39(1), 1–38. record · 6 pages
- Gaussier, E., and Goutte, C. (2005). Relation between PLSA and NMF and implications. In Proceedings of SIGIR 2005, 601–602. record · 2 pages
- Girolami, M., and Kabán, A. (2003). On an equivalence between PLSI and LDA. In Proceedings of SIGIR 2003, 433–434. record
- Hofmann, T. (1999a). Probabilistic latent semantic indexing. In Proceedings of SIGIR 1999, 50–57. record
- Hofmann, T. (1999b). Probabilistic latent semantic analysis. In Proceedings of the Fifteenth Conference on Uncertainty in Artificial Intelligence (UAI 1999), 289–296. record · 2 pages
Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 12 revisions