Public Member Functions | Protected Attributes

CStreamingVwCacheFile Class Reference

Detailed Description

Class StreamingVwCacheFile to read vector-by-vector from VW cache files.

The cache file is usually generated either by VW or by enabling the cache writing option in a CStreamingVwFile object.

This class reads the example and label into one object of VwExample type.

Definition at line 30 of file StreamingVwCacheFile.h.

Inheritance diagram for CStreamingVwCacheFile:
Inheritance graph

List of all members.

Public Member Functions

 CStreamingVwCacheFile ()
 CStreamingVwCacheFile (EVwCacheType cache_type)
 CStreamingVwCacheFile (char *fname, char rw='r', EVwCacheType cache_type=C_NATIVE)
virtual ~CStreamingVwCacheFile ()
virtual void get_vector (VwExample *&ex, int32_t &len)
virtual void get_vector_and_label (VwExample *&ex, int32_t &len, float64_t &label)
virtual const char * get_name () const
void set_env (CVwEnvironment *env_to_use)
CVwEnvironmentget_env ()
bool is_seekable ()
void reset_stream ()

Protected Attributes

 Cache reader.
 Environment used for vw.
EVwCacheType cache_format
 Cache type.

Constructor & Destructor Documentation

Default constructor. Assumes cache file is of type C_NATIVE

Definition at line 14 of file StreamingVwCacheFile.cpp.

CStreamingVwCacheFile ( EVwCacheType  cache_type  ) 

Constructor taking cache type as an argument.

cache_type cache type - C_NATIVE or C_PROTOBUF

Definition at line 20 of file StreamingVwCacheFile.cpp.

CStreamingVwCacheFile ( char *  fname,
char  rw = 'r',
EVwCacheType  cache_type = C_NATIVE 

Constructor taking file name and cache type as arguments

fname file name
rw read/write mode
cache_type type of cache - C_NATIVE or C_PROTOBUF

Definition at line 26 of file StreamingVwCacheFile.cpp.

~CStreamingVwCacheFile (  )  [virtual]


Definition at line 32 of file StreamingVwCacheFile.cpp.

Member Function Documentation

CVwEnvironment* get_env (  ) 

Return the environment

environment as CVwEnvironment*

Definition at line 102 of file StreamingVwCacheFile.h.

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

Reimplemented from CStreamingFile.

Definition at line 85 of file StreamingVwCacheFile.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, passed separately are redundant.

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

Reimplemented from CStreamingFile.

Definition at line 38 of file StreamingVwCacheFile.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.

ex example as VwExample*, set by reference
len length of vector, untouched
label label, untouched

Reimplemented from CStreamingFile.

Definition at line 46 of file StreamingVwCacheFile.cpp.

bool is_seekable (  )  [virtual]

Whether this stream is seekable

true, since caches can be reset

Reimplemented from CStreamingFile.

Definition at line 113 of file StreamingVwCacheFile.h.

void reset_stream (  )  [virtual]

Reset cache file back to first example.

Used when multiple passes are to be performed

Reimplemented from CStreamingFile.

Definition at line 76 of file StreamingVwCacheFile.cpp.

void set_env ( CVwEnvironment env_to_use  ) 

Set environment for vw

env_to_use CVwEnvironment* environment

Definition at line 54 of file StreamingVwCacheFile.cpp.

Member Data Documentation

Cache type.

Definition at line 138 of file StreamingVwCacheFile.h.

Cache reader.

Definition at line 132 of file StreamingVwCacheFile.h.

CVwEnvironment* env [protected]

Environment used for vw.

Definition at line 135 of file StreamingVwCacheFile.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