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 
27 template<typename FitnessFunction>
29 {
30  public:
31  // No extra info needed for split.
32  template<typename ElemType>
33  class AuxiliarySplitInfo { };
34 
57  template<bool UseWeights, typename VecType, typename WeightVecType>
58  static double SplitIfBetter(
59  const double bestGain,
60  const VecType& data,
61  const size_t numCategories,
62  const arma::Row<size_t>& labels,
63  const size_t numClasses,
64  const WeightVecType& weights,
65  const size_t minimumLeafSize,
66  const double minimumGainSplit,
67  arma::Col<typename VecType::elem_type>& classProbabilities,
69 
76  template<typename ElemType>
77  static size_t NumChildren(const arma::Col<ElemType>& classProbabilities,
78  const AuxiliarySplitInfo<ElemType>& /* aux */);
79 
87  template<typename ElemType>
88  static size_t CalculateDirection(
89  const ElemType& point,
90  const arma::Col<ElemType>& classProbabilities,
91  const AuxiliarySplitInfo<ElemType>& /* aux */);
92 };
93 
94 } // namespace tree
95 } // namespace mlpack
96 
97 // Include implementation.
98 #include "all_categorical_split_impl.hpp"
99 
100 #endif
static size_t NumChildren(const arma::Col< ElemType > &classProbabilities, const AuxiliarySplitInfo< ElemType > &)
Return the number of children in the split.
Linear algebra utility functions, generally performed on matrices or vectors.
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...
static double SplitIfBetter(const double bestGain, const VecType &data, const size_t numCategories, const arma::Row< size_t > &labels, const size_t numClasses, const WeightVecType &weights, const size_t minimumLeafSize, const double minimumGainSplit, arma::Col< typename VecType::elem_type > &classProbabilities, AuxiliarySplitInfo< typename VecType::elem_type > &aux)
Check if we can split a node.
static size_t CalculateDirection(const ElemType &point, const arma::Col< ElemType > &classProbabilities, const AuxiliarySplitInfo< ElemType > &)
Calculate the direction a point should percolate to.