mlpack  2.0.1
kmeans_selection.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
16 #define __MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
17 
18 #include <mlpack/core.hpp>
20 
21 namespace mlpack {
22 namespace kernel {
23 
30 template<typename ClusteringType = kmeans::KMeans<>, size_t maxIterations = 5>
32 {
33  public:
42  const static arma::mat* Select(const arma::mat& data, const size_t m)
43  {
44  arma::Row<size_t> assignments;
45  arma::mat* centroids = new arma::mat;
46 
47  // Perform the K-Means clustering method.
48  ClusteringType kmeans(maxIterations);
49  kmeans.Cluster(data, m, assignments, *centroids);
50 
51  return centroids;
52  }
53 };
54 
55 } // namespace kernel
56 } // namespace mlpack
57 
58 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
static const arma::mat * Select(const arma::mat &data, const size_t m)
Use the K-Means clustering method to select the specified number of points in the dataset...
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
Implementation of the kmeans sampling scheme.