treelite
|
predictor class: wrapper for optimized prediction code More...
#include <predictor.h>
Public Types | |
typedef void * | QueryFuncHandle |
opaque handle types | |
typedef void * | PredFuncHandle |
typedef void * | LibraryHandle |
typedef void * | ThreadPoolHandle |
Public Member Functions | |
Predictor (int num_worker_thread=-1) | |
void | Load (const char *name) |
load the prediction function from dynamic shared library. More... | |
void | Free () |
unload the prediction function | |
size_t | PredictBatch (const CSRBatch *batch, int verbose, bool pred_margin, float *out_result) |
Make predictions on a batch of data rows (synchronously). This function internally divides the workload among all worker threads. More... | |
size_t | PredictBatch (const DenseBatch *batch, int verbose, bool pred_margin, float *out_result) |
size_t | PredictInst (TreelitePredictorEntry *inst, bool pred_margin, float *out_result) |
Make predictions on a single data row (synchronously). The work will be scheduled to the calling thread. More... | |
size_t | QueryResultSize (const CSRBatch *batch) const |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More... | |
size_t | QueryResultSize (const DenseBatch *batch) const |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More... | |
size_t | QueryResultSize (const CSRBatch *batch, size_t rbegin, size_t rend) const |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More... | |
size_t | QueryResultSize (const DenseBatch *batch, size_t rbegin, size_t rend) const |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points. More... | |
size_t | QueryResultSizeSingleInst () const |
Query the necessary size of array to hold the prediction for a single data row. More... | |
size_t | QueryNumOutputGroup () const |
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... | |
size_t | QueryNumFeature () const |
Get the width (number of features) of each instance used to train the loaded model. More... | |
std::string | QueryPredTransform () const |
Get name of post prediction transformation used to train the loaded model. More... | |
float | QuerySigmoidAlpha () const |
Get alpha value in sigmoid transformation used to train the loaded model. More... | |
float | QueryGlobalBias () const |
Get global bias which adjusting predicted margin scores. More... | |
predictor class: wrapper for optimized prediction code
Definition at line 49 of file predictor.h.
void Load | ( | const char * | name | ) |
load the prediction function from dynamic shared library.
name | name of dynamic shared library (.so/.dll/.dylib). |
Definition at line 243 of file predictor.cc.
size_t PredictBatch | ( | const CSRBatch * | batch, |
int | verbose, | ||
bool | pred_margin, | ||
float * | out_result | ||
) |
Make predictions on a batch of data rows (synchronously). This function internally divides the workload among all worker threads.
batch | a batch of rows |
verbose | whether to produce extra messages |
pred_margin | whether to produce raw margin scores instead of transformed probabilities |
out_result | resulting output vector; use QueryResultSize() to allocate sufficient space |
Definition at line 477 of file predictor.cc.
size_t PredictInst | ( | TreelitePredictorEntry * | inst, |
bool | pred_margin, | ||
float * | out_result | ||
) |
Make predictions on a single data row (synchronously). The work will be scheduled to the calling thread.
inst | single data row |
pred_margin | whether to produce raw margin scores instead of transformed probabilities |
out_result | resulting output vector; use QueryResultSizeSingleInst() to allocate sufficient space |
Definition at line 489 of file predictor.cc.
|
inline |
Get global bias which adjusting predicted margin scores.
Definition at line 200 of file predictor.h.
|
inline |
Get the width (number of features) of each instance used to train the loaded model.
Definition at line 176 of file predictor.h.
|
inline |
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.
Definition at line 167 of file predictor.h.
|
inline |
Get name of post prediction transformation used to train the loaded model.
Definition at line 184 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
batch | a batch of rows |
Definition at line 105 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
batch | a batch of rows |
Definition at line 116 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
batch | a batch of rows |
rbegin | beginning of range of rows |
rend | end of range of rows |
Definition at line 129 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
batch | a batch of rows |
rbegin | beginning of range of rows |
rend | end of range of rows |
Definition at line 144 of file predictor.h.
|
inline |
Query the necessary size of array to hold the prediction for a single data row.
Definition at line 156 of file predictor.h.
|
inline |
Get alpha value in sigmoid transformation used to train the loaded model.
Definition at line 192 of file predictor.h.