treelite
Functions
C API: Model loaders for XGBoost and LightGBM

Functions

int TreeliteLoadXGBoostModelLegacyBinary (char const *filename, char const *config_json, TreeliteModelHandle *out)
 Load a model file generated by XGBoost (dmlc/xgboost), stored in the legacy binary format. More...
 
int TreeliteLoadXGBoostModelLegacyBinaryFromMemoryBuffer (void const *buf, size_t len, char const *config_json, TreeliteModelHandle *out)
 Load an XGBoost model from a memory buffer using the legacy binary format. More...
 
int TreeliteLoadXGBoostModel (char const *filename, char const *config_json, TreeliteModelHandle *out)
 Load a model file generated by XGBoost (dmlc/xgboost), stored in the JSON format. More...
 
int TreeliteLoadXGBoostModelFromString (char const *json_str, size_t length, char const *config_json, TreeliteModelHandle *out)
 Load an XGBoost model from a JSON string. More...
 
int TreeliteLoadLightGBMModel (char const *filename, char const *config_json, TreeliteModelHandle *out)
 Load a model file generated by LightGBM (Microsoft/LightGBM). The model file must contain a decision tree ensemble. More...
 
int TreeliteLoadLightGBMModelFromString (char const *model_str, char const *config_json, TreeliteModelHandle *out)
 Load a LightGBM model from a string. The string should be created with the model_to_string() method in LightGBM. More...
 

Detailed Description

Function Documentation

◆ TreeliteLoadLightGBMModel()

int TreeliteLoadLightGBMModel ( char const *  filename,
char const *  config_json,
TreeliteModelHandle out 
)

Load a model file generated by LightGBM (Microsoft/LightGBM). The model file must contain a decision tree ensemble.

Parameters
filenameName of model file
config_jsonNull-terminated JSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure

◆ TreeliteLoadLightGBMModelFromString()

int TreeliteLoadLightGBMModelFromString ( char const *  model_str,
char const *  config_json,
TreeliteModelHandle out 
)

Load a LightGBM model from a string. The string should be created with the model_to_string() method in LightGBM.

Parameters
model_strModel string
config_jsonNull-terminated JSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure

◆ TreeliteLoadXGBoostModel()

int TreeliteLoadXGBoostModel ( char const *  filename,
char const *  config_json,
TreeliteModelHandle out 
)

Load a model file generated by XGBoost (dmlc/xgboost), stored in the JSON format.

Parameters
filenameName of model file
config_jsonNull-terminated JSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure

◆ TreeliteLoadXGBoostModelFromString()

int TreeliteLoadXGBoostModelFromString ( char const *  json_str,
size_t  length,
char const *  config_json,
TreeliteModelHandle out 
)

Load an XGBoost model from a JSON string.

Parameters
json_strJSON string containing the XGBoost model
lengthLength of the JSON string
config_jsonNull-terminated JSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure

◆ TreeliteLoadXGBoostModelLegacyBinary()

int TreeliteLoadXGBoostModelLegacyBinary ( char const *  filename,
char const *  config_json,
TreeliteModelHandle out 
)

Load a model file generated by XGBoost (dmlc/xgboost), stored in the legacy binary format.

Parameters
filenameName of model file
config_jsonJSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure

◆ TreeliteLoadXGBoostModelLegacyBinaryFromMemoryBuffer()

int TreeliteLoadXGBoostModelLegacyBinaryFromMemoryBuffer ( void const *  buf,
size_t  len,
char const *  config_json,
TreeliteModelHandle out 
)

Load an XGBoost model from a memory buffer using the legacy binary format.

Parameters
bufMemory buffer
lenSize of memory buffer
config_jsonNull-terminated JSON string consisting key-value pairs; used for configuring the model parser
outLoaded model
Returns
0 for success, -1 for failure