Treelite
|
predictor class: wrapper for optimized prediction code More...
#include <predictor.h>
Public Types | |
typedef void * | ThreadPoolHandle |
opaque handle types | |
Public Member Functions | |
Predictor (int num_worker_thread=-1) | |
void | Load (const char *libpath) |
load the prediction function from dynamic shared library. More... | |
void | Free () |
unload the prediction function | |
size_t | PredictBatch (const DMatrix *dmat, int verbose, bool pred_margin, PredictorOutputHandle out_result) const |
Make predictions on a batch of data rows (synchronously). This function internally divides the workload among all worker threads. More... | |
size_t | QueryResultSize (const DMatrix *dmat) 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 DMatrix *dmat, 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 | QueryNumClass () const |
Get the number of classes in the loaded model The number is 1 for most tasks; it is greater than 1 for multiclass classification. 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... | |
TypeInfo | QueryThresholdType () const |
Get the type of the split thresholds. More... | |
TypeInfo | QueryLeafOutputType () const |
Get the type of the leaf outputs. More... | |
PredictorOutputHandle | CreateOutputVector (const DMatrix *dmat) const |
Create an output vector suitable to hold prediction result for a given data matrix. More... | |
void | DeleteOutputVector (PredictorOutputHandle output_vector) const |
Free an output vector from memory. More... | |
predictor class: wrapper for optimized prediction code
Definition at line 78 of file predictor.h.
PredictorOutputHandle CreateOutputVector | ( | const DMatrix * | dmat | ) | const |
Create an output vector suitable to hold prediction result for a given data matrix.
dmat | a data matrix |
Definition at line 460 of file predictor.cc.
void DeleteOutputVector | ( | PredictorOutputHandle | output_vector | ) | const |
Free an output vector from memory.
output_vector | Opaque handle to the output vector |
Definition at line 466 of file predictor.cc.
void Load | ( | const char * | libpath | ) |
load the prediction function from dynamic shared library.
libpath | path of dynamic shared library (.so/.dll/.dylib). |
Definition at line 299 of file predictor.cc.
size_t PredictBatch | ( | const DMatrix * | dmat, |
int | verbose, | ||
bool | pred_margin, | ||
PredictorOutputHandle | out_result | ||
) | const |
Make predictions on a batch of data rows (synchronously). This function internally divides the workload among all worker threads.
dmat | 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. This pointer must point to an array of length QueryResultSize() and of type QueryLeafOutputType(). |
Definition at line 412 of file predictor.cc.
|
inline |
Get global bias which adjusting predicted margin scores.
Definition at line 166 of file predictor.h.
|
inline |
Get the type of the leaf outputs.
Definition at line 180 of file predictor.h.
|
inline |
Get the number of classes in the loaded model The number is 1 for most tasks; it is greater than 1 for multiclass classification.
Definition at line 137 of file predictor.h.
|
inline |
Get the width (number of features) of each instance used to train the loaded model.
Definition at line 145 of file predictor.h.
|
inline |
Get name of post prediction transformation used to train the loaded model.
Definition at line 152 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
dmat | a batch of rows |
Definition at line 114 of file predictor.h.
|
inline |
Given a batch of data rows, query the necessary size of array to hold predictions for all data points.
dmat | a batch of rows |
rbegin | beginning of range of rows |
rend | end of range of rows |
Definition at line 126 of file predictor.h.
|
inline |
Get alpha value in sigmoid transformation used to train the loaded model.
Definition at line 159 of file predictor.h.
|
inline |
Get the type of the split thresholds.
Definition at line 173 of file predictor.h.