Vowpal Wabbit
Public Member Functions | Static Public Member Functions | List of all members
vw_slim::vw_predict< W > Class Template Reference

Vowpal Wabbit slim predictor. Supports: regression, multi-class classification and contextual bandits. More...

#include <vw_slim_predict.h>

Public Member Functions

 vw_predict ()
 
int load (const char *model, size_t length)
 Reads the Vowpal Wabbit model from the supplied buffer (produced using vw -f <modelname>) More...
 
bool is_cb_explore_adf ()
 True if the model describes a contextual bandit (cb) model using action dependent features (afd) More...
 
bool is_csoaa_ldf ()
 True if the model describes a cost sensitive one-against-all (csoaa). This is also true for cb_explore_adf models, as they are reduced to csoaa. More...
 
int predict (example_predict &ex, float &score)
 Predicts a score (as in regression) for the provided example. More...
 
int predict (example_predict &shared, example_predict *actions, size_t num_actions, std::vector< float > &out_scores)
 
int predict (const char *event_id, example_predict &shared, example_predict *actions, size_t num_actions, std::vector< float > &pdf, std::vector< int > &ranking)
 
uint32_t feature_index_num_bits ()
 

Static Public Member Functions

template<typename PdfIt , typename InputScoreIt , typename OutputIt >
static int sort_by_scores (PdfIt pdf_first, PdfIt pdf_last, InputScoreIt scores_first, InputScoreIt scores_last, OutputIt ranking_begin, OutputIt ranking_last)
 

Detailed Description

template<typename W>
class vw_slim::vw_predict< W >

Vowpal Wabbit slim predictor. Supports: regression, multi-class classification and contextual bandits.

Constructor & Destructor Documentation

template<typename W >
vw_slim::vw_predict< W >::vw_predict ( )
inline

Member Function Documentation

template<typename W >
uint32_t vw_slim::vw_predict< W >::feature_index_num_bits ( )
inline
template<typename W >
bool vw_slim::vw_predict< W >::is_cb_explore_adf ( )
inline

True if the model describes a contextual bandit (cb) model using action dependent features (afd)

Returns
true True if contextual bandit predict method can be used.
false False if contextual bandit predict method cannot be used.
template<typename W >
bool vw_slim::vw_predict< W >::is_csoaa_ldf ( )
inline

True if the model describes a cost sensitive one-against-all (csoaa). This is also true for cb_explore_adf models, as they are reduced to csoaa.

Returns
true True if csoaa predict method can be used.
false False if csoaa predict method cannot be used.
template<typename W >
int vw_slim::vw_predict< W >::load ( const char *  model,
size_t  length 
)
inline

Reads the Vowpal Wabbit model from the supplied buffer (produced using vw -f <modelname>)

Parameters
modelThe binary model.
lengthThe length of the binary model.
Returns
int Returns 0 (S_VW_PREDICT_OK) if succesful, otherwise one of the error codes (see E_VW_PREDICT_ERR_*).
template<typename W >
int vw_slim::vw_predict< W >::predict ( example_predict ex,
float &  score 
)
inline

Predicts a score (as in regression) for the provided example.

Regular regression with support for constant feature (bias term) and interactions

Parameters
exThe example to get the prediction for.
scoreThe output score produced by the model.
Returns
int Returns 0 (S_VW_PREDICT_OK) if succesful, otherwise one of the error codes (see E_VW_PREDICT_ERR_*).
template<typename W >
int vw_slim::vw_predict< W >::predict ( example_predict shared,
example_predict actions,
size_t  num_actions,
std::vector< float > &  out_scores 
)
inline
template<typename W >
int vw_slim::vw_predict< W >::predict ( const char *  event_id,
example_predict shared,
example_predict actions,
size_t  num_actions,
std::vector< float > &  pdf,
std::vector< int > &  ranking 
)
inline
template<typename W >
template<typename PdfIt , typename InputScoreIt , typename OutputIt >
static int vw_slim::vw_predict< W >::sort_by_scores ( PdfIt  pdf_first,
PdfIt  pdf_last,
InputScoreIt  scores_first,
InputScoreIt  scores_last,
OutputIt  ranking_begin,
OutputIt  ranking_last 
)
inlinestatic

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