4

I can't find a simple library function for k-centers clustering using R, whereas I could for k-means (kmeans()) and hierarchical clustering (hclust()).

Is there a library function for simple greedy k-centers clustering using R as depicted in this post

If not - as I am new to R - how would one go about implementing it (I understand the logic - just not how to actually write it in R code).

Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
torger
  • 2,308
  • 4
  • 28
  • 35

2 Answers2

4

Try kmeans with method = "centers".

If this is not what you are looking for, then CRAN has a cluster Task View with dozens of packages at http://cran.r-project.org/web/views/Cluster.html.

flodel
  • 87,577
  • 21
  • 185
  • 223
1

From what is described in this blog post, this seems similar to one of the many seeding strategies used for k-means. I wouldn't really call it a clustering method yet, but a pre-clustering or something like that.

Maybe you should lookt at the flexclust package of R, I believe it has some k-means variations and initializations, and maybe it has this variant as one initialization option. Or it might be on http://cran.r-project.org/web/views/Cluster.html

Note that always choosing the object that is furthest away is prone to choose outliers as cluster centers! Have a look at e.g. k-means++ which is based on a similar idea, but somewhat more clever (plus, it better supports randomization, so you can try multiple different initializations). Or you could choose the object that is closest to the (2k-1)/(2k) quantile, which probably is a better guess for a good cluster center.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194