treelite
|
Functions | |
int | TreeliteAssembleSparseBatch (const float *data, const uint32_t *col_ind, const size_t *row_ptr, size_t num_row, size_t num_col, CSRBatchHandle *out) |
assemble a sparse batch More... | |
int | TreeliteDeleteSparseBatch (CSRBatchHandle handle) |
delete a sparse batch from memory More... | |
int | TreeliteAssembleDenseBatch (const float *data, float missing_value, size_t num_row, size_t num_col, DenseBatchHandle *out) |
assemble a dense batch More... | |
int | TreeliteDeleteDenseBatch (DenseBatchHandle handle) |
delete a dense batch from memory More... | |
int | TreeliteBatchGetDimension (void *handle, int batch_sparse, size_t *out_num_row, size_t *out_num_col) |
get dimensions of a batch More... | |
int | TreelitePredictorLoad (const char *library_path, PredictorHandle *out) |
load prediction code into memory. This function assumes that the prediction code has been already compiled into a dynamic shared library object (.so/.dll/.dylib). More... | |
int | TreelitePredictorPredictBatch (PredictorHandle handle, void *batch, int batch_sparse, int nthread, int verbose, int pred_margin, float *out_result, size_t *out_result_size) |
make predictions on a batch of data rows More... | |
int | TreelitePredictorQueryResultSize (PredictorHandle handle, void *batch, int batch_sparse, size_t *out) |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More... | |
int | TreelitePredictorQueryNumOutputGroup (PredictorHandle handle, size_t *out) |
Get the number of output groups in the loaded model The number is 1 for most tasks; it is greater than 1 for multiclass classifcation. More... | |
int | TreelitePredictorFree (PredictorHandle handle) |
delete predictor from memory More... | |
Predictor interface
int TreeliteAssembleDenseBatch | ( | const float * | data, |
float | missing_value, | ||
size_t | num_row, | ||
size_t | num_col, | ||
DenseBatchHandle * | out | ||
) |
assemble a dense batch
data | feature values |
missing_value | value to represent the missing value |
num_row | number of data rows in the batch |
num_col | number of columns (features) in the batch |
out | handle to sparse batch |
Definition at line 36 of file c_api_runtime.cc.
int TreeliteAssembleSparseBatch | ( | const float * | data, |
const uint32_t * | col_ind, | ||
const size_t * | row_ptr, | ||
size_t | num_row, | ||
size_t | num_col, | ||
CSRBatchHandle * | out | ||
) |
assemble a sparse batch
data | feature values |
col_ind | feature indices |
row_ptr | pointer to row headers |
num_row | number of data rows in the batch |
num_col | number of columns (features) in the batch |
out | handle to sparse batch |
Definition at line 14 of file c_api_runtime.cc.
int TreeliteBatchGetDimension | ( | void * | handle, |
int | batch_sparse, | ||
size_t * | out_num_row, | ||
size_t * | out_num_col | ||
) |
get dimensions of a batch
handle | a batch of rows (must be of type SparseBatch or DenseBatch) |
batch_sparse | whether the batch is sparse (true) or dense (false) |
out_num_row | used to set number of rows |
out_num_col | used to set number of columns |
Definition at line 55 of file c_api_runtime.cc.
int TreeliteDeleteDenseBatch | ( | DenseBatchHandle | handle | ) |
delete a dense batch from memory
handle | dense batch |
Definition at line 49 of file c_api_runtime.cc.
int TreeliteDeleteSparseBatch | ( | CSRBatchHandle | handle | ) |
delete a sparse batch from memory
handle | sparse batch |
Definition at line 30 of file c_api_runtime.cc.
int TreelitePredictorFree | ( | PredictorHandle | handle | ) |
delete predictor from memory
handle | predictor to remove |
Definition at line 126 of file c_api_runtime.cc.
int TreelitePredictorLoad | ( | const char * | library_path, |
PredictorHandle * | out | ||
) |
load prediction code into memory. This function assumes that the prediction code has been already compiled into a dynamic shared library object (.so/.dll/.dylib).
library_path | path to library object file containing prediction code |
out | handle to predictor |
Definition at line 72 of file c_api_runtime.cc.
int TreelitePredictorPredictBatch | ( | PredictorHandle | handle, |
void * | batch, | ||
int | batch_sparse, | ||
int | nthread, | ||
int | verbose, | ||
int | pred_margin, | ||
float * | out_result, | ||
size_t * | out_result_size | ||
) |
make predictions on a batch of data rows
handle | predictor |
batch | a batch of rows (must be of type SparseBatch or DenseBatch) |
batch_sparse | whether batch is sparse (1) or dense (0) |
nthread | number of threads to use |
verbose | whether to produce extra messages |
pred_margin | whether to produce raw margin scores instead of transformed probabilities |
out_result | resulting output vector; use TreelitePredictorQueryResultSize() to allocate sufficient space |
out_result_size | used to save length of the output vector, which is guaranteed to be less than or equal to TreelitePredictorQueryResultSize() |
Definition at line 81 of file c_api_runtime.cc.
int TreelitePredictorQueryNumOutputGroup | ( | PredictorHandle | handle, |
size_t * | out | ||
) |
Get the number of output groups in the loaded model The number is 1 for most tasks; it is greater than 1 for multiclass classifcation.
handle | predictor |
out | length of prediction array |
Definition at line 119 of file c_api_runtime.cc.
int TreelitePredictorQueryResultSize | ( | PredictorHandle | handle, |
void * | batch, | ||
int | batch_sparse, | ||
size_t * | out | ||
) |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
handle | predictor |
batch | a batch of rows (must be of type SparseBatch or DenseBatch) |
batch_sparse | whether batch is sparse (1) or dense (0) |
out | used to store the length of prediction array |
Definition at line 103 of file c_api_runtime.cc.