Go to the documentation of this file.
9 /* Note: Make sure to use slash-asterisk form of comments in this file
10  (like this one). Do not use double-slash (//). */
15 #include "c_api_common.h"
16 #include "entry.h"
24 typedef void* PredictorHandle;
26 typedef void* CSRBatchHandle;
28 typedef void* DenseBatchHandle;
46 TREELITE_DLL int TreeliteAssembleSparseBatch(const float* data,
47  const uint32_t* col_ind,
48  const size_t* row_ptr,
49  size_t num_row, size_t num_col,
50  CSRBatchHandle* out);
56 TREELITE_DLL int TreeliteDeleteSparseBatch(CSRBatchHandle handle);
66 TREELITE_DLL int TreeliteAssembleDenseBatch(const float* data,
67  float missing_value,
68  size_t num_row, size_t num_col,
69  DenseBatchHandle* out);
75 TREELITE_DLL int TreeliteDeleteDenseBatch(DenseBatchHandle handle);
85 TREELITE_DLL int TreeliteBatchGetDimension(void* handle,
86  int batch_sparse,
87  size_t* out_num_row,
88  size_t* out_num_col);
99 TREELITE_DLL int TreelitePredictorLoad(const char* library_path,
100  int num_worker_thread,
101  PredictorHandle* out);
119 TREELITE_DLL int TreelitePredictorPredictBatch(PredictorHandle handle,
120  void* batch,
121  int batch_sparse,
122  int verbose,
123  int pred_margin,
124  float* out_result,
125  size_t* out_result_size);
140 TREELITE_DLL int TreelitePredictorPredictInst(PredictorHandle handle,
141  union TreelitePredictorEntry* inst,
142  int pred_margin, float* out_result,
143  size_t* out_result_size);
154 TREELITE_DLL int TreelitePredictorQueryResultSize(PredictorHandle handle,
155  void* batch,
156  int batch_sparse,
157  size_t* out);
166  PredictorHandle handle,
167  size_t* out);
177  size_t* out);
185 TREELITE_DLL int TreelitePredictorQueryNumFeature(PredictorHandle handle,
186  size_t* out);
192 TREELITE_DLL int TreelitePredictorFree(PredictorHandle handle);
void * DenseBatchHandle
handle to batch of dense data rows
Definition: c_api_runtime.h:28
void * CSRBatchHandle
handle to batch of sparse data rows
Definition: c_api_runtime.h:26
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...
int TreelitePredictorQueryResultSizeSingleInst(PredictorHandle handle, size_t *out)
Query the necessary size of array to hold the prediction for a single data row.
int TreelitePredictorPredictBatch(PredictorHandle handle, void *batch, int batch_sparse, int verbose, int pred_margin, float *out_result, size_t *out_result_size)
Make predictions on a batch of data rows (synchronously). This function internally divides the worklo...
int TreelitePredictorQueryNumFeature(PredictorHandle handle, size_t *out)
Get the width (number of features) of each instance used to train the loaded model.
int TreeliteBatchGetDimension(void *handle, int batch_sparse, size_t *out_num_row, size_t *out_num_col)
get dimensions of a batch
int TreelitePredictorLoad(const char *library_path, int num_worker_thread, PredictorHandle *out)
load prediction code into memory. This function assumes that the prediction code has been already com...
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
int TreeliteDeleteDenseBatch(DenseBatchHandle handle)
delete a dense batch from memory
int TreeliteDeleteSparseBatch(CSRBatchHandle handle)
delete a sparse batch from memory
int TreeliteAssembleDenseBatch(const float *data, float missing_value, size_t num_row, size_t num_col, DenseBatchHandle *out)
assemble a dense batch
data layout. The value -1 signifies the missing value. When the "missing" field is set to -1...
Definition: entry.h:11
void * PredictorHandle
handle to predictor class
Definition: c_api_runtime.h:24
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 tha...
int TreelitePredictorFree(PredictorHandle handle)
delete predictor from memory
int TreelitePredictorPredictInst(PredictorHandle handle, union TreelitePredictorEntry *inst, int pred_margin, float *out_result, size_t *out_result_size)
Make predictions on a single data row (synchronously). The work will be scheduled to the calling thre...