# Which algorithm would you use for text categorisation using clustering? [closed]

If you are asked to do text categorization using clustering. Which algorithm would you use and why?

• Almost any algorithm will do the trick. On the other hand it is worth spending some thought on what features of the texts you want to use as a base for the clustering. This depends very much on your research question.
– user10169
Commented Nov 25, 2015 at 15:43

It will depend on the purpose and the text. Many options this is what I have used.

What I did was limit the cluster and any document vector to the top 1000 terms sorted by weight. This not only results in faster processing but you get some multi modal clusters and will have thousands and thousands of terms. What happens is those really long vectors dilute the similarity when compared to a even a long single document. I think you also get faster convergence. If you want to keep documents out of multi modal clusters then don't truncate the cluster vector.

• What's K9? You linked to k-means.
– Emre
Commented Nov 25, 2015 at 18:06

tf-idf vectors are an easy start, but it can be hard to cluster very high dimensional data.

You might try topic modeling (LDA, LSI for example) to reduce the dimensionality of your features.

A newer approach is paragraph vectors, which learn a distributed representation of arbitrary-length text. Here is an implementation in python.

Learning a reasonable, lower dimensional representation of the text can help with the issues that arise trying to cluster high dimensional data.

• The link on paragraph vectors doesn't work. Commented Nov 26, 2015 at 2:53

Text categorization using clustering can be done in a lot of ways. Some of which are:

In fact, most(or almost all) the clustering algorithms can be applied for classifying text through clustering.

• k-means is not the knn algorithm (and not a good choice) Commented Nov 25, 2015 at 23:12
• @Anony-Mousse Thank you for spotting the spelling error. Rectified. As the OP asked about any algorithm, I included k-means which I have used once, and is a relevant answer. Commented Nov 26, 2015 at 2:22