Foundations to Frontier
Tests
D. Classical Machine Learning › D14 Topic Models

Probabilistic Latent Semantic Analysis (pLSA)

Probabilistic latent semantic analysis (Hofmann, 1999) recast latent semantic analysis as a probabilistic model: each document has a distribution over latent topics p(z | d), each topic a distribution over words p(w | z), and every observed word is explained as p(w | d) = Σ_z p(z | d) p(w | z). Fitting by expectation–maximisation alternates computing each word occurrence's topic responsibilities with re-estimating both distributions from the weighted counts, and the likelihood never decreases. pLSA was the first widely used probabilistic topic model and is equivalent to non-negative matrix factorisation with a KL-divergence loss. Its weakness is structural: the document mixtures are free parameters, so their number grows with the corpus, the model overfits, and new documents need an ad hoc 'folding-in' step. Hofmann's tempered EM was one fix; LDA's Dirichlet prior on the mixtures is the principled one. This page covers the aspect model, EM updates and monotonicity, the link to NMF and LSA, parameter growth, folding-in, tempered EM and the move to LDA. In the exercises you implement pLSA by EM; then you compare its overfitting with tempered EM and LDA as the number of topics grows.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Every word chooses a topic

Imagine each document has a recipe (“70% space, 30% music”), each topic has a favourite set of words, and each word in the document was produced by first picking a topic from the recipe and then a word from that topic. pLSA learns the recipes and the topics from word counts by repeatedly guessing which topic produced each word and updating its estimates. It is the direct ancestor of LDA, and comparing the two shows why priors matter.

pLSA: a free topic mixture for every document, and the overfitting that follows
trainingheld-out
perplexity: training 18.50 · held-out 37.17 · free parameters 522 for 900 training words
The data have 4 true topics (one band of 10 words each, visible in the strips when the fit is good). With K near 4 the gap between training and held-out perplexity is smallest. Raise K and training perplexity keeps falling while held-out perplexity climbs: each document's private mixture, plus surplus topics, memorises the training words. Part of the held-out penalty comes from folding-in itself, since a 16-topic mixture estimated from 15 words overfits too. Tempering (β < 1) softens the E-step and narrows the gap. LDA replaces the per-document parameters with a Dirichlet prior.
Why engineers care

pLSA’s EM algorithm is the clearest worked example of fitting a latent-variable mixture to count data. It is also equivalent to non-negative matrix factorisation with a KL loss, a tool used for spectra, sensor activity patterns and usage logs. Its overfitting behaviour explains why Bayesian priors became standard.

📝 Quick check (Level 0)
0/3 answered
  1. 1. In pLSA, each word is generated by…
  2. 2. pLSA is fitted by…
  3. 3. pLSA's document mixtures are…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The aspect model and EM by hand

Model. p(w | d) = Σ_z p(z | d) p(w | z). With p(z | d) = (0.2, 0.8) and topics (1, 0, 0) and (0, ½, ½), the word probabilities are (0.2, 0.4, 0.4).

E-step. For each document–word pair, compute the topic responsibilities:

p(z | d, w) ∝ p(z | d) p(w | z).

With p(z | d) = (½, ½) and p(w | z) = (0.3, 0.1): (0.75, 0.25).

M-step. Re-estimate from expected counts n(d, w) p(z | d, w):

  • p(w | z) ∝ Σ_d n(d, w) p(z | d, w);
  • p(z | d) ∝ Σ_w n(d, w) p(z | d, w).

Log-likelihood. L = Σ_d Σ_w n(d, w) log p(w | d). EM never decreases it.

Parameters. D(K − 1) + K(V − 1): 686 for 150 documents, 4 topics and 60 words. Doubling the documents roughly doubles the count, because the document mixtures are free parameters.

The steps in plain English:

  1. Initialise p(z | d) and p(w | z) randomly.
  2. E-step: responsibilities for every observed document–word pair.
  3. M-step: renormalise the weighted counts into both distributions.
  4. Repeat until the log-likelihood stops improving; for new documents, fold in by running EM on p(z | d) with p(w | z) fixed.
📝 Quick check (Level 1)
0/3 answered
  1. 1. The E-step computes…
  2. 2. EM's log-likelihood over iterations is…
  3. 3. New documents in pLSA need…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

pLSA = KL-NMF. Writing the document–word count matrix as approximately WH, with W the document–topic weights and H the topic–word weights, and minimising the generalised KL divergence gives exactly pLSA’s EM updates, up to normalisation (Gaussier and Goutte, 2005; Ding et al., 2008). LSA does the same with squared error and no non-negativity.

Overfitting. Each document’s mixture is fitted to its own words. With many topics and short documents, each document can choose a mixture that explains its particular words almost exactly, so training perplexity keeps falling as K grows while held-out perplexity rises. Folding-in also estimates a fresh mixture from a few observed words, which overfits in turn.

Fixes.

  • Tempered EM (Hofmann): raise the E-step posteriors to a power β < 1, softening assignments, and choose β on held-out data.
  • LDA: put a Dirichlet prior on p(z | d), making the mixtures random variables rather than parameters, so the parameter count no longer grows with the corpus and new documents are handled by the generative model.

Exercise 1 (150 documents from 4 topics):

  • the log-likelihood rose monotonically from −26 360 to −18 477;
  • the recovered topics matched the truth with cosine 0.999, 1.000, 1.000, 1.000;
  • the model has 686 free parameters, 3 per document for the mixtures.
from sklearn.decomposition import NMF
W = NMF(n_components=4, beta_loss="kullback-leibler", solver="mu", max_iter=500).fit_transform(counts)
# rows of W and of nmf.components_, renormalised, give p(z | d) and p(w | z) as in pLSA
🐍 Exercise 1: pLSA by EM
Implement the EM algorithm for the aspect model (with optional tempering), check that the log-likelihood never decreases, recover known topics, and implement folding-in for new documents.
📝 Quick check (Level 2)
0/3 answered
  1. 1. pLSA is equivalent to non-negative matrix factorisation with…
  2. 2. pLSA's parameter count grows with…
  3. 3. Tempered EM uses an exponent β…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

EM as minorisation. The log-likelihood is bounded below by Σ n(d, w) Σ_z q(z) log(p(z | d) p(w | z)/q(z)) for any q. The E-step makes the bound tight (q = posterior), and the M-step maximises it in closed form. That proves monotonicity, but not convergence to the global optimum. pLSA has many local optima, so several restarts are standard.

Is pLSA a generative model? Only for the training documents: d is an index, and there is no distribution for generating a new document’s mixture. Blei et al. (2003) cited this as the motivation for LDA. Girolami and Kabán (2003) showed that pLSA is a maximum a posteriori special case of LDA with a uniform Dirichlet prior (α = 1).

Interview questions.

  • pLSA or LDA? LDA for most purposes: it handles new documents in a principled way, regularises, and its parameter count does not grow with the corpus. pLSA or KL-NMF remain useful as fast, deterministic baselines and when the corpus is fixed.
  • How does pLSA relate to LSA? LSA is a truncated SVD of the (weighted) document–term matrix, with squared error and possibly negative values. pLSA is a probabilistic, non-negative factorisation with a likelihood objective.
📝 Quick check (Level 3)
0/3 answered
  1. 1. The EM E-step makes the lower bound…
  2. 2. pLSA corresponds to MAP estimation in LDA with…
  3. 3. Because pLSA has many local optima, practitioners…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Overfitting as topics grow

History.

  • S. Deerwester et al. (1990) introduced LSA.
  • T. Hofmann (1999) introduced pLSA and tempered EM.
  • D. Lee and H. S. Seung (1999, 2001) introduced NMF and its multiplicative updates.
  • D. Blei, A. Ng and M. Jordan (2003) introduced LDA.
  • M. Girolami and A. Kabán (2003) related pLSA to LDA.
  • E. Gaussier and C. Goutte (2005) related pLSA to NMF.

Exercise 2. Only 40 short training documents (40 words each) generated from 4 topics over 60 words. Each cell gives training perplexity, then held-out document-completion perplexity on 60 new documents: folding-in for pLSA, and variational inference for LDA.

K pLSA pLSA, tempered (β = 0.8) LDA
2 14.12, 16.93 14.25, 16.26 14.36, 16.74
4 9.11, 11.42 9.18, 10.08 9.27, 9.34
8 8.65, 13.02 9.03, 10.10 9.07, 9.48
16 8.15, 17.64 8.84, 10.23 9.11, 9.64
  • pLSA overfitted as K grew: training perplexity fell to 8.15 at K = 16 while held-out perplexity nearly doubled, to 17.64, worse than with just 2 topics.
  • Tempered EM held the held-out perplexity near 10 for every K above 2, at the cost of a slightly worse training fit.
  • LDA was the most robust (9.3–9.6 for K ≥ 4), with training and held-out perplexity close together. The Dirichlet prior keeps short documents from claiming idiosyncratic mixtures, and its inference for new documents is principled rather than ad hoc folding-in.
🐍 Exercise 2 (research): overfitting in pLSA, tempered EM and LDA
With a small corpus from 4 topics, fit pLSA, tempered pLSA (β = 0.8) and variational LDA for K = 2, 4, 8, 16, and compare training perplexity with held-out document-completion perplexity.

pLSA and KL-NMF in AI, robotics and aerospace

  • Spectral unmixing: decomposing non-negative spectra (vibration, acoustic, hyperspectral) into source signatures with KL-NMF.
  • Usage patterns: latent “modes” in counts of events per flight or per asset.
  • Fixed-corpus topic summaries: quick deterministic topic baselines for a closed set of reports.

References

  1. T. Hofmann (1999). “Probabilistic latent semantic analysis.” Proc. UAI.
  2. T. Hofmann (2001). “Unsupervised learning by probabilistic latent semantic analysis.” Machine Learning 42(1–2).
  3. M. Girolami, A. Kabán (2003). “On an equivalence between PLSI and LDA.” Proc. ACM SIGIR.
  4. E. Gaussier, C. Goutte (2005). “Relation between PLSA and NMF and implications.” Proc. ACM SIGIR.
  5. D. D. Lee, H. S. Seung (2001). “Algorithms for non-negative matrix factorization.” Advances in NeurIPS 13.