Class StreamingVwFile to read vector-by-vector from Vowpal Wabbit data files. It reads the example and label into one object of VwExample type.
Definition at line 26 of file StreamingVwFile.h.
Public Member Functions | |
CStreamingVwFile () | |
CStreamingVwFile (char *fname, char rw='r') | |
virtual | ~CStreamingVwFile () |
void | set_parser_type (E_VW_PARSER_TYPE type=T_VW) |
virtual void | get_vector (VwExample *&ex, int32_t &len) |
virtual void | get_vector_and_label (VwExample *&ex, int32_t &len, float64_t &label) |
void | set_env (CVwEnvironment *env_to_use) |
CVwEnvironment * | get_env () |
void | set_write_to_cache (bool write_cache) |
bool | get_write_to_cache () |
virtual bool | is_seekable () |
virtual const char * | get_name () const |
Public Attributes | |
parse_func | parse_example |
The function which will be called for parsing. | |
Protected Attributes | |
CVwParser * | parser |
Parser for vw format. | |
E_VW_PARSER_TYPE | parser_type |
Parser type. | |
CVwEnvironment * | env |
Environment used for vw - used by parser. | |
bool | write_to_cache |
Write data to a binary cache file. |
CStreamingVwFile | ( | ) |
Default constructor
Definition at line 15 of file StreamingVwFile.cpp.
CStreamingVwFile | ( | char * | fname, | |
char | rw = 'r' | |||
) |
Constructor taking file name argument
fname | file name | |
rw | read/write mode |
Definition at line 21 of file StreamingVwFile.cpp.
~CStreamingVwFile | ( | ) | [virtual] |
Destructor
Definition at line 27 of file StreamingVwFile.cpp.
CVwEnvironment* get_env | ( | ) |
Return the environment
Definition at line 94 of file StreamingVwFile.h.
virtual const char* get_name | ( | void | ) | const [virtual] |
Reimplemented from CStreamingFile.
Definition at line 121 of file StreamingVwFile.h.
void get_vector | ( | VwExample *& | ex, | |
int32_t & | len | |||
) | [virtual] |
Returns the parsed example.
The example contains the label if available, and also contains length of the feature vector. These parameters are redundant.
ex | examples as VwExample*, set by reference | |
len | length of vector, untouched |
Reimplemented from CStreamingFile.
Definition at line 54 of file StreamingVwFile.cpp.
Returns the parsed example.
TODO: Make this fail if examples are found to be unlabelled.
ex | example as VwExample*, set by reference | |
len | length of vector, untouched | |
label | label, untouched |
Reimplemented from CStreamingFile.
Definition at line 61 of file StreamingVwFile.cpp.
bool get_write_to_cache | ( | ) |
Get whether cache will be written
Definition at line 116 of file StreamingVwFile.h.
virtual bool is_seekable | ( | ) | [virtual] |
Whether the stream is seekable/resettable
Reimplemented from CStreamingFile.
Definition at line 118 of file StreamingVwFile.h.
void set_env | ( | CVwEnvironment * | env_to_use | ) |
Set environment for vw
env_to_use | CVwEnvironment* environment |
Definition at line 84 of file StreamingVwFile.h.
void set_parser_type | ( | E_VW_PARSER_TYPE | type = T_VW |
) |
Set the type of parser, i.e., T_VW, T_SVMLIGHT or T_DENSE.
type | parser type as enum |
Definition at line 33 of file StreamingVwFile.cpp.
void set_write_to_cache | ( | bool | write_cache | ) |
Set whether cache will be written
write_cache | whether to write to cache |
Definition at line 105 of file StreamingVwFile.h.
CVwEnvironment* env [protected] |
Environment used for vw - used by parser.
Definition at line 144 of file StreamingVwFile.h.
The function which will be called for parsing.
Definition at line 128 of file StreamingVwFile.h.
Parser for vw format.
Definition at line 138 of file StreamingVwFile.h.
E_VW_PARSER_TYPE parser_type [protected] |
Parser type.
Definition at line 141 of file StreamingVwFile.h.
bool write_to_cache [protected] |
Write data to a binary cache file.
Definition at line 147 of file StreamingVwFile.h.