Notes

Dirichlet Prior

Suppose a document is one paragraph long and every word in it concerns football. Should you conclude it is one hundred percent about sport and zero percent about anything else? A Dirichlet prior is the formal way of saying “mostly sport, but let's not be absolute on this little evidence”.

A distribution over distributions
A topic model describes a document as a mixture — 60% sport, 30% finance, 10% politics — which is itself a probability distribution. The Dirichlet is a distribution whose samples are such mixtures, controlled by a concentration parameter. It is the conjugate prior of the multinomial, and that is the whole reason it is used: posterior updating reduces to adding observed counts to the prior's parameters, which keeps Gibbs sampling and variational inference for LDA tractable.

What the settings actually do
Two Dirichlets appear in LDA, and both change the output visibly:

  • Alpha, over document-topic mixtures: below 1 pushes each document towards a few dominant topics, above 1 spreads it thinly across many.
  • Beta, over topic-word distributions: small values make topics sharp and built from a narrow set of words, larger values make them diffuse and hard to name.

Why it matters in practice
The prior is also what smooths the model: no word is assigned probability zero in a topic merely because it went unseen, and no short document collapses to an all-or-nothing mixture. Set alpha too high on a corpus of tweets and every tweet emerges as a bland blend of everything. gensim and scikit-learn expose both values as tunable or automatically estimated, and topic coherence is the usual way to judge the choice.

A Dirichlet prior is a probability distribution over probability distributions, used in topic models to state what document-topic and topic-word mixtures should look like before any text is read. As the conjugate prior of the multinomial it keeps inference in LDA tractable, and its concentration parameters control sparsity: low values give documents dominated by a few topics and topics built from few words, high values blur both.

Imagine judging a restaurant after a single visit. One disappointing meal does not prove the place is bad — you blend what you saw with a sensible general assumption about restaurants. That starting assumption is called a prior.

A Dirichlet prior is the version of that used when software sorts a pile of documents into themes. Before it reads anything, it holds a gentle belief about how themes are usually mixed: most articles are about one or two subjects, not forty at once. That belief keeps the software from leaping to wild conclusions about a short document, and a single dial decides how stubbornly the belief is held against the evidence.