Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Public Member Functions
xgboost::RegTree::Node Class Reference

tree node More...

#include <tree_model.h>

Public Member Functions

 Node (int32_t cleft, int32_t cright, int32_t parent, uint32_t split_ind, float split_cond, bool default_left)
 
XGBOOST_DEVICE int LeftChild () const
 index of left child
 
XGBOOST_DEVICE int RightChild () const
 index of right child
 
XGBOOST_DEVICE int DefaultChild () const
 index of default child when feature is missing
 
XGBOOST_DEVICE unsigned SplitIndex () const
 feature index of split condition
 
XGBOOST_DEVICE bool DefaultLeft () const
 when feature is unknown, whether goes to left child
 
XGBOOST_DEVICE bool IsLeaf () const
 whether current node is leaf node
 
XGBOOST_DEVICE float LeafValue () const
 
XGBOOST_DEVICE SplitCondT SplitCond () const
 
XGBOOST_DEVICE int Parent () const
 get parent of the node
 
XGBOOST_DEVICE bool IsLeftChild () const
 whether current node is left child
 
XGBOOST_DEVICE bool IsDeleted () const
 whether this node is deleted
 
XGBOOST_DEVICE bool IsRoot () const
 whether current node is root
 
XGBOOST_DEVICE void SetLeftChild (int nid)
 set the left child
 
XGBOOST_DEVICE void SetRightChild (int nid)
 set the right child
 
XGBOOST_DEVICE void SetSplit (unsigned split_index, SplitCondT split_cond, bool default_left=false)
 set split condition of current node
 
XGBOOST_DEVICE void SetLeaf (bst_float value, int right=kInvalidNodeId)
 set the leaf value of the node
 
XGBOOST_DEVICE void MarkDelete ()
 mark that this node is deleted
 
XGBOOST_DEVICE void Reuse ()
 Reuse this deleted node.
 
XGBOOST_DEVICE void SetParent (int pidx, bool is_left_child=true)
 
bool operator== (const Node &b) const
 
Node ByteSwap () const
 

Detailed Description

tree node

Member Function Documentation

◆ LeafValue()

XGBOOST_DEVICE float xgboost::RegTree::Node::LeafValue ( ) const
inline
Returns
get leaf value of leaf node

◆ SetLeaf()

XGBOOST_DEVICE void xgboost::RegTree::Node::SetLeaf ( bst_float  value,
int  right = kInvalidNodeId 
)
inline

set the leaf value of the node

Parameters
valueleaf value
rightright index, could be used to store additional information

◆ SetLeftChild()

XGBOOST_DEVICE void xgboost::RegTree::Node::SetLeftChild ( int  nid)
inline

set the left child

Parameters
nidnode id to right child

◆ SetRightChild()

XGBOOST_DEVICE void xgboost::RegTree::Node::SetRightChild ( int  nid)
inline

set the right child

Parameters
nidnode id to right child

◆ SetSplit()

XGBOOST_DEVICE void xgboost::RegTree::Node::SetSplit ( unsigned  split_index,
SplitCondT  split_cond,
bool  default_left = false 
)
inline

set split condition of current node

Parameters
split_indexfeature index to split
split_condsplit condition
default_leftthe default direction when feature is unknown

◆ SplitCond()

XGBOOST_DEVICE SplitCondT xgboost::RegTree::Node::SplitCond ( ) const
inline
Returns
get split condition of the node

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