mlpack  3.1.1
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 
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:22
prereqs.hpp
mlpack
@serialization.hpp
Definition: add_to_po.hpp:21
mlpack::math::RandInt
int RandInt(const int hiExclusive)
Generates a uniform random integer.
Definition: random.hpp:105
mlpack::kernel::RandomSelection::Select
const static 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