Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Friends
xgboost::tree::SplitEntryContainer< GradientT > Struct Template Reference

statistics that is helpful to store and represent a split solution for the tree More...

#include <param.h>

Public Member Functions

void CopyAndCollect (SplitEntryContainer< GradientT > const &that, std::vector< uint32_t > *collected_cat_bits, std::vector< std::size_t > *cat_bits_sizes)
 Copy primitive fields into this, and collect cat_bits into a vector.
 
template<typename G >
void CopyAndCollect (SplitEntryContainer< GradientT > const &that, std::vector< uint32_t > *collected_cat_bits, std::vector< std::size_t > *cat_bits_sizes, std::vector< G > *collected_gradients)
 Copy primitive fields into this, and collect cat_bits and gradient sums into vectors.
 
bst_feature_t SplitIndex () const
 
bool DefaultLeft () const
 
bool NeedReplace (bst_float new_loss_chg, unsigned split_index) const
 decides whether we can replace current entry with the given statistics
 
bool Update (const SplitEntryContainer &e)
 update the split entry, replace it if e is better
 
template<typename GradientSumT >
bool Update (bst_float new_loss_chg, bst_feature_t split_index, float new_split_value, bool default_left, bool is_cat, GradientSumT const &left_sum, GradientSumT const &right_sum)
 update the split entry, replace it if e is better
 

Static Public Member Functions

static void Reduce (SplitEntryContainer &dst, const SplitEntryContainer &src)
 same as update, used by AllReduce
 

Data Fields

bst_float loss_chg {0.0f}
 loss change after split this node
 
bst_feature_t sindex {0}
 split index
 
bst_float split_value {0.0f}
 
std::vector< uint32_t > cat_bits
 
bool is_cat {false}
 
GradientT left_sum
 
GradientT right_sum
 

Friends

std::ostream & operator<< (std::ostream &os, SplitEntryContainer const &s)
 

Detailed Description

template<typename GradientT>
struct xgboost::tree::SplitEntryContainer< GradientT >

statistics that is helpful to store and represent a split solution for the tree

Member Function Documentation

◆ CopyAndCollect() [1/2]

template<typename GradientT >
void xgboost::tree::SplitEntryContainer< GradientT >::CopyAndCollect ( SplitEntryContainer< GradientT > const &  that,
std::vector< uint32_t > *  collected_cat_bits,
std::vector< std::size_t > *  cat_bits_sizes 
)
inline

Copy primitive fields into this, and collect cat_bits into a vector.

This is used for allgather.

Parameters
thatThe other entry to copy from
collected_cat_bitsThe vector to collect cat_bits
cat_bits_sizesThe sizes of the collected cat_bits

◆ CopyAndCollect() [2/2]

template<typename GradientT >
template<typename G >
void xgboost::tree::SplitEntryContainer< GradientT >::CopyAndCollect ( SplitEntryContainer< GradientT > const &  that,
std::vector< uint32_t > *  collected_cat_bits,
std::vector< std::size_t > *  cat_bits_sizes,
std::vector< G > *  collected_gradients 
)
inline

Copy primitive fields into this, and collect cat_bits and gradient sums into vectors.

This is used for allgather.

Parameters
thatThe other entry to copy from
collected_cat_bitsThe vector to collect cat_bits
cat_bits_sizesThe sizes of the collected cat_bits
collected_gradientsThe vector to collect gradients

◆ DefaultLeft()

template<typename GradientT >
bool xgboost::tree::SplitEntryContainer< GradientT >::DefaultLeft ( ) const
inline
Returns
whether missing value goes to left branch

◆ NeedReplace()

template<typename GradientT >
bool xgboost::tree::SplitEntryContainer< GradientT >::NeedReplace ( bst_float  new_loss_chg,
unsigned  split_index 
) const
inline

decides whether we can replace current entry with the given statistics

This function gives better priority to lower index when loss_chg == new_loss_chg. Not the best way, but helps to give consistent result during multi-thread execution.

Parameters
new_loss_chgthe loss reduction get through the split
split_indexthe feature index where the split is on

◆ SplitIndex()

template<typename GradientT >
bst_feature_t xgboost::tree::SplitEntryContainer< GradientT >::SplitIndex ( ) const
inline
Returns
feature index to split on

◆ Update() [1/2]

template<typename GradientT >
template<typename GradientSumT >
bool xgboost::tree::SplitEntryContainer< GradientT >::Update ( bst_float  new_loss_chg,
bst_feature_t  split_index,
float  new_split_value,
bool  default_left,
bool  is_cat,
GradientSumT const &  left_sum,
GradientSumT const &  right_sum 
)
inline

update the split entry, replace it if e is better

Parameters
new_loss_chgloss reduction of new candidate
split_indexfeature index to split on
new_split_valuethe split point
default_leftwhether the missing value goes to left
Returns
whether the proposed split is better and can replace current split

◆ Update() [2/2]

template<typename GradientT >
bool xgboost::tree::SplitEntryContainer< GradientT >::Update ( const SplitEntryContainer< GradientT > &  e)
inline

update the split entry, replace it if e is better

Parameters
ecandidate split solution
Returns
whether the proposed split is better and can replace current split

The documentation for this struct was generated from the following file: