mlpack  1.0.12
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 
24 template<typename ClusteringType = kmeans::KMeans<> >
26 {
27  public:
36  const static arma::mat* Select(const arma::mat& data,
37  const size_t m,
38  const size_t maxIterations = 5)
39  {
40  arma::Col<size_t> assignments;
41  arma::mat* centroids = new arma::mat;
42 
43  // Perform the K-Means clustering method.
44  ClusteringType kmeans(maxIterations);
45  kmeans.Cluster(data, m, assignments, *centroids);
46 
47  return centroids;
48  }
49 };
50 
51 }; // namespace kernel
52 }; // namespace mlpack
53 
54 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
static const arma::mat * Select(const arma::mat &data, const size_t m, const size_t maxIterations=5)
Use the K-Means clustering method to select the specified number of points in the dataset...