|
CNum 0.2.1
CPU-optimized ML library for C++
|
A tree booster modeled after Chen & Guestrin's XGBoost tree booster. More...
#include <XGTreeBooster.h>
Public Member Functions | |
| XGTreeBooster (arena_t *a=nullptr, int md=5, int ms=3, double weight_decay=0.0, double reg_lambda=1.0, double gamma=0.0) | |
| Overloaded constructor. | |
| ~XGTreeBooster () | |
| Destructor. | |
| virtual void | fit (DataMatrix &X, std::shared_ptr< CNum::Data::Shelf[]> shelves, double *g, double *h, DataPartition &partition) override |
| Unified fit function. | |
| Public Member Functions inherited from CNum::Model::Tree::TreeBooster | |
| TreeBooster (arena_t *a=nullptr, int md=5, int ms=3, double weight_decay=0.0, double reg_lambda=1.0, double gamma=0.0) | |
| Overloaded default constructor. | |
| TreeBooster (const TreeBooster &other) noexcept | |
| Copy constructor. | |
| TreeBooster & | operator= (const TreeBooster &other) noexcept |
| Copy equals operator. | |
| TreeBooster (TreeBooster &&other) noexcept | |
| Move constructor. | |
| TreeBooster & | operator= (TreeBooster &&other) noexcept |
| Move equals operator. | |
| virtual | ~TreeBooster () |
| Destructor. | |
| void | set_root (TreeBoosterNode *root) |
| Set the root of the tree. | |
| CNum::DataStructs::Matrix< double > | predict (CNum::DataStructs::Matrix< double > &data) |
| Inference (making predictions) on tabular data. | |
| arena_view_t | init_hist_view (size_t n_data_cols) |
| Allocate space for histograms on the arena. | |
| std::string | to_json () |
| Save tree data in json encoded string. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from CNum::Model::Tree::TreeBooster | |
| static size_t | partition_data (const CNum::DataStructs::Matrix< int > &X, double *g, double *h, size_t feat, uint8_t bin, const DataPartition &partition) |
| Partition idx array, g, and h based on a split to make each nodes' slice of the dataset contigous. | |
| static void | histogram_subtraction (const arena_view_t &parent_hist_view, arena_view_t &small_hist_view, arena_view_t &large_hist_view) |
| Subtract a parent histogram from "small" histogram for histogram caching. | |
| Protected Attributes inherited from CNum::Model::Tree::TreeBooster | |
| TreeBoosterNode * | _root |
| int | _max_depth |
| int | _min_samples |
| double | _reg_lambda |
| double | _gamma |
| double | _weight_decay |
| arena_t * | _arena |
A tree booster modeled after Chen & Guestrin's XGBoost tree booster.
| CNum::Model::Tree::XGTreeBooster::XGTreeBooster | ( | arena_t * | a = nullptr, |
| int | md = 5, | ||
| int | ms = 3, | ||
| double | weight_decay = 0.0, | ||
| double | reg_lambda = 1.0, | ||
| double | gamma = 0.0 ) |
Overloaded constructor.
| md | The max depth of the tree |
| ms | The min samples needed to continue with the tree building process |
| reg_lambda | Reg Lambda; A regularization parameter |
| gamma | Gamma; A regularization parameter |
| CNum::Model::Tree::XGTreeBooster::~XGTreeBooster | ( | ) |
Destructor.
|
overridevirtual |
Unified fit function.
| X | The dataset |
| shelves | The bins and values associated with their boundaries |
| g | The gradient array |
| h | The hessian array |
| partition | The partition of the node's slice of the dataset |
Implements CNum::Model::Tree::TreeBooster.