MLPACK  1.0.10
random_partition.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP
24 #define __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP
25 
26 #include <mlpack/core.hpp>
27 
28 namespace mlpack {
29 namespace kmeans {
30 
37 {
38  public:
41 
53  template<typename MatType>
54  inline static void Cluster(const MatType& data,
55  const size_t clusters,
56  arma::Col<size_t>& assignments)
57  {
58  // Implementation is so simple we'll put it here in the header file.
59  assignments = arma::shuffle(arma::linspace<arma::Col<size_t> >(0,
60  (clusters - 1), data.n_cols));
61  }
62 };
63 
64 };
65 };
66 
67 #endif