treelite
|
model builder class More...
#include <frontend.h>
Public Member Functions | |
ModelBuilder (int num_feature, int num_output_group, bool random_forest_flag) | |
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 |
bool | DeleteTree (int index) |
Remove a tree from the ensemble. More... | |
bool | CommitModel (Model *out_model) |
finalize the model and produce the in-memory representation More... | |
model builder class
Definition at line 152 of file frontend.h.
ModelBuilder | ( | int | num_feature, |
int | num_output_group, | ||
bool | random_forest_flag | ||
) |
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_output_group | number of output groups. Set to 1 for binary classification and regression; >1 for multiclass classification |
random_forest_flag | whether the model is a random forest (true) or gradient boosted trees (false) |
Definition at line 255 of file builder.cc.
bool CommitModel | ( | Model * | out_model | ) |
finalize the model and produce the in-memory representation
out_model | place to store in-memory representation of the finished model |
Definition at line 340 of file builder.cc.
bool DeleteTree | ( | int | index | ) |
Remove a tree from the ensemble.
index | index of the tree that would be removed |
Definition at line 331 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 321 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 268 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 263 of file builder.cc.