AidText

Number of topics

Fit LDA at each number of topics in a range and see which number the perplexity and coherence scores point to.

How many LDA topics? Perplexity and coherence

The problem of choosing a number

LDA needs to be told how many topics to find, and the choice changes the result. Too few and themes are lumped together, too many and one theme is spread over several topics. This tool fits a model at every number in a range and measures each one, so the choice can be argued for.

What each measure tells you

Coherence (c_v and u_mass) asks whether the top words of a topic belong together, and comes closest to what a reader would say. Perplexity asks how well the model predicts the text: look for the point where its fall levels off. Silhouette asks how cleanly passages separate by topic. BIC and AIC weigh the fit against the number of topics.

Reading the recommendation

The recommended number takes the coherence peak first, then the perplexity elbow, then the silhouette peak, and the report shows what each of them points to. When they agree, the choice is easy. When they do not, take two or three candidates, fit LDA at each and keep the one whose topics you can name.

Topics and clusters

What a pile of documents is about, without reading every one.

All tools · Privacy