mlpack 3.4.2
best_binary_numeric_split.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_DECISION_TREE_BEST_BINARY_NUMERIC_SPLIT_HPP
13#define MLPACK_METHODS_DECISION_TREE_BEST_BINARY_NUMERIC_SPLIT_HPP
14
15#include <mlpack/prereqs.hpp>
16
17namespace mlpack {
18namespace tree {
19
26template<typename FitnessFunction>
28{
29 public:
30 // No extra info needed for split.
31 template<typename ElemType>
33
54 template<bool UseWeights, typename VecType, typename WeightVecType>
55 static double SplitIfBetter(
56 const double bestGain,
57 const VecType& data,
58 const arma::Row<size_t>& labels,
59 const size_t numClasses,
60 const WeightVecType& weights,
61 const size_t minimumLeafSize,
62 const double minimumGainSplit,
63 arma::Col<typename VecType::elem_type>& classProbabilities,
65
69 template<typename ElemType>
70 static size_t NumChildren(const arma::Col<ElemType>& /* classProbabilities */,
71 const AuxiliarySplitInfo<ElemType>& /* aux */)
72 {
73 return 2;
74 }
75
83 template<typename ElemType>
84 static size_t CalculateDirection(
85 const ElemType& point,
86 const arma::Col<ElemType>& classProbabilities,
87 const AuxiliarySplitInfo<ElemType>& /* aux */);
88};
89
90} // namespace tree
91} // namespace mlpack
92
93// Include implementation.
94#include "best_binary_numeric_split_impl.hpp"
95
96#endif
The BestBinaryNumericSplit is a splitting function for decision trees that will exhaustively search a...
static size_t NumChildren(const arma::Col< ElemType > &, const AuxiliarySplitInfo< ElemType > &)
Returns 2, since the binary split always has two children.
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::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 > &)
Given a point, calculate which child it should go to (left or right).
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.