7 #ifndef TREELITE_FRONTEND_H_ 8 #define TREELITE_FRONTEND_H_ 45 std::unique_ptr<treelite::Model>
LoadXGBoostModel(
const void* buf,
size_t len);
66 struct TreeBuilderImpl;
67 struct ModelBuilderImpl;
72 std::shared_ptr<void> handle_;
82 static Value Create(T init_value);
88 template <
typename Func>
89 inline auto Dispatch(Func func);
90 template <
typename Func>
91 inline auto Dispatch(Func func)
const;
116 void CreateNode(
int node_key);
121 void DeleteNode(
int node_key);
126 void SetRootNode(
int node_key);
140 void SetNumericalTestNode(
int node_key,
unsigned feature_id,
const char* op,
Value threshold,
141 bool default_left,
int left_child_key,
int right_child_key);
142 void SetNumericalTestNode(
int node_key,
unsigned feature_id,
Operator op,
Value threshold,
143 bool default_left,
int left_child_key,
int right_child_key);
157 void SetCategoricalTestNode(
int node_key,
unsigned feature_id,
158 const std::vector<uint32_t>& left_categories,
bool default_left,
159 int left_child_key,
int right_child_key);
166 void SetLeafNode(
int node_key,
Value leaf_value);
175 void SetLeafVectorNode(
int node_key,
const std::vector<Value>& leaf_vector);
178 std::unique_ptr<TreeBuilderImpl> pimpl_;
202 ModelBuilder(
int num_feature,
int num_class,
bool average_tree_output,
210 void SetModelParam(
const char* name,
const char* value);
223 int InsertTree(
TreeBuilder* tree_builder,
int index = -1);
235 void DeleteTree(
int index);
240 std::unique_ptr<Model> CommitModel();
243 std::unique_ptr<ModelBuilderImpl> pimpl_;
251 #endif // TREELITE_FRONTEND_H_
Implementation for frontend.h.
std::unique_ptr< treelite::Model > LoadLightGBMModel(const char *filename)
load a model file generated by LightGBM (Microsoft/LightGBM). The model file must contain a decision ...
TypeInfo
Types used by thresholds and leaf outputs.
std::unique_ptr< treelite::Model > LoadXGBoostModel(const char *filename)
load a model file generated by XGBoost (dmlc/xgboost). The model file must contain a decision tree en...
defines configuration macros of Treelite
std::unique_ptr< treelite::Model > LoadXGBoostJSONModelString(const char *json_str, size_t length)
load an XGBoost model from a JSON string
std::unique_ptr< treelite::Model > LoadXGBoostJSONModel(const char *filename)
load a model file generated by XGBoost (dmlc/xgboost). The model file must contain a decision tree en...
Operator
comparison operators