Vowpal Wabbit
|
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) |
Private Attributes | |
std::unique_ptr< W > | _weights |
std::string | _id |
std::string | _version |
std::string | _command_line_arguments |
std::vector< std::string > | _interactions |
std::array< bool, NUM_NAMESPACES > | _ignore_linear |
bool | _no_constant |
vw_predict_exploration | _exploration |
float | _minimum_epsilon |
float | _epsilon |
float | _lambda |
int | _bag_size |
uint32_t | _num_bits |
uint32_t | _stride_shift |
bool | _model_loaded |
Vowpal Wabbit slim predictor. Supports: regression, multi-class classification and contextual bandits.
Definition at line 218 of file vw_slim_predict.h.
|
inline |
Definition at line 239 of file vw_slim_predict.h.
|
inline |
|
inline |
True if the model describes a contextual bandit (cb) model using action dependent features (afd)
Definition at line 385 of file vw_slim_predict.h.
Referenced by run_predict_in_memory(), and TEST_P().
|
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.
Definition at line 394 of file vw_slim_predict.h.
|
inline |
Reads the Vowpal Wabbit model from the supplied buffer (produced using vw -f <modelname>)
model | The binary model. |
length | The length of the binary model. |
Definition at line 248 of file vw_slim_predict.h.
References vw_slim::bag, vw_slim::ceil_log_2(), vw_slim::model_parser::checksum(), E_VW_PREDICT_ERR_CB_EXPLORATION_MISSING, E_VW_PREDICT_ERR_GD_RESUME_NOT_SUPPORTED, E_VW_PREDICT_ERR_HASH_SEED_NOT_SUPPORTED, E_VW_PREDICT_ERR_INVALID_MODEL, E_VW_PREDICT_ERR_INVALID_MODEL_CHECK_SUM, vw_slim::epsilon_greedy, vw_slim::find_opt(), vw_slim::find_opt_float(), vw_slim::find_opt_int(), VW::num_weights(), vw_slim::model_parser::read(), vw_slim::model_parser::read_string(), vw_slim::model_parser::read_weights(), RETURN_ON_FAIL, S_VW_PREDICT_OK, vw_slim::model_parser::skip(), and vw_slim::softmax.
Referenced by cb_data_epsilon_0_skype_jb_test_runner(), run_predict_in_memory(), TEST(), TEST_P(), and TYPED_TEST_P().
|
inline |
Predicts a score (as in regression) for the provided example.
Regular regression with support for constant feature (bias term) and interactions
ex | The example to get the prediction for. |
score | The output score produced by the model. |
Definition at line 405 of file vw_slim_predict.h.
References constant, constant_namespace, E_VW_PREDICT_ERR_NO_MODEL_LOADED, f, example_predict::ft_offset, and S_VW_PREDICT_OK.
Referenced by cb_data_epsilon_0_skype_jb_test_runner(), run_predict_in_memory(), TEST(), TEST_P(), and TYPED_TEST_P().
|
inline |
Definition at line 425 of file vw_slim_predict.h.
References E_VW_PREDICT_ERR_NO_A_CSOAA_MODEL, E_VW_PREDICT_ERR_NO_MODEL_LOADED, example_predict::feature_space, example_predict::indices, predict(), RETURN_ON_FAIL, and S_VW_PREDICT_OK.
|
inline |
Definition at line 459 of file vw_slim_predict.h.
References vw_slim::bag, E_VW_PREDICT_ERR_NO_MODEL_LOADED, E_VW_PREDICT_ERR_NOT_A_CB_MODEL, exploration::enforce_minimum_probability(), vw_slim::epsilon_greedy, exploration::generate_bag(), exploration::generate_epsilon_greedy(), exploration::generate_softmax(), predict(), RETURN_EXPLORATION_ON_FAIL, RETURN_ON_FAIL, S_VW_PREDICT_OK, exploration::sample_after_normalizing(), and vw_slim::softmax.
|
inlinestatic |
Definition at line 561 of file vw_slim_predict.h.
References E_EXPLORATION_PDF_RANKING_SIZE_MISMATCH, and S_EXPLORATION_OK.
|
private |
Definition at line 232 of file vw_slim_predict.h.
|
private |
Definition at line 223 of file vw_slim_predict.h.
|
private |
Definition at line 230 of file vw_slim_predict.h.
|
private |
Definition at line 228 of file vw_slim_predict.h.
|
private |
Definition at line 221 of file vw_slim_predict.h.
|
private |
Definition at line 225 of file vw_slim_predict.h.
|
private |
Definition at line 224 of file vw_slim_predict.h.
|
private |
Definition at line 231 of file vw_slim_predict.h.
|
private |
Definition at line 229 of file vw_slim_predict.h.
|
private |
Definition at line 236 of file vw_slim_predict.h.
|
private |
Definition at line 226 of file vw_slim_predict.h.
|
private |
Definition at line 233 of file vw_slim_predict.h.
|
private |
Definition at line 235 of file vw_slim_predict.h.
|
private |
Definition at line 222 of file vw_slim_predict.h.
|
private |
Definition at line 220 of file vw_slim_predict.h.