CNum 0.2.1
CPU-optimized ML library for C++
Loading...
Searching...
No Matches
CNum::Model::Tree::TreeBoosterNode Class Reference

A node used in a TreeBooster used for gather and storing information about the decision making process. More...

#include <TreeBoosterNode.h>

Public Member Functions

 TreeBoosterNode (TreeBoosterNode *left=nullptr, TreeBoosterNode *right=nullptr)
 Overloaded default constructor.
virtual ~TreeBoosterNode ()
std::string to_json_string ()
 Save TreeBoosterNode data for an entire TreeBooster in a JSON formatted string.

Static Public Member Functions

static Split find_best_split_hist (const CNum::DataStructs::Matrix< int > &X, std::shared_ptr< CNum::Data::Shelf[]> shelves, const double *g, const double *h, bool histogram_cache, const arena_view_t &hist_view, DataPartition &partition, double weight_decay=0.0, double reg_lambda=1.0, double gamma=0)
 Find the best split at a tree node with the histogram method (maximizing gain).
static Split find_best_split_greedy (CNum::DataStructs::Matrix< double > &X, const double *g, const double *h, double weight_decay=0.0, double reg_lambda=1.0, double gamma=0)
 Find the best split at a tree node with the exact greedy method proposed in Chen & Guestrin's XGBoost (minimizing loss).

Public Attributes

Split _split
double _value
TreeBoosterNode_left
TreeBoosterNode_right

Friends

class TreeBooster

Detailed Description

A node used in a TreeBooster used for gather and storing information about the decision making process.

Constructor & Destructor Documentation

◆ TreeBoosterNode()

CNum::Model::Tree::TreeBoosterNode::TreeBoosterNode ( TreeBoosterNode * left = nullptr,
TreeBoosterNode * right = nullptr )

Overloaded default constructor.

Parameters
leftThe left child of the tree
rightThe right child of the tree

◆ ~TreeBoosterNode()

virtual CNum::Model::Tree::TreeBoosterNode::~TreeBoosterNode ( )
virtual

Member Function Documentation

◆ find_best_split_greedy()

Split CNum::Model::Tree::TreeBoosterNode::find_best_split_greedy ( CNum::DataStructs::Matrix< double > & X,
const double * g,
const double * h,
double weight_decay = 0.0,
double reg_lambda = 1.0,
double gamma = 0 )
static

Find the best split at a tree node with the exact greedy method proposed in Chen & Guestrin's XGBoost (minimizing loss).

Available next release

Parameters
XThe dataset
gThe gradient array
hThe hessian array
weight_decayA parameter used in deteriming whether or not a splits effect is significant enough to take
reg_lambdaReg Lambda; A regularization parameter
gammaGamma; A regularization parameter
Returns
The best split

◆ find_best_split_hist()

Split CNum::Model::Tree::TreeBoosterNode::find_best_split_hist ( const CNum::DataStructs::Matrix< int > & X,
std::shared_ptr< CNum::Data::Shelf[]> shelves,
const double * g,
const double * h,
bool histogram_cache,
const arena_view_t & hist_view,
DataPartition & partition,
double weight_decay = 0.0,
double reg_lambda = 1.0,
double gamma = 0 )
static

Find the best split at a tree node with the histogram method (maximizing gain).

Parameters
XThe dataset
shelvesThe bins and values associated with their boundaries
gThe gradient array
hThe hessian array
histogram_cacheWhether or not the histograms have already been built
hist_viewThe view of the histograms
partitionThe partition of the node's slice of the dataset
weight_decayA parameter used in deteriming whether or not a splits effect is significant enough to take
reg_lambdaReg Lambda; A regularization parameter
gammaGamma; A regularization parameter
Returns
The best split

◆ to_json_string()

std::string CNum::Model::Tree::TreeBoosterNode::to_json_string ( )

Save TreeBoosterNode data for an entire TreeBooster in a JSON formatted string.

Returns
The JSON string

◆ TreeBooster

friend class TreeBooster
friend

Member Data Documentation

◆ _left

TreeBoosterNode* CNum::Model::Tree::TreeBoosterNode::_left

◆ _right

TreeBoosterNode* CNum::Model::Tree::TreeBoosterNode::_right

◆ _split

Split CNum::Model::Tree::TreeBoosterNode::_split

◆ _value

double CNum::Model::Tree::TreeBoosterNode::_value

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