mlpack
all_categorical_split.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_DECISION_TREE_ALL_CATEGORICAL_SPLIT_HPP
14 #define MLPACK_METHODS_DECISION_TREE_ALL_CATEGORICAL_SPLIT_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace tree {
20 
29 template<typename FitnessFunction>
31 {
32  public:
33  // No extra info needed for split.
34  class AuxiliarySplitInfo { };
35 
59  template<bool UseWeights, typename VecType, typename LabelsType,
60  typename WeightVecType>
61  static double SplitIfBetter(
62  const double bestGain,
63  const VecType& data,
64  const size_t numCategories,
65  const LabelsType& labels,
66  const size_t numClasses,
67  const WeightVecType& weights,
68  const size_t minimumLeafSize,
69  const double minimumGainSplit,
70  arma::vec& splitInfo,
71  AuxiliarySplitInfo& aux);
72 
95  template<bool UseWeights, typename VecType, typename ResponsesType,
96  typename WeightVecType>
97  static double SplitIfBetter(
98  const double bestGain,
99  const VecType& data,
100  const size_t numCategories,
101  const ResponsesType& responses,
102  const WeightVecType& weights,
103  const size_t minimumLeafSize,
104  const double minimumGainSplit,
105  double& splitInfo,
106  AuxiliarySplitInfo& aux);
107 
114  static size_t NumChildren(const double& splitInfo,
115  const AuxiliarySplitInfo& /* aux */);
116 
124  template<typename ElemType>
125  static size_t CalculateDirection(
126  const ElemType& point,
127  const double& splitInfo,
128  const AuxiliarySplitInfo& /* aux */);
129 };
130 
131 } // namespace tree
132 } // namespace mlpack
133 
134 // Include implementation.
136 
137 #endif
static size_t CalculateDirection(const ElemType &point, const double &splitInfo, const AuxiliarySplitInfo &)
Calculate the direction a point should percolate to.
Definition: all_categorical_split_impl.hpp:220
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
The AllCategoricalSplit is a splitting function that will split categorical features into many childr...
Definition: all_categorical_split.hpp:30
static size_t NumChildren(const double &splitInfo, const AuxiliarySplitInfo &)
Return the number of children in the split.
Definition: all_categorical_split_impl.hpp:211
Definition: all_categorical_split.hpp:34
static double SplitIfBetter(const double bestGain, const VecType &data, const size_t numCategories, const LabelsType &labels, const size_t numClasses, const WeightVecType &weights, const size_t minimumLeafSize, const double minimumGainSplit, arma::vec &splitInfo, AuxiliarySplitInfo &aux)
Check if we can split a node.
Definition: all_categorical_split_impl.hpp:22