Sub topic 1
What Topic Modelling Does and When to Use It
Topic modelling finds recurring themes in a collection of documents without requiring a human to label every document first. A topic is a group of words that often appear together and suggest a shared subject, such as football, elections, or software development.
Topic models are exploratory tools. They help you discover structure, organise a large corpus, and create features for later analysis. They do not automatically produce perfect human-readable categories. You must inspect and interpret their results.
Prerequisites
This chapter assumes that you know Python basics, tokenisation, stop words, TF-IDF, basic probability, and the general idea of vector embeddings.
Two meanings of “topic”
LDA and BERTopic use different working definitions of a topic.
| Method | How it represents a topic | Main signal |
|---|---|---|
| LDA | A probability distribution over words | Word counts and co-occurrence |
| BERTopic | A cluster of similar documents described by important words | Document embeddings and cluster-specific word counts |
Latent Dirichlet Allocation (LDA) treats each document as a mixture of topics. For example, a news article might be 70% politics and 30% economics. Each topic is a probability distribution over the vocabulary, so a politics topic may give high probability to words such as “election”, “vote”, and “policy”.
BERTopic first converts documents into vector embeddings. An embedding is a numeric representation that places semantically similar documents near one another. It then groups these vectors into clusters and uses class-based TF-IDF, or c-TF-IDF, to find words that distinguish each cluster. A BERTopic document normally belongs to one cluster, although the clustering process can identify uncertain or outlier documents.
A useful mental model
When topic modelling helps
Topic modelling is useful when:
- You have many unlabelled documents and need an initial map of their themes.
- You want to explore customer feedback, research papers, support tickets, or news.
- You need to organise search, review, or annotation work.
- You want to compare themes across time, groups, or document sources.
The method is less suitable when you need legally or operationally precise labels. In those cases, supervised classification with labelled examples may be better. Topic models can also produce topics based on writing style, named entities, or collection-specific vocabulary instead of the subject you care about.
Choosing an initial method
Choose LDA when interpretability of word-count probabilities, a compact model, or a reproducible probabilistic baseline matters. Choose BERTopic when semantic similarity matters, documents contain varied wording, or you want to swap embedding, clustering, and representation components independently.
Exercise
A corpus contains short product comments that use different words to describe the same problem. Which method is a reasonable first experiment, and why?
Show answer
BERTopic is a reasonable first experiment because embeddings can group comments by meaning even when their exact words differ. Inspect the clusters before treating them as final categories.