Public Member Functions | Protected Attributes

CVowpalWabbit Class Reference

Detailed Description

Class CVowpalWabbit is the implementation of the online learning algorithm used in Vowpal Wabbit.

VW is a fast online learning algorithm which operates on sparse features. It uses an online gradient descent technique.

For more details, refer to the tutorial at

Definition at line 38 of file VowpalWabbit.h.

Inheritance diagram for CVowpalWabbit:
Inheritance graph

List of all members.

Public Member Functions

 CVowpalWabbit ()
 CVowpalWabbit (CStreamingVwFeatures *feat)
 ~CVowpalWabbit ()
void reinitialize_weights ()
void set_no_training (bool dont_train)
void set_adaptive (bool adaptive_learning)
void set_exact_adaptive_norm (bool exact_adaptive)
void set_num_passes (int32_t passes)
void load_regressor (char *file_name)
void set_regressor_out (char *file_name, bool is_text=true)
void set_prediction_out (char *file_name)
void add_quadratic_pair (char *pair)
virtual bool train_machine (CFeatures *feat=NULL)
virtual float32_t predict_and_finalize (VwExample *ex)
float32_t compute_exact_norm (VwExample *&ex, float32_t &sum_abs_x)
float32_t compute_exact_norm_quad (float32_t *weights, VwFeature &page_feature, v_array< VwFeature > &offer_features, vw_size_t mask, float32_t g, float32_t &sum_abs_x)
virtual CVwEnvironmentget_env ()
virtual const char * get_name () const

Protected Attributes

 Environment for VW, i.e., globals.
 Learner to use.

Constructor & Destructor Documentation

CVowpalWabbit (  ) 

Default constructor

Definition at line 20 of file VowpalWabbit.cpp.

Constructor, taking a features object as argument

feat StreamingVwFeatures object

Definition at line 28 of file VowpalWabbit.cpp.

~CVowpalWabbit (  ) 


Definition at line 36 of file VowpalWabbit.cpp.

Member Function Documentation

void add_quadratic_pair ( char *  pair  ) 

Add a pair of namespaces whose features should be crossed for quadratic updates

pair a string with the two namespace names concatenated

Definition at line 101 of file VowpalWabbit.cpp.

float32_t compute_exact_norm ( VwExample *&  ex,
float32_t sum_abs_x 

Computes the exact norm during adaptive learning

ex example
sum_abs_x set by reference, sum of abs of features

Definition at line 382 of file VowpalWabbit.cpp.

float32_t compute_exact_norm_quad ( float32_t weights,
VwFeature page_feature,
v_array< VwFeature > &  offer_features,
vw_size_t  mask,
float32_t  g,
float32_t sum_abs_x 

Computes the exact norm for quadratic features during adaptive learning

weights weights
page_feature current feature
offer_features paired features
mask mask
g square of gradient
sum_abs_x sum of absolute value of features

Definition at line 419 of file VowpalWabbit.cpp.

virtual CVwEnvironment* get_env (  )  [virtual]

Get the environment

environment as CVwEnvironment*

Definition at line 176 of file VowpalWabbit.h.

virtual const char* get_name ( void   )  const [virtual]

Return the name of the object


Reimplemented from COnlineLinearMachine.

Definition at line 187 of file VowpalWabbit.h.

void load_regressor ( char *  file_name  ) 

Load regressor from a dump file

file_name name of regressor file

Definition at line 80 of file VowpalWabbit.cpp.

float32_t predict_and_finalize ( VwExample ex  )  [virtual]

Predict for an example

ex VwExample to predict for

Definition at line 178 of file VowpalWabbit.cpp.

void reinitialize_weights (  ) 

Reinitialize the weight vectors. Call after updating env variables eg. stride.

Definition at line 43 of file VowpalWabbit.cpp.

void set_adaptive ( bool  adaptive_learning  ) 

Set whether learning is adaptive or not

adaptive_learning true if adaptive

Definition at line 56 of file VowpalWabbit.cpp.

void set_exact_adaptive_norm ( bool  exact_adaptive  ) 

Set whether to use the more expensive exact norm for adaptive learning

exact_adaptive true if exact norm is required

Definition at line 69 of file VowpalWabbit.cpp.

void set_no_training ( bool  dont_train  ) 

Set whether one desires to not train and only make passes over all examples instead.

This is useful if one wants to create a cache file from data.

dont_train true if one doesn't want to train

Definition at line 73 of file VowpalWabbit.h.

void set_num_passes ( int32_t  passes  ) 

Set number of passes (only works for cached input)

passes number of passes

Definition at line 95 of file VowpalWabbit.h.

void set_prediction_out ( char *  file_name  ) 

Set file name of prediction output

file_name name of file to save predictions to

Definition at line 93 of file VowpalWabbit.cpp.

void set_regressor_out ( char *  file_name,
bool  is_text = true 

Set regressor output parameters

file_name name of file to save regressor to
is_text human readable or not, bool

Definition at line 87 of file VowpalWabbit.cpp.

bool train_machine ( CFeatures feat = NULL  )  [virtual]

Train on a StreamingVwFeatures object

feat StreamingVwFeatures to train using

Reimplemented from CMachine.

Definition at line 106 of file VowpalWabbit.cpp.

Member Data Documentation

CVwEnvironment* env [protected]

Environment for VW, i.e., globals.

Definition at line 266 of file VowpalWabbit.h.


Reimplemented from COnlineLinearMachine.

Definition at line 263 of file VowpalWabbit.h.

CVwLearner* learner [protected]

Learner to use.

Definition at line 269 of file VowpalWabbit.h.

CVwRegressor* reg [protected]


Definition at line 272 of file VowpalWabbit.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation