7 #ifndef TREELITE_FRONTEND_H_ 8 #define TREELITE_FRONTEND_H_ 65 struct TreeBuilderImpl;
66 struct ModelBuilderImpl;
113 int left_child_key,
int right_child_key);
130 const std::vector<uint32_t>& left_categories,
131 bool default_left,
int left_child_key,
132 int right_child_key);
151 const std::vector<tl_float>& leaf_vector);
154 std::unique_ptr<TreeBuilderImpl> pimpl;
173 ModelBuilder(
int num_feature,
int num_output_group,
bool random_forest_flag);
180 void SetModelParam(
const char* name,
const char* value);
193 int InsertTree(
TreeBuilder* tree_builder,
int index = -1);
206 bool DeleteTree(
int index);
213 bool CommitModel(
Model* out_model);
216 std::unique_ptr<ModelBuilderImpl> pimpl;
221 #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...
thin wrapper for tree ensemble model
bool SetRootNode(int node_key)
Set a node as the root of a tree.
bool CreateNode(int node_key)
Create an empty node within a tree.
Model LoadLightGBMModel(const char *filename)
load a model file generated by LightGBM (Microsoft/LightGBM). The model file must contain a decision ...
Model LoadProtobufModel(const char *filename)
load a model in Protocol Buffers format. Protocol Buffers (google/protobuf) is a language- and platfo...
Model LoadXGBoostModel(const char *filename)
load a model file generated by XGBoost (dmlc/xgboost). The model file must contain a decision tree en...
bool SetLeafNode(int node_key, tl_float leaf_value)
Turn an empty node into a leaf node.
double tl_float
float type to be used internally
defines configuration macros of treelite
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 l...
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 classifi...
bool DeleteNode(int node_key)
Remove a node from a tree.
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]...
Operator
comparison operators