15 #ifndef __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP
16 #define __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP
45 template<
typename MatType>
46 inline static void Cluster(
const MatType& data,
47 const size_t clusters,
48 arma::Row<size_t>& assignments)
51 assignments = arma::shuffle(arma::linspace<arma::Row<size_t>>(0,
52 (clusters - 1), data.n_cols));
56 template<
typename Archive>
Linear algebra utility functions, generally performed on matrices or vectors.
RandomPartition()
Empty constructor, required by the InitialPartitionPolicy policy.
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.
void Serialize(Archive &, const unsigned int)
Serialize the partitioner (nothing to do).
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
A very simple partitioner which partitions the data randomly into the number of desired clusters...