Concepts / Decomposition Methods for Text Data

Decomposition Methods for Text Data

Text like this is everywhere: customer reviews, support tickets, research abstracts, and social media posts.

  • Programming

Why Untagged Text Needs Topic Modeling

Imagine a newsroom archive with tens of thousands of articles, none of which has ever been tagged. A reader who wants every article about the economy, or every article about a local election, has no easy way to find them. Text like this is everywhere: customer reviews, support tickets, research abstracts, and social media posts. Most of it arrives as raw sentences with no category attached.

Topic modeling is a technique often applied to text data for exactly this situation. Instead of asking a person to read everything and label it by hand, the technique tries to discover what the documents are about. This article explains what that means, how it differs from a closely related idea, and where one common method fits in.

Reading the Definition Phrase by Phrase

Definition

Topic modeling is the task of assigning each document to one or several topics, usually without supervision.

The phrase one or several topics is the key to the definition. The task does not force every document into a single bin. A document is allowed to touch more than one subject, and the method's job is to say which subjects are present.

The phrase usually without supervision signals that the topics are not handed to the method in advance. Supervised work starts from labels that someone has already written down. Topic modeling has to find the topics from the documents themselves.

In the real world

News data might be grouped into topics such as politics, sports, and finance. A newspaper editor would recognize these as the sections of the paper. Topic modeling aims to produce this kind of grouping from the text of the articles, rather than from a list of section names that someone wrote down beforehand.

Two Cases Under One Umbrella

The source describes two cases that both fall under topic modeling. The difference lies in how many topics a single document is allowed to have. The two cases are easiest to compare side by side.

FeatureSingle-topic caseMulti-topic case
Topics per documentExactly oneOne or several
Name in the sourceDocument clusteringDecomposition-based topic modeling
Connected chapter ideaClustering ideas from Chapter 3Decomposition methods from Chapter 3
What each document receivesA single topic labelA degree of relatedness to each topic

The single-topic case is a special case of topic modeling. The multi-topic case is where decomposition methods enter.

Tracing One Article Through Its Topic Coefficients

When a document is allowed several topics, it helps to picture the document as a bundle of topics rather than a single label. The coefficients of the components in a document's representation indicate how strongly the document relates to each topic. A stronger coefficient means a stronger connection.

News articleone documentPoliticscomponentSportscomponentFinancecomponentstrong coefficientweak coefficientmoderate coefficient
How does one hypothetical news article relate to several topics at once, with each topic receiving its own degree of relatedness?

Notice what the diagram does not claim. It does not say the article belongs to exactly one bin. Each topic receives its own degree of relatedness. This is the practical meaning of a document having multiple topics, and it is what separates this case from clustering. The strengths shown here are illustrative; the source does not assign numbers to them.

Latent Dirichlet Allocation as the Common Example

Latent Dirichlet Allocation, usually abbreviated LDA, is the decomposition method that people most often mean when they talk about topic modeling. In the terms above, LDA is one specific way of learning the components, and each component is read as a topic.

Worked Example: Reading a Multi-Topic Article

Worked example

Describing a Hypothetical Article in Topic Terms

An untagged archive contains an article about a city council budget that includes a section on how the local football stadium will be funded. Using the decomposition view, describe how the article should be represented.

  1. 1
    Identify the components

    Under a decomposition method, each learned component corresponds to one topic. Suppose the method has learned components for politics, sports, and finance.

  2. 2
    Ask whether one label is enough

    The article touches government decisions, a sports venue, and public money. In the multi-topic case, a document can have several topics, so forcing one label would throw away information.

  3. 3
    Assign a coefficient to each component

    The article receives a coefficient for politics, one for sports, and one for finance. A stronger coefficient means a stronger connection to that topic.

  4. 4
    Read the representation

    The article's representation records how much of each component it contains. It is a bundle of topics, not a single bin.

Result

The article is represented as a set of coefficients over the topic components, with several coefficients being meaningful at once. This is the multi-topic case of topic modeling.

Predicting the Topic Count Before Checking

What do you think happens?

In the multi-topic case, how many topics can a single document have?

  • Exactly one

  • One or several

  • Zero, because topics are never assigned to documents

Reveal answer
Answer:

One or several

The definition explicitly says each document is assigned to one or several topics. Exactly one topic describes the clustering case, which is a special case of topic modeling.

Mistakes When Reading Topic Models

  • Common mistake

    Treating topic modeling as a supervised labeling task

    What it looks like

    Assuming someone must first write the list of topics and tag each article with one of them.

    Why it fails

    The definition says the task is usually done without supervision. The topics have to be found from the documents themselves.

    Do this instead

    Describe topic modeling as discovering topics from the text, not as applying a predefined label list.

  • Common mistake

    Assuming every topic model gives each document exactly one topic

    What it looks like

    Concluding that a news article about a stadium budget belongs only to sports.

    Why it fails

    Exactly one topic is the clustering case. The multi-topic case allows a document to have several topics, each with its own coefficient.

    Do this instead

    Check which case applies. Under decomposition, read the coefficients across all components.

  • Common mistake

    Reading a coefficient as a yes or no membership flag

    What it looks like

    Seeing a coefficient for finance and deciding the article is finance or not finance.

    Why it fails

    A coefficient indicates how strongly the document relates to a topic. It is a degree of relatedness, not a binary decision.

    Do this instead

    Interpret stronger coefficients as stronger connections and compare them across topics.

  • Common mistake

    Using LDA and decomposition as if they were the same thing

    What it looks like

    Saying every decomposition method is LDA.

    Why it fails

    LDA is the decomposition method people most often mean when they discuss topic modeling. It is one specific way of learning the components.

    Do this instead

    Say LDA is one example of a decomposition method used for topic modeling.

Practice: Sorting Two Newsroom Cases

MEDIUM

An archive editor has two untagged articles. Article A is a weather report with no other subject. Article B covers a city council vote on a new sports arena and how it will be financed. For each article, decide whether a single-topic clustering view or a multi-topic decomposition view fits better, and explain what the representation of each article should record.

Hints
  • Ask how many topics each article genuinely touches.
  • In the multi-topic case, the representation records a coefficient for each component, not a single label.
  • Article B touches more than one subject, so think about whether one bin would discard information.

Key Takeaways

  1. 1
    Topic modeling assigns each document to one or several topics, usually without supervision, so the topics are discovered from the documents themselves.
  2. 2
    The single-topic case is document clustering, a special case of topic modeling in which each document has exactly one topic.
  3. 3
    The multi-topic case connects to decomposition methods: each learned component corresponds to a topic, and each document's coefficients show how strongly it relates to each topic.
  4. 4
    Latent Dirichlet Allocation, or LDA, is the decomposition method most often meant by topic modeling. It represents topics as components and documents as coefficients over those components.

At a glance

  • Topic modeling assigns each document to one or several topics, usually without supervision.
  • Document clustering is the single-topic special case, where each document has exactly one topic.
  • In decomposition-based topic modeling, each learned component is a topic and each document's coefficients show how strongly it relates to each topic.
  • LDA is the common decomposition method for topic modeling, representing topics as components and documents as coefficients.

Related concepts

More concepts starting with D