Treelite
Typedefs | Functions
c_api_runtime.h File Reference

C API of Treelite, used for interfacing with other languages This header is used exclusively by the runtime. More...

#include "c_api_common.h"
Include dependency graph for c_api_runtime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void * PredictorHandle
 handle to predictor class
 
typedef void * PredictorOutputHandle
 handle to output from predictor
 

Functions

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 compiled into a dynamic shared library object (.so/.dll/.dylib). More...
 
int TreelitePredictorPredictBatch (PredictorHandle handle, DMatrixHandle batch, int verbose, int pred_margin, PredictorOutputHandle out_result, size_t *out_result_size)
 Make predictions on a batch of data rows (synchronously). This function internally divides the workload among all worker threads. More...
 
int TreeliteCreatePredictorOutputVector (PredictorHandle handle, DMatrixHandle batch, PredictorOutputHandle *out_output_vector)
 Convenience function to allocate an output vector that is able to hold the prediction result for a given data matrix. The vector's length will be identical to TreelitePredictorQueryResultSize() and its type will be identical to TreelitePredictorQueryLeafOutputType(). To prevent memory leak, make sure to de-allocate the vector with TreeliteDeletePredictorOutputVector(). More...
 
int TreeliteDeletePredictorOutputVector (PredictorHandle handle, PredictorOutputHandle output_vector)
 De-allocate an output vector. More...
 
int TreelitePredictorQueryResultSize (PredictorHandle handle, DMatrixHandle batch, size_t *out)
 Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More...
 
int TreelitePredictorQueryNumClass (PredictorHandle handle, size_t *out)
 Get the number classes in the loaded model The number is 1 for most tasks; it is greater than 1 for multiclass classification. More...
 
int TreelitePredictorQueryNumFeature (PredictorHandle handle, size_t *out)
 Get the width (number of features) of each instance used to train the loaded model. More...
 
int TreelitePredictorQueryPredTransform (PredictorHandle handle, const char **out)
 Get name of post prediction transformation used to train the loaded model. More...
 
int TreelitePredictorQuerySigmoidAlpha (PredictorHandle handle, float *out)
 Get alpha value of sigmoid transformation used to train the loaded model. More...
 
int TreelitePredictorQueryRatioC (PredictorHandle handle, float *out)
 Get c value of exponential standard ratio transformation used to train the loaded model. More...
 
int TreelitePredictorQueryGlobalBias (PredictorHandle handle, float *out)
 Get global bias which adjusting predicted margin scores. More...
 
int TreelitePredictorQueryThresholdType (PredictorHandle handle, const char **out)
 
int TreelitePredictorQueryLeafOutputType (PredictorHandle handle, const char **out)
 
int TreelitePredictorFree (PredictorHandle handle)
 delete predictor from memory More...
 

Detailed Description

C API of Treelite, used for interfacing with other languages This header is used exclusively by the runtime.

Copyright (c) 2017-2020 by Contributors

Author
Hyunsu Cho

Definition in file c_api_runtime.h.