Topic Coherence
Run a topic model and you get lists of words. One list reads patient, hospital, doctor, nurse, treatment; another reads back, thing, also, number, time. Both are statistically valid topics. Only one means anything, and topic coherence is how that difference gets measured without asking a person.
Measuring whether words belong together
Coherence scores a topic by how often its top-ranked words co-occur in real text. Take the top ten words, form every pair, and look up how frequently each pair turns up together in a reference corpus — the model's own documents or a large external one such as Wikipedia. The variants differ in the statistic used:
- UMass coherence uses the conditional log-probability of one word given a higher-ranked one, computed on the training documents;
- UCI coherence uses pointwise mutual information over a sliding window in an external corpus;
- C_V combines a sliding window, normalised PMI and cosine similarity, and tracked human ratings best in Röder's comparison — it is gensim's CoherenceModel default.
What it is used for
Topic models have no natural answer to how many topics to fit. Coherence turns that into a search: train LDA or NMF across a range of topic counts, score each, take the peak. It also flags junk topics in a fitted model — the ones built from stop words that survived preprocessing, or from boilerplate footers. Perplexity will not do this job: held-out likelihood correlates poorly with how interpretable a human finds the topics.
The caveat
A coherence number is a proxy, and only as good as the reference corpus and window behind it. Scores from different variants or corpora are not comparable, and a winning model still needs its topics read before anyone trusts them.
Topic coherence is a family of automatic measures that score how interpretable a learned topic is, by checking how often its highest-weighted words co-occur in a reference corpus using statistics such as pointwise mutual information. It replaces human judgement when selecting the number of topics or comparing topic models, a job perplexity does badly because held-out likelihood tracks interpretability poorly. Scores are comparable only within one measure and corpus.
Imagine someone hands you five words and asks whether they belong together. Doctor, nurse, hospital, patient, surgery — obviously yes. Doctor, bicycle, Tuesday, cheese, almost — obviously not. You can tell instantly, because you know which words keep company in real life.
Topic coherence is a way for software to make that same judgement by itself. When a program sorts a pile of documents into themes, each theme comes out as a list of words. Coherence checks how often those words actually appear near each other in ordinary writing. A high score means the theme hangs together and a person would recognise it; a low one means the program has grouped words that have nothing to do with each other.