I know the difference between clustering and classification in machine learning, but I don't understand the difference between text classification and topic modeling for documents. Can I use topic modeling over documents to identify a topic? Can I use classification methods to classify the text inside these documents?


3 Answers 3


Text Classification

I give you a bunch of documents, each of which has a label attached. I ask you to learn why you think the contents of the documents have been given these labels based on their words. Then I give you new documents and ask what you think the label for each one should be. The labels have meaning to me, not to you necessarily.

Topic Modeling

I give you a bunch of documents, without labels. I ask you to explain why the documents have the words they do by identifying some topics that each is "about". You tell me the topics, by telling me how much of each is in each document, and I decide what the topics "mean" if anything.

You'd have to clarify what you me by "identify one topic" or "classify the text".


But I don't know what is difference between text classification and topic models in documents

Text Classification is a form of supervised learning, hence the set of possible classes are known/defined in advance, and won't change.

Topic Modeling is a form of unsupervised learning (akin to clustering), so the set of possible topics are unknown apriori. They're defined as part of generating the topic models. With a non-deterministic algorithm like LDA, you'll get different topics each time you run the algorithm.

Text classification often involves mutually-exclusive classes -- think of these as buckets.
But it doesn't have to: given the right kind of labeled input data, you can set of a series of non-mutually-exclusive binary classifiers.

Topic modeling is generally not mutually-exclusive: the same document can have its probability distribution spread across many topics. In addition, there are also hierarchical topic modeling methods.

Also can I use topic model for the documents to identify one topic later on can I use the classification to classify the text inside this documents ?

If you're asking whether you can take all of the documents assigned to one topic by a topic modeling algorithm and then apply a classifier to that collection, then yes, you certainly can do that.

I'm not sure it makes much sense, though: at a minimum, you'd need to pick a threshold for the topic probability distribution above which you'll include documents in your collection (typically 0.05-0.1).

Can you elaborate on your use case?

By the way, there's a great tutorial on topic modeling using the MALLET library for Java available here: Getting Started with Topic Modeling and MALLET


Topic models are usually unsupervised. There are "supervised topic models", too; but even then they try to model topics within a classes.

E.g. you may have a class "football", but there may be topics inside this class that relate to particular matches or teams.

The challenge with topics is that they change over time; consider the matches example above. Such topics may emerge, and disappear again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.