treelite
Public Member Functions | List of all members
ModelBuilder Class Reference

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...
 
TreeBuilderGetTree (int index)
 Get a reference to a tree in the ensemble. More...
 
const TreeBuilderGetTree (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...
 

Detailed Description

model builder class

Definition at line 160 of file frontend.h.

Constructor & Destructor Documentation

ModelBuilder ( int  num_feature,
int  num_output_group,
bool  random_forest_flag 
)

Constructor.

Parameters
num_featurenumber of features used in model being built. We assume that all feature indices are between 0 and (num_feature - 1).
num_output_groupnumber of output groups. Set to 1 for binary classification and regression; >1 for multiclass classification
random_forest_flagwhether the model is a random forest (true) or gradient boosted trees (false)

Definition at line 253 of file builder.cc.

Member Function Documentation

bool CommitModel ( Model out_model)

finalize the model and produce the in-memory representation

Parameters
out_modelplace to store in-memory representation of the finished model
Returns
whether successful

Definition at line 338 of file builder.cc.

bool DeleteTree ( int  index)

Remove a tree from the ensemble.

Parameters
indexindex of the tree that would be removed
Returns
whether successful

Definition at line 329 of file builder.cc.

TreeBuilder & GetTree ( int  index)

Get a reference to a tree in the ensemble.

Parameters
indexindex of the tree in the ensemble
Returns
reference to the tree

Definition at line 319 of file builder.cc.

int InsertTree ( TreeBuilder tree_builder,
int  index = -1 
)

Insert a tree at specified location.

Parameters
tree_builderbuilder 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.
indexindex of the element before which to insert the tree; use -1 to insert at the end
Returns
index of the new tree within the ensemble; -1 for failure

Definition at line 266 of file builder.cc.

void SetModelParam ( const char *  name,
const char *  value 
)

Set a model parameter.

Parameters
namename of parameter
valuevalue of parameter

Definition at line 261 of file builder.cc.


The documentation for this class was generated from the following files: