Latent Dirichlet allocation (LDA): how documents mix topics
Understand LDA’s document and topic distributions, its word-generation idea, and the assumptions that limit interpretation.
Latent Dirichlet allocation (LDA) is a probabilistic topic model. It represents each document as a mixture of topics and each topic as a probability distribution over words. In the model’s generative story, a word first receives a topic drawn from that document’s topic mixture, then the word is drawn from the topic’s word distribution. Fitting LDA reverses this story to infer hidden distributions from observed text.
For a small illustrative corpus about gardening and cooking, one inferred topic might assign high probability to “seed,” “soil,” and “harvest,” while another favors “recipe,” “oven,” and “flavor.” A document about seeds failing after heavy rain could have weight on more than one topic. This is a schematic example, not an output from a fitted model. LDA assumes a fixed number of topics and the classic version treats a document as a bag of words, ignoring word order. Topics are statistical patterns, not guaranteed human concepts. Choose topic count with the analysis goal in mind; compare coherence and held-out fit where relevant, inspect representative documents, and check whether the topics remain useful under reasonable preprocessing or parameter changes.