MLPACK
1.0.4
|
00001 00023 #ifndef __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 00024 #define __MLPACK_METHODS_KMEANS_RANDOM_PARTITION_HPP 00025 00026 #include <mlpack/core.hpp> 00027 00028 namespace mlpack { 00029 namespace kmeans { 00030 00036 class RandomPartition 00037 { 00038 public: 00040 RandomPartition() { } 00041 00053 template<typename MatType> 00054 inline static void Cluster(const MatType& data, 00055 const size_t clusters, 00056 arma::Col<size_t>& assignments) 00057 { 00058 // Implementation is so simple we'll put it here in the header file. 00059 assignments = arma::shuffle(arma::linspace<arma::Col<size_t> >(0, 00060 (clusters - 1), data.n_cols)); 00061 } 00062 }; 00063 00064 }; 00065 }; 00066 00067 #endif