Base class from which all cache readers for VW should be derived.
The object is given cache file information and the environment which will be used during parsing, and must implement a read_cached_example() function which returns a parsed example by reference.
Definition at line 43 of file VwCacheReader.h.
Public Member Functions | |
CVwCacheReader () | |
CVwCacheReader (char *fname, CVwEnvironment *env_to_use) | |
CVwCacheReader (int32_t f, CVwEnvironment *env_to_use) | |
virtual | ~CVwCacheReader () |
virtual void | set_file (int32_t f) |
virtual void | set_env (CVwEnvironment *env_to_use) |
virtual CVwEnvironment * | get_env () |
virtual void | set_mm (float64_t label) |
virtual void | noop_mm (float64_t label) |
virtual void | set_minmax (float64_t label) |
virtual bool | read_cached_example (VwExample *const ae)=0 |
virtual const char * | get_name () const |
Protected Attributes | |
int32_t | fd |
File descriptor. | |
CVwEnvironment * | env |
Environment. |
CVwCacheReader | ( | ) |
Default constructor
Definition at line 20 of file VwCacheReader.cpp.
CVwCacheReader | ( | char * | fname, | |
CVwEnvironment * | env_to_use | |||
) |
Constructor, opens file specified by filename
fname | name of file to open | |
env_to_use | Environment to use |
Definition at line 27 of file VwCacheReader.cpp.
CVwCacheReader | ( | int32_t | f, | |
CVwEnvironment * | env_to_use | |||
) |
Constructor which takes an already opened file descriptor as argument.
f | file descriptor | |
env_to_use | VwEnvironment object to use |
Definition at line 39 of file VwCacheReader.cpp.
~CVwCacheReader | ( | ) | [virtual] |
Destructor
Definition at line 47 of file VwCacheReader.cpp.
CVwEnvironment * get_env | ( | ) | [virtual] |
virtual const char* get_name | ( | void | ) | const [virtual] |
Return the name of the object
Implements CSGObject.
Reimplemented in CVwNativeCacheReader.
Definition at line 137 of file VwCacheReader.h.
virtual void noop_mm | ( | float64_t | label | ) | [virtual] |
A dummy function performing no operation in case training is not to be performed.
label | label |
Definition at line 112 of file VwCacheReader.h.
virtual bool read_cached_example | ( | VwExample *const | ae | ) | [pure virtual] |
Function to read one example from the cache
Implemented in CVwNativeCacheReader.
void set_env | ( | CVwEnvironment * | env_to_use | ) | [virtual] |
Set the environment
env_to_use | environment |
Definition at line 60 of file VwCacheReader.cpp.
void set_file | ( | int32_t | f | ) | [virtual] |
Set the file descriptor to use
f | descriptor of cache file |
Reimplemented in CVwNativeCacheReader.
Definition at line 55 of file VwCacheReader.cpp.
virtual void set_minmax | ( | float64_t | label | ) | [virtual] |
Function which is actually called to update min and max labels Should be set to one of the functions implemented for this.
label | label based on which to update |
Definition at line 120 of file VwCacheReader.h.
virtual void set_mm | ( | float64_t | label | ) | [virtual] |
Update min and max labels seen in the environment
label | current label based on which to update |
Definition at line 99 of file VwCacheReader.h.
CVwEnvironment* env [protected] |
Environment.
Definition at line 144 of file VwCacheReader.h.
int32_t fd [protected] |
File descriptor.
Definition at line 141 of file VwCacheReader.h.