13 #ifndef MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 14 #define MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 43 template<
typename MatType>
44 inline static void Cluster(
const MatType& data,
45 const size_t clusters,
46 arma::Row<size_t>& assignments)
49 assignments = arma::shuffle(arma::linspace<arma::Row<size_t>>(0,
50 (clusters - 1), data.n_cols));
54 template<
typename Archive>
RandomPartition()
Empty constructor, required by the InitialPartitionPolicy policy.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &, const uint32_t)
Serialize the partitioner (nothing to do).
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.
A very simple partitioner which partitions the data randomly into the number of desired clusters...