kmeans_selection.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
14 #define MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace kernel {
21 
28 template<typename ClusteringType = kmeans::KMeans<>, size_t maxIterations = 5>
30 {
31  public:
40  const static arma::mat* Select(const arma::mat& data, const size_t m)
41  {
42  arma::Row<size_t> assignments;
43  arma::mat* centroids = new arma::mat;
44 
45  // Perform the K-Means clustering method.
46  ClusteringType kmeans(maxIterations);
47  kmeans.Cluster(data, m, assignments, *centroids);
48 
49  return centroids;
50  }
51 };
52 
53 } // namespace kernel
54 } // namespace mlpack
55 
56 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Implementation of the kmeans sampling scheme.
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...