MLPACK  1.0.10
kmeans_selection.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
24 #define __MLPACK_METHODS_NYSTROEM_METHOD_KMEANS_SELECTION_HPP
25 
26 #include <mlpack/core.hpp>
28 
29 namespace mlpack {
30 namespace kernel {
31 
32 template<typename ClusteringType = kmeans::KMeans<> >
34 {
35  public:
44  const static arma::mat* Select(const arma::mat& data,
45  const size_t m,
46  const size_t maxIterations = 5)
47  {
48  arma::Col<size_t> assignments;
49  arma::mat* centroids = new arma::mat;
50 
51  // Perform the K-Means clustering method.
52  ClusteringType kmeans(maxIterations);
53  kmeans.Cluster(data, m, assignments, *centroids);
54 
55  return centroids;
56  }
57 };
58 
59 }; // namespace kernel
60 }; // namespace mlpack
61 
62 #endif