I am trying to classify 9 different species of elephants into clusters using unsupervised learning. I have the following data about them:

  • Their height
  • Eye Colour
  • Sound they produce in decibel (dB)

I know there are 9 different elephant species in total. However, I am unsure which algorithm would work better. My dataset size is not too huge, so I was wondering if K-Means would be a general worse option here (as Hierarchical Clustering seem to give the same results on every run unlike K-Means).

Any guidance on this would be helpful, thank you.

  • $\begingroup$ Eye colour is categorical, isn't it? How would you use that with k-means? Actually it isn't quite clear to me how you'd want to use that with hierarchical clustering either. Do you define a distance aggregating the three variables such as Gower's coefficient? $\endgroup$ Oct 24, 2020 at 10:27
  • $\begingroup$ Lewian, yes, it categorical. They have some other datetime parameters too :) $\endgroup$
    – fitGirl321
    Oct 25, 2020 at 16:49
  • $\begingroup$ There's no Gower's coefficient defined.. $\endgroup$
    – fitGirl321
    Oct 25, 2020 at 16:49

1 Answer 1


If you know the number of clusters already, k-means seems more fit than hierarchical clustering, because it tries to give the best possible solution, while HC uses a greedy algorithm, it doesn't matter much if it is deterministic.

However, k-means and HC are really comparable only if you use Ward method for HC, which is really just a hierarchical version of k-means. Single linkage, for instance, can give much different results.

Also, k-means and HC are not the only alternatives, EM clustering and k-medoids are two famous non hierarchical clustering methods, that provide some variations of k-means, with iterative estimating algorithms more reliable than HC, for a fixed k.

  • $\begingroup$ By Wald you probably mean Ward. "EM clustering" is not a method, you probably mean the EM algorithm for Gaussian mixtures (how to use that with eye colour??), but there are EM-algorithms also for various other models, so the term "EM clustering" doesn't say exactly what method you mean. k-means gives the "best possible solution" only according to its own objective function, which is not necessarily appropriate, particularly if separation between clusters is more important than homogeneity within clusters. $\endgroup$ Oct 24, 2020 at 10:30
  • $\begingroup$ this is not a book on clustering, is an answer to the posted question. it's meant to give useful indications, not to confuse the OP, or to give her a master level understanding from scratch. $\endgroup$
    – carlo
    Oct 24, 2020 at 10:47
  • $\begingroup$ How do you use Ward with a variable such as eye colour? $\endgroup$ Oct 25, 2020 at 9:59
  • $\begingroup$ jsut as the OP would most probably have: one hot encoding. that way a certain value is added to the distance between different eyed beasts, just like with Gower. you are making an issue of nothing. $\endgroup$
    – carlo
    Oct 25, 2020 at 10:26
  • $\begingroup$ stackoverflow.com/questions/56171837/… $\endgroup$ Oct 25, 2020 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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