7 #ifndef TREELITE_FRONTEND_H_ 8 #define TREELITE_FRONTEND_H_ 61 const char* name_obj);
66 struct TreeBuilderImpl;
67 struct ModelBuilderImpl;
114 int left_child_key,
int right_child_key);
131 const std::vector<uint32_t>& left_categories,
132 bool default_left,
int left_child_key,
133 int right_child_key);
152 const std::vector<tl_float>& leaf_vector);
155 std::unique_ptr<TreeBuilderImpl> pimpl;
174 ModelBuilder(
int num_feature,
int num_output_group,
bool random_forest_flag);
181 void SetModelParam(
const char* name,
const char* value);
194 int InsertTree(
TreeBuilder* tree_builder,
int index = -1);
207 bool DeleteTree(
int index);
214 bool CommitModel(
Model* out_model);
217 std::unique_ptr<ModelBuilderImpl> pimpl;
222 #endif // TREELITE_FRONTEND_H_ thin wrapper for tree ensemble model
float tl_float
float type to be used internally
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.
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.
void ExportXGBoostModel(const char *filename, const Model &model, const char *name_obj)
export a model in XGBoost format. The exported model can be read by XGBoost (dmlc/xgboost).
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