23 #ifndef __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 24 #define __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 53 template<
typename MatType>
54 inline static void Cluster(
const MatType& data,
55 const size_t clusters,
56 arma::Col<size_t>& assignments)
59 assignments = arma::shuffle(arma::linspace<arma::Col<size_t> >(0,
60 (clusters - 1), data.n_cols));
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::Col< 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...