mlpack 3.4.2
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
19namespace mlpack {
20namespace kernel {
21
28template<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
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.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.