mlpack
|
A refined approach for choosing initial points for k-means clustering. More...
#include <refined_start.hpp>
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. | |
template<typename MatType > | |
void | Cluster (const MatType &data, const size_t clusters, arma::mat ¢roids) 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... | |
size_t | Samplings () const |
Get the number of samplings that will be performed. | |
size_t & | Samplings () |
Modify the number of samplings that will be performed. | |
double | Percentage () const |
Get the percentage of the data used by each subsampling. | |
double & | Percentage () |
Modify the percentage of the data used by each subsampling. | |
template<typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the object. | |
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:
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.
Partition the given dataset according to Bradley and Fayyad's algorithm.
MatType | Type of data (arma::mat or arma::sp_mat). |
data | Dataset to partition. |
clusters | Number of clusters to split dataset into. |
centroids | Matrix to store centroids into. |
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.
MatType | Type of data (arma::mat or arma::sp_mat). |
data | Dataset to partition. |
clusters | Number of clusters to split dataset into. |
assignments | Vector to store cluster assignments into. Values will be between 0 and (clusters - 1). |