xgboost
Classes | Public Member Functions | List of all members
xgboost::RegTree::Node Class Reference

tree node More...

#include <tree_model.h>

Collaboration diagram for xgboost::RegTree::Node:
Collaboration graph

Public Member Functions

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

Detailed Description

tree node

Constructor & Destructor Documentation

◆ Node() [1/2]

XGBOOST_DEVICE xgboost::RegTree::Node::Node ( )
inline

◆ Node() [2/2]

xgboost::RegTree::Node::Node ( int32_t  cleft,
int32_t  cright,
int32_t  parent,
uint32_t  split_ind,
float  split_cond,
bool  default_left 
)
inline

Member Function Documentation

◆ ByteSwap()

Node xgboost::RegTree::Node::ByteSwap ( ) const
inline

◆ DefaultChild()

XGBOOST_DEVICE int xgboost::RegTree::Node::DefaultChild ( ) const
inline

index of default child when feature is missing

◆ DefaultLeft()

XGBOOST_DEVICE bool xgboost::RegTree::Node::DefaultLeft ( ) const
inline

when feature is unknown, whether goes to left child

◆ IsDeleted()

XGBOOST_DEVICE bool xgboost::RegTree::Node::IsDeleted ( ) const
inline

whether this node is deleted

◆ IsLeaf()

XGBOOST_DEVICE bool xgboost::RegTree::Node::IsLeaf ( ) const
inline

whether current node is leaf node

◆ IsLeftChild()

XGBOOST_DEVICE bool xgboost::RegTree::Node::IsLeftChild ( ) const
inline

whether current node is left child

◆ IsRoot()

XGBOOST_DEVICE bool xgboost::RegTree::Node::IsRoot ( ) const
inline

whether current node is root

◆ LeafValue()

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

◆ LeftChild()

XGBOOST_DEVICE int xgboost::RegTree::Node::LeftChild ( ) const
inline

index of left child

◆ MarkDelete()

XGBOOST_DEVICE void xgboost::RegTree::Node::MarkDelete ( )
inline

mark that this node is deleted

◆ operator==()

bool xgboost::RegTree::Node::operator== ( const Node b) const
inline

◆ Parent()

XGBOOST_DEVICE int xgboost::RegTree::Node::Parent ( ) const
inline

get parent of the node

◆ Reuse()

XGBOOST_DEVICE void xgboost::RegTree::Node::Reuse ( )
inline

Reuse this deleted node.

◆ RightChild()

XGBOOST_DEVICE int xgboost::RegTree::Node::RightChild ( ) const
inline

index of right child

◆ 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

◆ SetParent()

XGBOOST_DEVICE void xgboost::RegTree::Node::SetParent ( int  pidx,
bool  is_left_child = true 
)
inline

◆ 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

◆ SplitIndex()

XGBOOST_DEVICE unsigned xgboost::RegTree::Node::SplitIndex ( ) const
inline

feature index of split condition


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