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?

  • 4
    $\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 agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.