mlpack
Classes | Static Public Member Functions | List of all members
mlpack::tree::BestBinaryNumericSplit< FitnessFunction > Class Template Reference

The BestBinaryNumericSplit is a splitting function for decision trees that will exhaustively search a numeric dimension for the best binary split. More...

#include <best_binary_numeric_split.hpp>

Classes

class  AuxiliarySplitInfo
 

Static Public Member Functions

template<bool UseWeights, typename VecType , typename WeightVecType >
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)
 Check if we can split a node. More...
 
template<bool UseWeights, typename VecType , typename ResponsesType , typename WeightVecType >
static std::enable_if< !HasOptimizedBinarySplitForms< FitnessFunction, UseWeights >::value, double >::type SplitIfBetter (const double bestGain, const VecType &data, const ResponsesType &responses, const WeightVecType &weights, const size_t minimumLeafSize, const double minimumGainSplit, double &splitInfo, AuxiliarySplitInfo &aux)
 Check if we can split a node. More...
 
template<bool UseWeights, typename VecType , typename ResponsesType , typename WeightVecType >
static std::enable_if< HasOptimizedBinarySplitForms< FitnessFunction, UseWeights >::value, double >::type SplitIfBetter (const double bestGain, const VecType &data, const ResponsesType &responses, const WeightVecType &weights, const size_t minimumLeafSize, const double minimumGainSplit, double &splitInfo, AuxiliarySplitInfo &)
 Check if we can split a node. More...
 
static size_t NumChildren (const double &, const AuxiliarySplitInfo &)
 Returns 2, since the binary split always has two children.
 
template<typename ElemType >
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). More...
 

Detailed Description

template<typename FitnessFunction>
class mlpack::tree::BestBinaryNumericSplit< FitnessFunction >

The BestBinaryNumericSplit is a splitting function for decision trees that will exhaustively search a numeric dimension for the best binary split.

Template Parameters
FitnessFunctionFitness function to use to calculate gain.

Member Function Documentation

◆ CalculateDirection()

template<typename FitnessFunction >
template<typename ElemType >
size_t mlpack::tree::BestBinaryNumericSplit< FitnessFunction >::CalculateDirection ( const ElemType &  point,
const double &  splitInfo,
const AuxiliarySplitInfo  
)
static

Given a point, calculate which child it should go to (left or right).

Parameters
pointPoint to calculate direction of.
splitInfoAuxiliary information for the split.
*(aux) Auxiliary information for the split (Unused).

◆ SplitIfBetter() [1/3]

template<typename FitnessFunction >
template<bool UseWeights, typename VecType , typename WeightVecType >
double mlpack::tree::BestBinaryNumericSplit< FitnessFunction >::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 
)
static

Check if we can split a node.

If we can split a node in a way that improves on 'bestGain', then we return the improved gain. Otherwise we return the value 'bestGain'. If a split is made, then splitInfo and aux may be modified.

This overload is used only for classification tasks.

Parameters
bestGainBest gain seen so far (we'll only split if we find gain better than this).
dataThe dimension of data points to check for a split in.
labelsLabels for each point.
numClassesNumber of classes in the dataset.
weightsWeights associated with labels.
minimumLeafSizeMinimum number of points in a leaf node for splitting.
minimumGainSplitMinimum gain split.
splitInfoStores split information on a successful split.
auxAuxiliary split information, which may be modified on a successful split.

◆ SplitIfBetter() [2/3]

template<typename FitnessFunction >
template<bool UseWeights, typename VecType , typename ResponsesType , typename WeightVecType >
std::enable_if< HasOptimizedBinarySplitForms< FitnessFunction, UseWeights >::value, double >::type mlpack::tree::BestBinaryNumericSplit< FitnessFunction >::SplitIfBetter ( const double  bestGain,
const VecType &  data,
const ResponsesType &  responses,
const WeightVecType &  weights,
const size_t  minimumLeafSize,
const double  minimumGainSplit,
double &  splitInfo,
AuxiliarySplitInfo aux 
)
static

Check if we can split a node.

If we can split a node in a way that improves on 'bestGain', then we return the improved gain. Otherwise we return the value 'bestGain'. If a split is made, then splitInfo and aux may be modified.

This overload is used only for regression tasks.

Parameters
bestGainBest gain seen so far (we'll only split if we find gain better than this).
dataThe dimension of data points to check for a split in.
responsesResponses for each point.
weightsWeights associated with responses.
minimumLeafSizeMinimum number of points in a leaf node for splitting.
minimumGainSplitMinimum gain split.
splitInfoStores split information on a successful split.
auxAuxiliary split information, which may be modified on a successful split.

◆ SplitIfBetter() [3/3]

template<typename FitnessFunction >
template<bool UseWeights, typename VecType , typename ResponsesType , typename WeightVecType >
static std::enable_if< HasOptimizedBinarySplitForms<FitnessFunction, UseWeights>::value, double>::type mlpack::tree::BestBinaryNumericSplit< FitnessFunction >::SplitIfBetter ( const double  bestGain,
const VecType &  data,
const ResponsesType &  responses,
const WeightVecType &  weights,
const size_t  minimumLeafSize,
const double  minimumGainSplit,
double &  splitInfo,
AuxiliarySplitInfo  
)
static

Check if we can split a node.

If we can split a node in a way that improves on 'bestGain', then we return the improved gain. Otherwise we return the value 'bestGain'. If a split is made, then splitInfo and aux may be modified.

This overload is specialized for any fitness function that implements BinaryScanInitialize(), BinaryStep() and BinaryGains() functions.

Parameters
bestGainBest gain seen so far (we'll only split if we find gain better than this).
dataThe dimension of data points to check for a split in.
responsesResponses for each point.
weightsWeights associated with responses.
minimumLeafSizeMinimum number of points in a leaf node for splitting.
minimumGainSplitMinimum gain split.
splitInfoStores split information on a successful split.
auxAuxiliary split information, which may be modified on a successful split.

The documentation for this class was generated from the following files: