3
$\begingroup$

I have a list of categorical data and I want to apply an unsupervised classification method to cluster this data. Which method could be used?

Example:

gene1

gene2

gene3

gene4

gene5

gene6

gene7

gene8

My goal is to cluster these genes.

Could anyone suggest me how to do clustering with these labels?

$\endgroup$
8
  • $\begingroup$ Can you elaborate more about the data that you are dealing with and what you want to get out of it? In your question you have only shown that you have one categorical variable which can be simply encoded and then clustered using any clustering algorithm like k-means, hierarchical or lda. $\endgroup$ Commented Jun 18, 2017 at 8:12
  • $\begingroup$ @Satwik•, hi friend I just have this inputs and my goal to cluster these genes to some clusters maybe 2 or 3 .... $\endgroup$
    – F.caren
    Commented Jun 18, 2017 at 8:15
  • $\begingroup$ k-means can't work with categorical data ?? $\endgroup$
    – F.caren
    Commented Jun 18, 2017 at 8:20
  • $\begingroup$ simple k-means doesn't work well with categorical data, do you just want to know how to cluster categorical data? $\endgroup$ Commented Jun 18, 2017 at 8:57
  • $\begingroup$ yes, I just want to know how to cluster these list of genes $\endgroup$
    – F.caren
    Commented Jun 18, 2017 at 8:59

1 Answer 1

12
$\begingroup$

I'm going to answer this as an approach to clustering categorical data.

The standard k-means performs poorly in case of categorical data since in the sample space is discrete. The cost function defined by k-means computes the Euclidean Distance (or something similar) which is relevant only for continuous variables. Instead of computing the Euclidean distance, one could use the Hammer Distance (for categorical) or Gower Distance (for mixed). Instead of computing the mean, one can compute the mode. The most occurring value of a nominal variable is used as its representative (centers of cluster). Such a cost function is used in a variation of k-means called k-modes. Modes are analogous to centroids in k-means.

If you are using python then you could probably use this package. The method was first presented in this paper. You can read about it's usage methods in their documentation. There's another extension of the k-modes called k-prototypes which works well for mixed datatypes (included in the python package).

$\endgroup$
3
  • $\begingroup$ so if i used this method i can cluster this list ? $\endgroup$
    – F.caren
    Commented Jun 18, 2017 at 9:34
  • $\begingroup$ To avoid extended/messy discussion in comments, please add you queries here chat.stackexchange.com/rooms/60664/… $\endgroup$ Commented Jun 18, 2017 at 9:55
  • $\begingroup$ There seems to be another method: k-medoid which is used on categorical as well. Can you share some commends on this comparison? Thanks $\endgroup$
    – unicorn
    Commented Jun 3, 2019 at 6:50

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.