Struct TreeNode
Synopsis
#include <include/thundergbm/tree.h>
struct TreeNode
Description
No description yet.
Methods
calc_weight | ||
splittable |
Source
Lines 14-42 in include/thundergbm/tree.h.
struct TreeNode {
int final_id;// node id after pruning, may not equal to node index
int lch_index;// index of left child
int rch_index;// index of right child
int parent_index;// index of parent node
float_type gain;// gain of splitting this node
float_type base_weight;
int split_feature_id;
float_type split_value;
unsigned char split_bid;
bool default_right;
bool is_leaf;
bool is_valid;// non-valid nodes are those that are "children" of leaf nodes
bool is_pruned;// pruned after pruning
GHPair sum_gh_pair;
friend std::ostream &operator<<(std::ostream &os,
const TreeNode &node);
HOST_DEVICE void calc_weight(float_type lambda) {
this->base_weight = -sum_gh_pair.g / (sum_gh_pair.h + lambda);
}
HOST_DEVICE bool splittable() const {
return !is_leaf && is_valid;
}
};