mlpack 3.4.2
random_dimension_select.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_DECISION_TREE_RANDOM_DIMENSION_SELECT_HPP
13#define MLPACK_METHODS_DECISION_TREE_RANDOM_DIMENSION_SELECT_HPP
14
15namespace mlpack {
16namespace tree {
17
22{
23 public:
28 RandomDimensionSelect() : dimensions(0) { }
29
33 size_t Begin() const { return math::RandInt(dimensions); }
34
38 size_t End() const { return dimensions; }
39
44 size_t Next() const { return dimensions; }
45
47 size_t Dimensions() const { return dimensions; }
49 size_t& Dimensions() { return dimensions; }
50
51 private:
53 size_t dimensions;
54};
55
56} // namespace tree
57} // namespace mlpack
58
59#endif
This dimension selection policy only selects one single random dimension.
size_t & Dimensions()
Set the number of dimensions.
size_t End() const
Get the last dimension to select from.
RandomDimensionSelect()
Construct the RandomDimensionSelect object with the given number of dimensions.
size_t Next() const
Get the next (last) dimensions.
size_t Begin() const
Get the first dimension to select from.
size_t Dimensions() const
Get the number of dimensions.
int RandInt(const int hiExclusive)
Generates a uniform random integer.
Definition: random.hpp:110
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1