mlpack  3.4.2
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
mlpack::kmeans::PellegMooreKMeans::DistanceCalculations
size_t & DistanceCalculations()
Modify the number of distance calculations.
Definition: pelleg_moore_kmeans.hpp:70
mlpack::kmeans::PellegMooreKMeans::PellegMooreKMeans
PellegMooreKMeans(const MatType &dataset, MetricType &metric)
Construct the PellegMooreKMeans object, which must construct a tree.
mlpack::tree::BinarySpaceTree
A binary space partitioning tree, such as a KD-tree or a ball tree.
Definition: binary_space_tree.hpp:55
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::kmeans::PellegMooreKMeans::TreeType
tree::KDTree< MetricType, PellegMooreKMeansStatistic, MatType > TreeType
Convenience typedef for the tree.
Definition: pelleg_moore_kmeans.hpp:74
pelleg_moore_kmeans_statistic.hpp
mlpack::kmeans::PellegMooreKMeans::DistanceCalculations
size_t DistanceCalculations() const
Return the number of distance calculations.
Definition: pelleg_moore_kmeans.hpp:68
mlpack::kmeans::PellegMooreKMeans
An implementation of Pelleg-Moore's 'blacklist' algorithm for k-means clustering.
Definition: pelleg_moore_kmeans.hpp:43
binary_space_tree.hpp
mlpack::kmeans::PellegMooreKMeans::~PellegMooreKMeans
~PellegMooreKMeans()
Delete the tree constructed by the PellegMooreKMeans object.
mlpack::kmeans::PellegMooreKMeans::Iterate
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...