mlpack
3.4.2
mlpack-3.4.2
src
mlpack
methods
nystroem_method
random_selection.hpp
Go to the documentation of this file.
1
14
#ifndef MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
15
#define MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
16
17
#include <
mlpack/prereqs.hpp
>
18
19
namespace
mlpack
{
20
namespace
kernel {
21
22
class
RandomSelection
23
{
24
public
:
32
const
static
arma::Col<size_t>
Select
(
const
arma::mat& data,
const
size_t
m)
33
{
34
arma::Col<size_t> selectedPoints(m);
35
for
(
size_t
i = 0; i < m; ++i)
36
selectedPoints(i) =
math::RandInt
(0, data.n_cols);
37
38
return
selectedPoints;
39
}
40
};
41
42
}
// namespace kernel
43
}
// namespace mlpack
44
45
#endif
mlpack::kernel::RandomSelection
Definition:
random_selection.hpp:23
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.
mlpack::kernel::RandomSelection::Select
static const arma::Col< size_t > Select(const arma::mat &data, const size_t m)
Randomly select the specified number of points in the dataset.
Definition:
random_selection.hpp:32
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
mlpack::math::RandInt
int RandInt(const int hiExclusive)
Generates a uniform random integer.
Definition:
random.hpp:110
Generated by
1.8.20