|
void | ChangeToLeaf (int rid, bst_float value) |
| change a non leaf node to a leaf node, delete its children
|
|
void | CollapseToLeaf (int rid, bst_float value) |
| collapse a non leaf node to a leaf node, delete its children
|
|
| RegTree (bst_target_t n_targets, bst_feature_t n_features) |
| Constructor that initializes the tree model with shape.
|
|
Node & | operator[] (int nid) |
| get node given nid
|
|
const Node & | operator[] (int nid) const |
| get node given nid
|
|
const std::vector< Node > & | GetNodes () const |
| get const reference to nodes
|
|
const std::vector< RTreeNodeStat > & | GetStats () const |
| get const reference to stats
|
|
RTreeNodeStat & | Stat (int nid) |
| get node statistics given nid
|
|
const RTreeNodeStat & | Stat (int nid) const |
| get node statistics given nid
|
|
void | Load (dmlc::Stream *fi) |
| load model from stream
|
|
void | Save (dmlc::Stream *fo) const |
| save model to stream
|
|
void | LoadModel (Json const &in) override |
| load the model from a JSON object
|
|
void | SaveModel (Json *out) const override |
| saves the model config to a JSON object
|
|
bool | operator== (const RegTree &b) const |
|
template<typename Func > |
void | WalkTree (Func func) const |
|
bool | Equal (const RegTree &b) const |
| Compares whether 2 trees are equal from a user's perspective. The equality compares only non-deleted nodes.
|
|
void | ExpandNode (bst_node_t nid, unsigned split_index, bst_float split_value, bool default_left, bst_float base_weight, bst_float left_leaf_weight, bst_float right_leaf_weight, bst_float loss_change, float sum_hess, float left_sum, float right_sum, bst_node_t leaf_right_child=kInvalidNodeId) |
| Expands a leaf node into two additional leaf nodes.
|
|
void | ExpandNode (bst_node_t nidx, bst_feature_t split_index, float split_cond, bool default_left, linalg::VectorView< float const > base_weight, linalg::VectorView< float const > left_weight, linalg::VectorView< float const > right_weight) |
| Expands a leaf node into two additional leaf nodes for a multi-target tree.
|
|
void | ExpandCategorical (bst_node_t nid, bst_feature_t split_index, common::Span< const uint32_t > split_cat, bool default_left, bst_float base_weight, bst_float left_leaf_weight, bst_float right_leaf_weight, bst_float loss_change, float sum_hess, float left_sum, float right_sum) |
| Expands a leaf node with categories.
|
|
bool | HasCategoricalSplit () const |
| Whether this tree has categorical split.
|
|
bool | IsMultiTarget () const |
| Whether this is a multi-target tree.
|
|
bst_target_t | NumTargets () const |
| The size of leaf weight.
|
|
auto | GetMultiTargetTree () const |
| Get the underlying implementaiton of multi-target tree.
|
|
bst_feature_t | NumFeatures () const noexcept |
| Get the number of features.
|
|
bst_node_t | NumNodes () const noexcept |
| Get the total number of nodes including deleted ones in this tree.
|
|
bst_node_t | NumValidNodes () const noexcept |
| Get the total number of valid nodes in this tree.
|
|
bst_node_t | NumExtraNodes () const noexcept |
| number of extra nodes besides the root
|
|
bst_node_t | GetNumLeaves () const |
|
bst_node_t | GetNumSplitNodes () const |
|
std::int32_t | GetDepth (bst_node_t nid) const |
| get current depth
|
|
void | SetLeaf (bst_node_t nidx, linalg::VectorView< float const > weight) |
| Set the leaf weight for a multi-target tree.
|
|
int | MaxDepth (int nid) const |
| get maximum depth
|
|
int | MaxDepth () |
| get maximum depth
|
|
void | CalculateContributionsApprox (const RegTree::FVec &feat, std::vector< float > *mean_values, bst_float *out_contribs) const |
| calculate the approximate feature contributions for the given root
|
|
std::string | DumpModel (const FeatureMap &fmap, bool with_stats, std::string format) const |
| dump the model in the requested format as a text string
|
|
FeatureType | NodeSplitType (bst_node_t nidx) const |
| Get split type for a node.
|
|
std::vector< FeatureType > const & | GetSplitTypes () const |
| Get split types for all nodes.
|
|
common::Span< uint32_t const > | GetSplitCategories () const |
|
common::Span< uint32_t const > | NodeCats (bst_node_t nidx) const |
| Get the bit storage for categories.
|
|
auto const & | GetSplitCategoriesPtr () const |
|
CategoricalSplitMatrix | GetCategoriesMatrix () const |
|
bst_feature_t | SplitIndex (bst_node_t nidx) const |
|
float | SplitCond (bst_node_t nidx) const |
|
bool | DefaultLeft (bst_node_t nidx) const |
|
bool | IsRoot (bst_node_t nidx) const |
|
bool | IsLeaf (bst_node_t nidx) const |
|
bst_node_t | Parent (bst_node_t nidx) const |
|
bst_node_t | LeftChild (bst_node_t nidx) const |
|
bst_node_t | RightChild (bst_node_t nidx) const |
|
bool | IsLeftChild (bst_node_t nidx) const |
|
bst_node_t | Size () const |
|
define regression tree to be the most common tree model.
This is the data structure used in xgboost's major tree models.