Treelite
|
model builder class More...
#include <frontend.h>
Public Member Functions | |
ModelBuilder (int num_feature, int num_class, bool average_tree_output, TypeInfo threshold_type, TypeInfo leaf_output_type) | |
Constructor. More... | |
void | SetModelParam (const char *name, const char *value) |
Set a model parameter. More... | |
int | InsertTree (TreeBuilder *tree_builder, int index=-1) |
Insert a tree at specified location. More... | |
TreeBuilder * | GetTree (int index) |
Get a reference to a tree in the ensemble. More... | |
const TreeBuilder * | GetTree (int index) const |
void | DeleteTree (int index) |
Remove a tree from the ensemble. More... | |
std::unique_ptr< Model > | CommitModel () |
finalize the model and produce the in-memory representation More... | |
model builder class
Definition at line 185 of file frontend.h.
ModelBuilder | ( | int | num_feature, |
int | num_class, | ||
bool | average_tree_output, | ||
TypeInfo | threshold_type, | ||
TypeInfo | leaf_output_type | ||
) |
Constructor.
num_feature | number of features used in model being built. We assume that all feature indices are between 0 and (num_feature - 1). |
num_class | number of output groups. Set to 1 for binary classification and regression; >1 for multiclass classification |
average_tree_output | whether the model is a random forest (true) or gradient boosted trees (false) |
threshold_type | Type of thresholds in numerical splits. All thresholds in a given model must have the same type. |
leaf_output_type | Type of leaf outputs. All leaf outputs in a given model must have the same type. |
Definition at line 330 of file builder.cc.
std::unique_ptr< Model > CommitModel | ( | ) |
finalize the model and produce the in-memory representation
Definition at line 418 of file builder.cc.
void DeleteTree | ( | int | index | ) |
Remove a tree from the ensemble.
index | index of the tree that would be removed |
Definition at line 411 of file builder.cc.
TreeBuilder * GetTree | ( | int | index | ) |
Get a reference to a tree in the ensemble.
index | index of the tree in the ensemble |
Definition at line 401 of file builder.cc.
int InsertTree | ( | TreeBuilder * | tree_builder, |
int | index = -1 |
||
) |
Insert a tree at specified location.
tree_builder | builder for the tree to be inserted. The tree must not be part of any other existing tree ensemble. Note: The tree_builder argument will become unusuable after the tree insertion. Should you want to modify the tree afterwards, use GetTree(*) method to get a fresh handle to the tree. |
index | index of the element before which to insert the tree; use -1 to insert at the end |
Definition at line 342 of file builder.cc.
void SetModelParam | ( | const char * | name, |
const char * | value | ||
) |
Set a model parameter.
name | name of parameter |
value | value of parameter |
Definition at line 337 of file builder.cc.