Natural Language Processing · Intermediate level

Intermediate level · Module 6: Topic Modelling and Document Analysis · Lesson 2 of 3

Choosing and Labelling Topics

Learners compare models with different numbers of topics, label topics from top words and representative documents, and identify junk topics.

In this lesson you will

  • Choose a number of topics with evidence
  • Label topics reliably

Key concepts

number of topicsperplexitycoherence (qualitative)representative documentsjunk topics

The lesson

There is no single correct number of topics. Fit models with, for example, 5, 8 and 12 topics. Perplexity (lda.perplexity(X), lower is better) gives a rough statistical guide, but the main test is whether people can interpret the topics and use them.

Label a topic from its top words and its most representative documents (those with the highest share of the topic). A label like 'school fees and exams' should be confirmed by reading at least five documents.

Junk topics, made of names, dates or boilerplate words, signal that preprocessing should remove those terms. Fix the data and refit rather than hiding them.

Step by step

  1. Fit models with 5, 8 and 12 topics and record perplexity.
  2. For the best candidate, read five representative documents per topic.
  3. Label each topic and mark any junk topics.
  4. Improve preprocessing for junk topics and refit.

Practice activity

Produce a labelled topic table with top words, labels and representative document titles.

Expected result: Evidence-based labels and a justified number of topics.

Check your understanding

  1. How should a topic be labelled?

    Show answer

    From its top words and by reading its most representative documents.

  2. What does a topic full of names and dates suggest?

    Show answer

    Preprocessing should remove or handle those terms.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.