mlpack  2.0.1
pelleg_moore_kmeans.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_HPP
16 #define __MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_HPP
17 
20 
21 namespace mlpack {
22 namespace kmeans {
23 
43 template<typename MetricType, typename MatType>
45 {
46  public:
50  PellegMooreKMeans(const MatType& dataset, MetricType& metric);
51 
56 
65  double Iterate(const arma::mat& centroids,
66  arma::mat& newCentroids,
67  arma::Col<size_t>& counts);
68 
70  size_t DistanceCalculations() const { return distanceCalculations; }
73 
77 
78  private:
80  const MatType& datasetOrig; // Maybe not necessary.
84  const MatType& dataset;
86  MetricType& metric;
87 
90 };
91 
92 } // namespace kmeans
93 } // namespace mlpack
94 
95 #include "pelleg_moore_kmeans_impl.hpp"
96 
97 #endif
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...
Linear algebra utility functions, generally performed on matrices or vectors.
A binary space partitioning tree, such as a KD-tree or a ball tree.
TreeType * tree
The tree built on the points.
An implementation of Pelleg-Moore&#39;s &#39;blacklist&#39; algorithm for k-means clustering. ...
size_t DistanceCalculations() const
Return the number of distance calculations.
size_t distanceCalculations
Track distance calculations.
~PellegMooreKMeans()
Delete the tree constructed by the PellegMooreKMeans object.
tree::KDTree< MetricType, PellegMooreKMeansStatistic, MatType > TreeType
Convenience typedef for the tree.
const MatType & datasetOrig
The original dataset reference.
const MatType & dataset
The dataset we are using.
PellegMooreKMeans(const MatType &dataset, MetricType &metric)
Construct the PellegMooreKMeans object, which must construct a tree.
size_t & DistanceCalculations()
Modify the number of distance calculations.