mlpack  2.0.1
Public Member Functions | Private Attributes | List of all members
mlpack::kmeans::NaiveKMeans< MetricType, MatType > Class Template Reference

This is an implementation of a single iteration of Lloyd's algorithm for k-means. More...

Public Member Functions

 NaiveKMeans (const MatType &dataset, MetricType &metric)
 Construct the NaiveKMeans object with the given dataset and metric. More...
 
size_t DistanceCalculations () const
 
double Iterate (const arma::mat &centroids, arma::mat &newCentroids, arma::Col< size_t > &counts)
 Run a single iteration of the Lloyd algorithm, updating the given centroids into the newCentroids matrix. More...
 

Private Attributes

const MatType & dataset
 The dataset. More...
 
size_t distanceCalculations
 Number of distance calculations. More...
 
MetricType & metric
 The instantiated metric. More...
 

Detailed Description

template<typename MetricType, typename MatType>
class mlpack::kmeans::NaiveKMeans< MetricType, MatType >

This is an implementation of a single iteration of Lloyd's algorithm for k-means.

If your intention is to run the full k-means algorithm, you are looking for the mlpack::kmeans::KMeans class instead of this one. This class is used by KMeans as the actual implementation of the Lloyd iteration.

Parameters
MetricTypeType of metric used with this implementation.
MatTypeMatrix type (arma::mat or arma::sp_mat).

Definition at line 32 of file naive_kmeans.hpp.

Constructor & Destructor Documentation

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

Construct the NaiveKMeans object with the given dataset and metric.

Parameters
datasetDataset.
metricInstantiated metric.

Member Function Documentation

template<typename MetricType , typename MatType >
size_t mlpack::kmeans::NaiveKMeans< MetricType, MatType >::DistanceCalculations ( ) const
inline
template<typename MetricType , typename MatType >
double mlpack::kmeans::NaiveKMeans< MetricType, MatType >::Iterate ( const arma::mat &  centroids,
arma::mat &  newCentroids,
arma::Col< size_t > &  counts 
)

Run a single iteration of the Lloyd algorithm, updating the given centroids into the newCentroids matrix.

Parameters
centroidsCurrent cluster centroids.
newCentroidsNew cluster centroids.

Member Data Documentation

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

The dataset.

Definition at line 58 of file naive_kmeans.hpp.

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

Number of distance calculations.

Definition at line 63 of file naive_kmeans.hpp.

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

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

The instantiated metric.

Definition at line 60 of file naive_kmeans.hpp.


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