7 #ifndef TREELITE_FRONTEND_H_ 8 #define TREELITE_FRONTEND_H_ 65 struct TreeBuilderImpl;
66 struct ModelBuilderImpl;
108 const char* op,
tl_float threshold,
bool default_left,
109 int left_child_key,
int right_child_key);
112 int left_child_key,
int right_child_key);
128 const std::vector<uint32_t>& left_categories,
129 bool default_left,
int left_child_key,
130 int right_child_key);
147 const std::vector<tl_float>& leaf_vector);
150 std::unique_ptr<TreeBuilderImpl> pimpl;
169 ModelBuilder(
int num_feature,
int num_output_group,
bool random_forest_flag);
176 void SetModelParam(
const char* name,
const char* value);
189 int InsertTree(
TreeBuilder* tree_builder,
int index = -1);
201 void DeleteTree(
int index);
206 void CommitModel(
Model* out_model);
209 std::unique_ptr<ModelBuilderImpl> pimpl;
214 #endif // TREELITE_FRONTEND_H_ void ExportProtobufModel(const char *filename, const Model &model)
export a model in Protocol Buffers format. Protocol Buffers (google/protobuf) is a language- and plat...
void LoadProtobufModel(const char *filename, Model *out)
load a model in Protocol Buffers format. Protocol Buffers (google/protobuf) is a language- and platfo...
thin wrapper for tree ensemble model
float tl_float
float type to be used internally
void DeleteNode(int node_key)
Remove a node from a tree.
void SetRootNode(int node_key)
Set a node as the root of a tree.
void SetNumericalTestNode(int node_key, unsigned feature_id, const char *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]...
void 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 classifi...
void LoadXGBoostModel(const char *filename, Model *out)
load a model file generated by XGBoost (dmlc/xgboost). The model file must contain a decision tree en...
void LoadLightGBMModel(const char *filename, Model *out)
load a model file generated by LightGBM (Microsoft/LightGBM). The model file must contain a decision ...
defines configuration macros of Treelite
void SetLeafNode(int node_key, tl_float leaf_value)
Turn an empty node into a leaf node.
void CreateNode(int node_key)
Create an empty node within a tree.
void 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 l...
Operator
comparison operators