Given the (dis)similarity matrix and the clustering results, how do I select the medoid in each cluster?

For example, one cluster contains totally 4 points: A, B, C, D. I know the similarity (or dissimilarity between each pair of them. How to pick one that is the most representative in this cluster?

My instinct is to choose the point with the minimum average distance to other points. I am not sure if this is correct.

I am using a linkage clustering method.

Things would be easier in k-means methods, but that is not what I need.

I would appreciate a lot if you can provide some links to codes along with the methods.

  • 1
    $\begingroup$ Asking for code is off-topic here. You may or may not get code with the answer. $\endgroup$ Mar 12, 2015 at 23:11
  • 1
    $\begingroup$ possible duplicate of How to perform K-medoids when having the distance matrix $\endgroup$ Mar 12, 2015 at 23:30
  • $\begingroup$ K-medoids is clustering method, and I will try to find some clue therein. However, some general methods that can be applied to common clustering results are what I am seeking here. @ssdecontrol $\endgroup$
    – GeauxEric
    Mar 12, 2015 at 23:51
  • 1
    $\begingroup$ @gung Unless policy has changed in the last day or two, asking for code is allowed here on CV, as long as certain conditions are met. The question must have a clearly statistical or machine learning component, but it can still ask about (and even get) code. $\endgroup$
    – Glen_b
    Mar 13, 2015 at 0:46
  • $\begingroup$ @EricCoding I misunderstood the question. Why not just compute the medoid in each cluster? $\endgroup$ Mar 13, 2015 at 1:21

1 Answer 1


The medoid has a pretty clear definition.

It's the point with the smallest average distance to all other points.

(It obviously does not matter whether you use the average or the sum.)

If you have a similarity, maximize the similarity instead.

If you do something else, it's not the medoid anymore. For example I have seen a "k-medoids" program which computed the multivariate mean (like k-means) and then chose the nearest data point of this. Which essentially has the same limitations as k-means...


Your Answer

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

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