mlpack
3.4.2
mlpack-3.4.2
src
mlpack
methods
nystroem_method
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
>
17
#include <
mlpack/methods/kmeans/kmeans.hpp
>
18
19
namespace
mlpack
{
20
namespace
kernel {
21
28
template
<
typename
ClusteringType = kmeans::KMeans<>,
size_t
maxIterations = 5>
29
class
KMeansSelection
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
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.
mlpack::kernel::KMeansSelection::Select
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.
Definition:
kmeans_selection.hpp:40
kmeans.hpp
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
mlpack::kernel::KMeansSelection
Implementation of the kmeans sampling scheme.
Definition:
kmeans_selection.hpp:30
Generated by
1.8.20