Search code examples
algorithmmathk-meansmeanapache-commons-math

does k-means clusterer of apache commons math contains a means method?


I have to get the means of a k-means clustering. currently I'm using the apache commons math library which implements a k-means plus plus clustering algorithm. do anybody know, if there is a simple way to get the means after the clustering with this library or have i to implement it by myself?
if not, can you explain me how to calculate it or give me a code example?


Solution

  • The output of the clustering algorithm must at least contain the cluster assignments, i.e. which cluster each point belongs to. If you have that, then the k-means clustering cluster centers are simply given by the mean of the points that belong to each cluster.