Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

The KMeansPlusPlusClusterer (package org.apache.commons.math3.ml.clustering, version 3.2+ ) returns a List of CentroidCluster objects. From a CentroidCluster you can get the cluster center (= mean of cluster points) by calling the getCenter() method.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top