mlpack
random_binary_numeric_split.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_DECISION_TREE_RANDOM_BINARY_NUMERIC_SPLIT_HPP
13 #define MLPACK_METHODS_DECISION_TREE_RANDOM_BINARY_NUMERIC_SPLIT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace tree {
19 
27 template<typename FitnessFunction>
29 {
30  public:
31  // No extra info needed for split.
32  class AuxiliarySplitInfo { };
33 
78  template<bool UseWeights, typename VecType, typename WeightVecType>
79  static double SplitIfBetter(
80  const double bestGain,
81  const VecType& data,
82  const arma::Row<size_t>& labels,
83  const size_t numClasses,
84  const WeightVecType& weights,
85  const size_t minimumLeafSize,
86  const double minimumGainSplit,
87  arma::vec& splitInfo,
88  AuxiliarySplitInfo& aux,
89  const bool splitIfBetterGain = false);
90 
114  template<bool UseWeights, typename VecType, typename WeightVecType>
115  static double SplitIfBetter(
116  const double bestGain,
117  const VecType& data,
118  const arma::rowvec& responses,
119  const WeightVecType& weights,
120  const size_t minimumLeafSize,
121  const double minimumGainSplit,
122  double& splitInfo,
123  AuxiliarySplitInfo& aux,
124  const bool splitIfBetterGain = false);
125 
133  static size_t NumChildren(const double& /* splitInfo */,
134  const AuxiliarySplitInfo& /* aux */)
135  {
136  return 2;
137  }
138 
146  template<typename ElemType>
147  static size_t CalculateDirection(
148  const ElemType& point,
149  const double& splitInfo,
150  const AuxiliarySplitInfo& /* aux */);
151 };
152 
153 } // namespace tree
154 } // namespace mlpack
155 
156 // Include implementation.
158 
159 #endif
The RandomBinaryNumericSplit is a splitting function for decision trees that will split based on a ra...
Definition: random_binary_numeric_split.hpp:28
static double SplitIfBetter(const double bestGain, const VecType &data, const arma::Row< size_t > &labels, const size_t numClasses, const WeightVecType &weights, const size_t minimumLeafSize, const double minimumGainSplit, arma::vec &splitInfo, AuxiliarySplitInfo &aux, const bool splitIfBetterGain=false)
Check if we can split a node.
Definition: random_binary_numeric_split_impl.hpp:23
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
static size_t CalculateDirection(const ElemType &point, const double &splitInfo, const AuxiliarySplitInfo &)
Given a point, calculate which child it should go to (left or right).
Definition: random_binary_numeric_split_impl.hpp:260
The core includes that mlpack expects; standard C++ includes and Armadillo.
static size_t NumChildren(const double &, const AuxiliarySplitInfo &)
Returns 2, since the binary split always has two children.
Definition: random_binary_numeric_split.hpp:133
Definition: random_binary_numeric_split.hpp:32