pelleg_moore_kmeans.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_HPP
14 #define MLPACK_METHODS_KMEANS_PELLEG_MOORE_KMEANS_HPP
15 
18 
19 namespace mlpack {
20 namespace kmeans {
21 
41 template<typename MetricType, typename MatType>
43 {
44  public:
48  PellegMooreKMeans(const MatType& dataset, MetricType& metric);
49 
54 
63  double Iterate(const arma::mat& centroids,
64  arma::mat& newCentroids,
65  arma::Col<size_t>& counts);
66 
68  size_t DistanceCalculations() const { return distanceCalculations; }
70  size_t& DistanceCalculations() { return distanceCalculations; }
71 
75 
76  private:
78  const MatType& datasetOrig; // Maybe not necessary.
80  TreeType* tree;
82  const MatType& dataset;
84  MetricType& metric;
85 
87  size_t distanceCalculations;
88 };
89 
90 } // namespace kmeans
91 } // namespace mlpack
92 
93 #include "pelleg_moore_kmeans_impl.hpp"
94 
95 #endif
PellegMooreKMeans(const MatType &dataset, MetricType &metric)
Construct the PellegMooreKMeans object, which must construct a tree.
Linear algebra utility functions, generally performed on matrices or vectors.
A binary space partitioning tree, such as a KD-tree or a ball tree.
An implementation of Pelleg-Moore&#39;s &#39;blacklist&#39; algorithm for k-means clustering. ...
size_t & DistanceCalculations()
Modify the number of distance calculations.
tree::KDTree< MetricType, PellegMooreKMeansStatistic, MatType > TreeType
Convenience typedef for the tree.
size_t DistanceCalculations() const
Return the number of distance calculations.
~PellegMooreKMeans()
Delete the tree constructed by the PellegMooreKMeans object.
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...