Is there a built-in function for data clustering using k-medians algorithm? I found out about the ClusterDissimilarityFunction of the FindCLusters function, but I guess it refers to the distance function (mean for euclidean, median for manhattan etc). So my kmeans using manhattan metric looks like this:

FindClusters[Transpose[{height, weight}], 2, 
 Method -> {"KMeans", ClusterDissimilarityFunction -> "Median", 
   "InitialCentroids" -> {{0, 0}, {100, 100}}}] 

Is it correct? How to compute k-medians?

  • 3
    $\begingroup$ If it can't be done with the built-in functions, you could take the implementation of k-means from here and replace Mean with Median. That should do it. $\endgroup$ – C. E. Jan 12 at 22:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.