PellegMooreKMeans< MetricType, MatType > Class Template Reference

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 &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. More...

 

Detailed Description


template
<
typename
MetricType
,
typename
MatType
>

class mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >

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

@inproceedings{pelleg1999accelerating,
title={Accelerating exact k-means algorithms with geometric reasoning},
author={Pelleg, Dan and Moore, Andrew W.},
booktitle={Proceedings of the Fifth ACM SIGKDD International Conference
on Knowledge Discovery and Data Mining (KDD '99)},
pages={277--281},
year={1999},
organization={ACM}
}

Definition at line 42 of file pelleg_moore_kmeans.hpp.

Member Typedef Documentation

◆ TreeType

typedef tree::KDTree<MetricType, PellegMooreKMeansStatistic, MatType> TreeType

Convenience typedef for the tree.

Definition at line 74 of file pelleg_moore_kmeans.hpp.

Constructor & Destructor Documentation

◆ PellegMooreKMeans()

PellegMooreKMeans ( const MatType &  dataset,
MetricType &  metric 
)

Construct the PellegMooreKMeans object, which must construct a tree.

◆ ~PellegMooreKMeans()

Delete the tree constructed by the PellegMooreKMeans object.

Member Function Documentation

◆ DistanceCalculations() [1/2]

size_t DistanceCalculations ( ) const
inline

Return the number of distance calculations.

Definition at line 68 of file pelleg_moore_kmeans.hpp.

◆ DistanceCalculations() [2/2]

size_t& DistanceCalculations ( )
inline

Modify the number of distance calculations.

Definition at line 70 of file pelleg_moore_kmeans.hpp.

◆ 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 newCentroids matrix.

Parameters
centroidsCurrent cluster centroids.
newCentroidsNew cluster centroids.
countsCurrent counts, to be overwritten with new counts.

The documentation for this class was generated from the following file: