MLPACK  1.0.11
random_selection.hpp
Go to the documentation of this file.
1 
24 #ifndef __MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
25 #define __MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
26 
27 #include <mlpack/core.hpp>
28 
29 namespace mlpack {
30 namespace kernel {
31 
33 {
34  public:
42  const static arma::Col<size_t> Select(const arma::mat& data, const size_t m)
43  {
44  arma::Col<size_t> selectedPoints(m);
45  for (size_t i = 0; i < m; ++i)
46  selectedPoints(i) = math::RandInt(0, data.n_cols);
47 
48  return selectedPoints;
49  }
50 };
51 
52 }; // namespace kernel
53 }; // namespace mlpack
54 
55 #endif
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.
int RandInt(const int hiExclusive)
Generates a uniform random integer.
Definition: random.hpp:106