treelite
|
tree builder class More...
#include <frontend.h>
Public Member Functions | |
TreeBuilder (const TreeBuilder &)=delete | |
TreeBuilder (TreeBuilder &&)=default | |
TreeBuilder & | operator= (const TreeBuilder &)=delete |
TreeBuilder & | operator= (TreeBuilder &&)=default |
bool | CreateNode (int node_key) |
Create an empty node within a tree. More... | |
bool | DeleteNode (int node_key) |
Remove a node from a tree. More... | |
bool | SetRootNode (int node_key) |
Set a node as the root of a tree. More... | |
bool | SetNumericalTestNode (int node_key, unsigned feature_id, Operator op, tl_float threshold, bool default_left, int left_child_key, int right_child_key) |
Turn an empty node into a numerical test node; the test is in the form [feature value] OP [threshold]. Depending on the result of the test, either left or right child would be taken. More... | |
bool | SetCategoricalTestNode (int node_key, unsigned feature_id, const std::vector< uint32_t > &left_categories, bool default_left, int left_child_key, int right_child_key) |
Turn an empty node into a categorical test node. A list defines all categories that would be classified as the left side. Categories are integers ranging from 0 to (n-1), where n is the number of categories in that particular feature. Let's assume n <= 64. More... | |
bool | SetLeafNode (int node_key, tl_float leaf_value) |
Turn an empty node into a leaf node. More... | |
bool | SetLeafVectorNode (int node_key, const std::vector< tl_float > &leaf_vector) |
Turn an empty node into a leaf vector node The leaf vector (collection of multiple leaf weights per leaf node) is useful for multi-class random forest classifier. More... | |
Friends | |
class | ModelBuilder |
tree builder class
Definition at line 71 of file frontend.h.
bool CreateNode | ( | int | node_key | ) |
Create an empty node within a tree.
node_key | unique integer key to identify the new node |
Definition at line 106 of file builder.cc.
bool DeleteNode | ( | int | node_key | ) |
Remove a node from a tree.
node_key | unique integer key to identify the node to be removed |
Definition at line 115 of file builder.cc.
bool SetCategoricalTestNode | ( | int | node_key, |
unsigned | feature_id, | ||
const std::vector< uint32_t > & | left_categories, | ||
bool | default_left, | ||
int | left_child_key, | ||
int | right_child_key | ||
) |
Turn an empty node into a categorical test node. A list defines all categories that would be classified as the left side. Categories are integers ranging from 0 to (n-1), where n is the number of categories in that particular feature. Let's assume n <= 64.
node_key | unique integer key to identify the node being modified; this node needs to be empty |
feature_id | id of feature |
left_categories | list of categories belonging to the left child |
default_left | default direction for missing values |
left_child_key | unique integer key to identify the left child node |
right_child_key | unique integer key to identify the right child node |
Definition at line 189 of file builder.cc.
bool SetLeafNode | ( | int | node_key, |
tl_float | leaf_value | ||
) |
Turn an empty node into a leaf node.
node_key | unique integer key to identify the node being modified; this node needs to be empty |
leaf_value | leaf value (weight) of the leaf node |
Definition at line 227 of file builder.cc.
bool SetLeafVectorNode | ( | int | node_key, |
const std::vector< tl_float > & | leaf_vector | ||
) |
Turn an empty node into a leaf vector node The leaf vector (collection of multiple leaf weights per leaf node) is useful for multi-class random forest classifier.
node_key | unique integer key to identify the node being modified; this node needs to be empty |
leaf_vector | leaf vector of the leaf node |
Definition at line 241 of file builder.cc.
bool SetNumericalTestNode | ( | int | node_key, |
unsigned | feature_id, | ||
Operator | op, | ||
tl_float | threshold, | ||
bool | default_left, | ||
int | left_child_key, | ||
int | right_child_key | ||
) |
Turn an empty node into a numerical test node; the test is in the form [feature value] OP [threshold]. Depending on the result of the test, either left or right child would be taken.
node_key | unique integer key to identify the node being modified; this node needs to be empty |
feature_id | id of feature |
op | binary operator to use in the test |
threshold | threshold value |
default_left | default direction for missing values |
left_child_key | unique integer key to identify the left child node |
right_child_key | unique integer key to identify the right child node |
Definition at line 150 of file builder.cc.
bool SetRootNode | ( | int | node_key | ) |
Set a node as the root of a tree.
node_key | unique integer key to identify the root node |
Definition at line 135 of file builder.cc.