treelite
Classes | Public Types | Public Member Functions | List of all members
Predictor Class Reference

predictor class: wrapper for optimized prediction code More...

#include <predictor.h>

Classes

union  Entry
 data layout. The value -1 signifies the missing value. When the "missing" field is set to -1, the "fvalue" field is set to NaN (Not a Number), so there is no danger for mistaking between missing values and non-missing values. More...
 

Public Types

typedef void * QueryFuncHandle
 opaque handle types
 
typedef void * PredFuncHandle
 
typedef void * PredTransformFuncHandle
 
typedef void * LibraryHandle
 

Public Member Functions

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 nthread, int verbose, bool pred_margin, float *out_result) const
 make predictions on a batch of data rows More...
 
size_t PredictBatch (const DenseBatch *batch, int nthread, int verbose, bool pred_margin, float *out_result) const
 
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
 
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...
 

Detailed Description

predictor class: wrapper for optimized prediction code

Definition at line 42 of file predictor.h.

Member Function Documentation

void Load ( const char *  name)

load the prediction function from dynamic shared library.

Parameters
namename of dynamic shared library (.so/.dll/.dylib).

Definition at line 186 of file predictor.cc.

size_t PredictBatch ( const CSRBatch batch,
int  nthread,
int  verbose,
bool  pred_margin,
float *  out_result 
) const

make predictions on a batch of data rows

Parameters
batcha batch of rows
nthreadnumber of threads to use for predicting
verbosewhether to produce extra messages
pred_marginwhether to produce raw margin scores instead of transformed probabilities
out_resultresulting output vector; use QueryResultSize() to allocate sufficient space
Returns
length of the output vector, which is guaranteed to be less than or equal to QueryResultSize()

Definition at line 239 of file predictor.cc.

size_t QueryNumOutputGroup ( ) const
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.

Returns
length of prediction array

Definition at line 111 of file predictor.h.

size_t QueryResultSize ( const CSRBatch batch) const
inline

Given a batch of data rows, query the necessary size of array to hold predictions for all data points.

Parameters
batcha batch of rows
Returns
length of prediction array

Definition at line 95 of file predictor.h.


The documentation for this class was generated from the following files: