13 #ifndef MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_STATISTIC_HPP
14 #define MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_STATISTIC_HPP
32 template<
typename TreeType>
35 centroid.zeros(node.Dataset().n_rows);
39 for (
size_t i = 0; i < node.NumChildren(); ++i)
41 centroid += node.Child(i).NumDescendants() *
42 node.Child(i).Stat().Centroid();
45 for (
size_t i = 0; i < node.NumPoints(); ++i)
47 centroid += node.Dataset().col(node.Point(i));
50 if (node.NumDescendants() > 0)
51 centroid /= node.NumDescendants();
53 centroid.fill(DBL_MAX);
57 const arma::uvec&
Blacklist()
const {
return blacklist; }
62 const arma::vec&
Centroid()
const {
return centroid; }