An implementation of Pelleg-Moore's 'blacklist' algorithm for k-means clustering. More...
Public Types | |
typedef tree::KDTree< MetricType, PellegMooreKMeansStatistic, MatType > | TreeType |
Convenience typedef for the tree. More... | |
Public Member Functions | |
PellegMooreKMeans (const MatType &dataset, MetricType &metric) | |
Construct the PellegMooreKMeans object, which must construct a tree. More... | |
~PellegMooreKMeans () | |
Delete the tree constructed by the PellegMooreKMeans object. More... | |
size_t | DistanceCalculations () const |
Return the number of distance calculations. More... | |
size_t & | DistanceCalculations () |
Modify the number of distance calculations. More... | |
double | Iterate (const arma::mat ¢roids, arma::mat &newCentroids, arma::Col< size_t > &counts) |
Run a single iteration of the Pelleg-Moore blacklist algorithm, updating the given centroids into the newCentroids matrix. More... | |
An implementation of Pelleg-Moore's 'blacklist' algorithm for k-means clustering.
This algorithm builds a kd-tree on the data points and traverses it in order to determine the closest clusters to each point.
For more information on the algorithm, see
Definition at line 42 of file pelleg_moore_kmeans.hpp.
typedef tree::KDTree<MetricType, PellegMooreKMeansStatistic, MatType> TreeType |
Convenience typedef for the tree.
Definition at line 74 of file pelleg_moore_kmeans.hpp.
PellegMooreKMeans | ( | const MatType & | dataset, |
MetricType & | metric | ||
) |
Construct the PellegMooreKMeans object, which must construct a tree.
~PellegMooreKMeans | ( | ) |
Delete the tree constructed by the PellegMooreKMeans object.
|
inline |
Return the number of distance calculations.
Definition at line 68 of file pelleg_moore_kmeans.hpp.
|
inline |
Modify the number of distance calculations.
Definition at line 70 of file pelleg_moore_kmeans.hpp.
double Iterate | ( | const arma::mat & | centroids, |
arma::mat & | newCentroids, | ||
arma::Col< size_t > & | counts | ||
) |
Run a single iteration of the Pelleg-Moore blacklist algorithm, updating the given centroids into the newCentroids matrix.
centroids | Current cluster centroids. |
newCentroids | New cluster centroids. |
counts | Current counts, to be overwritten with new counts. |