Public Member Functions | Public Attributes | Protected Attributes

CStreamingVwFile Class Reference


Detailed Description

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.

Inheritance diagram for CStreamingVwFile:
Inheritance graph
[legend]

List of all members.

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)
CVwEnvironmentget_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

CVwParserparser
 Parser for vw format.
E_VW_PARSER_TYPE parser_type
 Parser type.
CVwEnvironmentenv
 Environment used for vw - used by parser.
bool write_to_cache
 Write data to a binary cache file.

Constructor & Destructor Documentation

Default constructor

Definition at line 15 of file StreamingVwFile.cpp.

CStreamingVwFile ( char *  fname,
char  rw = 'r' 
)

Constructor taking file name argument

Parameters:
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.


Member Function Documentation

CVwEnvironment* get_env (  ) 

Return the environment

Returns:
environment as CVwEnvironment*

Definition at line 94 of file StreamingVwFile.h.

virtual const char* get_name (  )  const [virtual]
Returns:
object name

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.

Parameters:
ex examples as VwExample*, set by reference
len length of vector, untouched

Reimplemented from CStreamingFile.

Definition at line 54 of file StreamingVwFile.cpp.

void get_vector_and_label ( VwExample *&  ex,
int32_t &  len,
float64_t label 
) [virtual]

Returns the parsed example.

TODO: Make this fail if examples are found to be unlabelled.

Parameters:
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

Returns:
whether to write to cache

Definition at line 116 of file StreamingVwFile.h.

virtual bool is_seekable (  )  [virtual]

Whether the stream is seekable/resettable

Returns:
false by default, unless overloaded

Reimplemented from CStreamingFile.

Definition at line 118 of file StreamingVwFile.h.

void set_env ( CVwEnvironment env_to_use  ) 

Set environment for vw

Parameters:
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.

Parameters:
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

Parameters:
write_cache whether to write to cache

Definition at line 105 of file StreamingVwFile.h.


Member Data Documentation

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.

CVwParser* parser [protected]

Parser for vw format.

Definition at line 138 of file StreamingVwFile.h.

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.


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