mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::kmeans::RefinedStart Class Reference

A refined approach for choosing initial points for k-means clustering. More...

Public Member Functions

 RefinedStart (const size_t samplings=100, const double percentage=0.02)
 Create the RefinedStart object, optionally specifying parameters for the number of samplings to perform and the percentage of the dataset to use in each sampling. More...
 
template<typename MatType >
void Cluster (const MatType &data, const size_t clusters, arma::mat &centroids) const
 Partition the given dataset into the given number of clusters according to the random sampling scheme outlined in Bradley and Fayyad's paper, and return centroids. More...
 
template<typename MatType >
void Cluster (const MatType &data, const size_t clusters, arma::Row< size_t > &assignments) const
 Partition the given dataset into the given number of clusters according to the random sampling scheme outlined in Bradley and Fayyad's paper, and return point assignments. More...
 
double Percentage () const
 Get the percentage of the data used by each subsampling. More...
 
double & Percentage ()
 Modify the percentage of the data used by each subsampling. More...
 
size_t Samplings () const
 Get the number of samplings that will be performed. More...
 
size_t & Samplings ()
 Modify the number of samplings that will be performed. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the object. More...
 

Private Attributes

double percentage
 The percentage of the data to use for each subsampling. More...
 
size_t samplings
 The number of samplings to perform. More...
 

Detailed Description

A refined approach for choosing initial points for k-means clustering.

This approach runs k-means several times on random subsets of the data, and then clusters those solutions to select refined initial cluster assignments. It is an implementation of the following paper:

{bradley1998refining, title={Refining initial points for k-means clustering}, author={Bradley, Paul S and Fayyad, Usama M}, booktitle={Proceedings of the Fifteenth International Conference on Machine Learning (ICML 1998)}, volume={66}, year={1998} }

Definition at line 37 of file refined_start.hpp.

Constructor & Destructor Documentation

mlpack::kmeans::RefinedStart::RefinedStart ( const size_t  samplings = 100,
const double  percentage = 0.02 
)
inline

Create the RefinedStart object, optionally specifying parameters for the number of samplings to perform and the percentage of the dataset to use in each sampling.

Definition at line 45 of file refined_start.hpp.

References Cluster().

Member Function Documentation

template<typename MatType >
void mlpack::kmeans::RefinedStart::Cluster ( const MatType &  data,
const size_t  clusters,
arma::mat &  centroids 
) const

Partition the given dataset into the given number of clusters according to the random sampling scheme outlined in Bradley and Fayyad's paper, and return centroids.

Template Parameters
MatTypeType of data (arma::mat or arma::sp_mat).
Parameters
dataDataset to partition.
clustersNumber of clusters to split dataset into.
centroidsMatrix to store centroids into.

Referenced by RefinedStart().

template<typename MatType >
void mlpack::kmeans::RefinedStart::Cluster ( const MatType &  data,
const size_t  clusters,
arma::Row< size_t > &  assignments 
) const

Partition the given dataset into the given number of clusters according to the random sampling scheme outlined in Bradley and Fayyad's paper, and return point assignments.

Template Parameters
MatTypeType of data (arma::mat or arma::sp_mat).
Parameters
dataDataset to partition.
clustersNumber of clusters to split dataset into.
assignmentsVector to store cluster assignments into. Values will be between 0 and (clusters - 1).
double mlpack::kmeans::RefinedStart::Percentage ( ) const
inline

Get the percentage of the data used by each subsampling.

Definition at line 86 of file refined_start.hpp.

References percentage.

double& mlpack::kmeans::RefinedStart::Percentage ( )
inline

Modify the percentage of the data used by each subsampling.

Definition at line 88 of file refined_start.hpp.

References percentage.

size_t mlpack::kmeans::RefinedStart::Samplings ( ) const
inline

Get the number of samplings that will be performed.

Definition at line 81 of file refined_start.hpp.

References samplings.

size_t& mlpack::kmeans::RefinedStart::Samplings ( )
inline

Modify the number of samplings that will be performed.

Definition at line 83 of file refined_start.hpp.

References samplings.

template<typename Archive >
void mlpack::kmeans::RefinedStart::Serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serialize the object.

Definition at line 92 of file refined_start.hpp.

References mlpack::data::CreateNVP(), percentage, and samplings.

Member Data Documentation

double mlpack::kmeans::RefinedStart::percentage
private

The percentage of the data to use for each subsampling.

Definition at line 102 of file refined_start.hpp.

Referenced by Percentage(), and Serialize().

size_t mlpack::kmeans::RefinedStart::samplings
private

The number of samplings to perform.

Definition at line 100 of file refined_start.hpp.

Referenced by Samplings(), and Serialize().


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