mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
55  template<typename VecType>
56  static double SplitIfBetter(
57  const double bestGain,
58  const VecType& data,
59  const size_t numCategories,
60  const arma::Row<size_t>& labels,
61  const size_t numClasses,
62  const size_t minimumLeafSize,
63  arma::Col<typename VecType::elem_type>& classProbabilities,
65 
72  template<typename ElemType>
73  static size_t NumChildren(const arma::Col<ElemType>& classProbabilities,
74  const AuxiliarySplitInfo<ElemType>& /* aux */);
75 
82  template<typename ElemType>
83  static size_t CalculateDirection(
84  const ElemType& point,
85  const arma::Col<ElemType>& classProbabilities,
86  const AuxiliarySplitInfo<ElemType>& /* aux */);
87 };
88 
89 } // namespace tree
90 } // namespace mlpack
91 
92 // Include implementation.
93 #include "all_categorical_split_impl.hpp"
94 
95 #endif
96 
static size_t NumChildren(const arma::Col< ElemType > &classProbabilities, const AuxiliarySplitInfo< ElemType > &)
Return the number of children in the split.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double SplitIfBetter(const double bestGain, const VecType &data, const size_t numCategories, const arma::Row< size_t > &labels, const size_t numClasses, const size_t minimumLeafSize, arma::Col< typename VecType::elem_type > &classProbabilities, AuxiliarySplitInfo< typename VecType::elem_type > &aux)
Check if we can split a node.
The AllCategoricalSplit is a splitting function that will split categorical features into many childr...
static size_t CalculateDirection(const ElemType &point, const arma::Col< ElemType > &classProbabilities, const AuxiliarySplitInfo< ElemType > &)
Calculate the direction a point should percolate to.