Treelite
Functions
Gtil

Functions

int TreeliteGTILGetPredictOutputSize (ModelHandle model, size_t num_row, size_t *out)
 Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More...
 
int TreeliteGTILPredict (ModelHandle model, const float *input, size_t num_row, float *output, int nthread, int pred_transform, size_t *out_result_size)
 Predict with a 2D dense array. More...
 

Detailed Description

General Tree Inference Library (GTIL), providing a reference implementation for predicting with decision trees. GTIL is useful in cases it is infeasible to build the tree models as native shared libs.

Function Documentation

◆ TreeliteGTILGetPredictOutputSize()

int TreeliteGTILGetPredictOutputSize ( ModelHandle  model,
size_t  num_row,
size_t *  out 
)

Given a batch of data rows, query the necessary size of array to hold predictions for all data points.

Parameters
modelTreelite Model object
num_rowNumber of rows in the input
outSize of output buffer that should be allocated
Returns
0 for success; -1 for failure

Definition at line 258 of file c_api.cc.

◆ TreeliteGTILPredict()

int TreeliteGTILPredict ( ModelHandle  model,
const float *  input,
size_t  num_row,
float *  output,
int  nthread,
int  pred_transform,
size_t *  out_result_size 
)

Predict with a 2D dense array.

Parameters
modelTreelite Model object
inputThe 2D data array, laid out in row-major layout
num_rowNumber of rows in the data matrix.
outputPointer to buffer to store the output. Call TreeliteGTILGetPredictOutputSize() to get the amount of buffer you should allocate for this parameter.
nthreadnumber of CPU threads to use. Set <= 0 to use all CPU cores.
pred_transformAfter computing the prediction score, whether to transform it.
out_result_sizeSize of output. This could be smaller than TreeliteGTILGetPredictOutputSize() but could never be larger than TreeliteGTILGetPredictOutputSize().
Returns
0 for success; -1 for failure

Definition at line 265 of file c_api.cc.