mlpack  1.0.12
random_selection.hpp
Go to the documentation of this file.
1 
16 #ifndef __MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
17 #define __MLPACK_METHODS_NYSTROEM_METHOD_RANDOM_SELECTION_HPP
18 
19 #include <mlpack/core.hpp>
20 
21 namespace mlpack {
22 namespace kernel {
23 
25 {
26  public:
34  const static arma::Col<size_t> Select(const arma::mat& data, const size_t m)
35  {
36  arma::Col<size_t> selectedPoints(m);
37  for (size_t i = 0; i < m; ++i)
38  selectedPoints(i) = math::RandInt(0, data.n_cols);
39 
40  return selectedPoints;
41  }
42 };
43 
44 }; // namespace kernel
45 }; // namespace mlpack
46 
47 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
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:98