mlpack  master
Public Types | Public Member Functions | Private Attributes | List of all members
mlpack::kmeans::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...
 

Private Attributes

const MatType & dataset
 The dataset we are using. More...
 
const MatType & datasetOrig
 The original dataset reference. More...
 
size_t distanceCalculations
 Track distance calculations. More...
 
MetricType & metric
 The metric. More...
 
TreeTypetree
 The tree built on the points. 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

template<typename MetricType , typename MatType >
typedef tree::KDTree<MetricType, PellegMooreKMeansStatistic, MatType> mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::TreeType

Convenience typedef for the tree.

Definition at line 74 of file pelleg_moore_kmeans.hpp.

Constructor & Destructor Documentation

template<typename MetricType , typename MatType >
mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::PellegMooreKMeans ( const MatType &  dataset,
MetricType &  metric 
)

Construct the PellegMooreKMeans object, which must construct a tree.

template<typename MetricType , typename MatType >
mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::~PellegMooreKMeans ( )

Delete the tree constructed by the PellegMooreKMeans object.

Member Function Documentation

template<typename MetricType , typename MatType >
size_t mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::DistanceCalculations ( ) const
inline

Return the number of distance calculations.

Definition at line 68 of file pelleg_moore_kmeans.hpp.

References mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::distanceCalculations.

template<typename MetricType , typename MatType >
size_t& mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::DistanceCalculations ( )
inline

Modify the number of distance calculations.

Definition at line 70 of file pelleg_moore_kmeans.hpp.

References mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::distanceCalculations.

template<typename MetricType , typename MatType >
double mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::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.

Member Data Documentation

template<typename MetricType , typename MatType >
const MatType& mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::dataset
private

The dataset we are using.

Definition at line 82 of file pelleg_moore_kmeans.hpp.

template<typename MetricType , typename MatType >
const MatType& mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::datasetOrig
private

The original dataset reference.

Definition at line 78 of file pelleg_moore_kmeans.hpp.

template<typename MetricType , typename MatType >
size_t mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::distanceCalculations
private

Track distance calculations.

Definition at line 87 of file pelleg_moore_kmeans.hpp.

Referenced by mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::DistanceCalculations().

template<typename MetricType , typename MatType >
MetricType& mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::metric
private

The metric.

Definition at line 84 of file pelleg_moore_kmeans.hpp.

template<typename MetricType , typename MatType >
TreeType* mlpack::kmeans::PellegMooreKMeans< MetricType, MatType >::tree
private

The tree built on the points.

Definition at line 80 of file pelleg_moore_kmeans.hpp.


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