mlpack  master
Public Member Functions | Static Public Member Functions | List of all members
mlpack::kmeans::RandomPartition Class Reference

A very simple partitioner which partitions the data randomly into the number of desired clusters. More...

Public Member Functions

 RandomPartition ()
 Empty constructor, required by the InitialPartitionPolicy policy. More...
 
template<typename Archive >
void Serialize (Archive &, const unsigned int)
 Serialize the partitioner (nothing to do). More...
 

Static Public Member Functions

template<typename MatType >
static void Cluster (const MatType &data, const size_t clusters, arma::Row< size_t > &assignments)
 Partition the given dataset into the given number of clusters. More...
 

Detailed Description

A very simple partitioner which partitions the data randomly into the number of desired clusters.

It has no parameters, and so an instance of the class is not even necessary.

Definition at line 26 of file random_partition.hpp.

Constructor & Destructor Documentation

mlpack::kmeans::RandomPartition::RandomPartition ( )
inline

Empty constructor, required by the InitialPartitionPolicy policy.

Definition at line 30 of file random_partition.hpp.

Member Function Documentation

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

Partition the given dataset into the given number of clusters.

Assignments are random, and the number of points in each cluster should be equal (or approximately equal).

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).

Definition at line 44 of file random_partition.hpp.

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

Serialize the partitioner (nothing to do).

Definition at line 55 of file random_partition.hpp.


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