I have objects o1, o2,...,on and for each pair I calculate a value that measures the pair's difference. This is a percentage, so for example o1o2 differ by 56%. Now I want to cluster this data. I can see how a hierarchical clustering analysis would fit e.g. o5o6 are the closest pair, now which of the rest are closest to either o5 or o6, and so on.

My question is: can I apply a k-means analysis as well? It seems to me k-means requires (x,y) type data but I may be wrong. Perhaps k-means requires data with levels of measurement: (ratio, ratio) and hierarchical requires (nominal, nominal, ratio)? Or maybe there is a better technique?


1 Answer 1


k-means is called k-means because it needs to compute means.

So yes, k-means requires coordinate data. Usually, the data should also be continuous and linear scaled for the mean to make sense. Technically you can run k-means on binary data, but the result will not be binary anymore, and may not make much sense.

(And the means must minimize your objective, otherwise it may fail to converge - so your distance function should be sum-of-squared-errors, because that is what the mean minimizes)

Furthermore, a distance matrix is useless for k-means. Because k-means only computes squared Euclidean distances point-to-mean, and not point-to-point.


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