|
SHOGUN
v1.1.0
|
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.

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) |
| CVwEnvironment * | get_env () |
| bool | is_seekable () |
| void | reset_stream () |
Public Member Functions inherited from CStreamingFile | |
| CStreamingFile () | |
| CStreamingFile (char *fname, char rw='r') | |
| virtual | ~CStreamingFile () |
| void | close () |
| virtual void | get_vector (bool *&vector, int32_t &len) |
| virtual void | get_vector (uint8_t *&vector, int32_t &len) |
| virtual void | get_vector (char *&vector, int32_t &len) |
| virtual void | get_vector (int32_t *&vector, int32_t &len) |
| virtual void | get_vector (float32_t *&vector, int32_t &len) |
| virtual void | get_vector (float64_t *&vector, int32_t &len) |
| virtual void | get_vector (int16_t *&vector, int32_t &len) |
| virtual void | get_vector (uint16_t *&vector, int32_t &len) |
| virtual void | get_vector (int8_t *&vector, int32_t &len) |
| virtual void | get_vector (uint32_t *&vector, int32_t &len) |
| virtual void | get_vector (int64_t *&vector, int32_t &len) |
| virtual void | get_vector (uint64_t *&vector, int32_t &len) |
| virtual void | get_vector (floatmax_t *&vector, int32_t &len) |
| virtual void | get_vector_and_label (bool *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (uint8_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (char *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (int32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (float32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (float64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (int16_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (uint16_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (int8_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (uint32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (int64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (uint64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_vector_and_label (floatmax_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string (bool *&vector, int32_t &len) |
| virtual void | get_string (uint8_t *&vector, int32_t &len) |
| virtual void | get_string (char *&vector, int32_t &len) |
| virtual void | get_string (int32_t *&vector, int32_t &len) |
| virtual void | get_string (float32_t *&vector, int32_t &len) |
| virtual void | get_string (float64_t *&vector, int32_t &len) |
| virtual void | get_string (int16_t *&vector, int32_t &len) |
| virtual void | get_string (uint16_t *&vector, int32_t &len) |
| virtual void | get_string (int8_t *&vector, int32_t &len) |
| virtual void | get_string (uint32_t *&vector, int32_t &len) |
| virtual void | get_string (int64_t *&vector, int32_t &len) |
| virtual void | get_string (uint64_t *&vector, int32_t &len) |
| virtual void | get_string (floatmax_t *&vector, int32_t &len) |
| virtual void | get_string_and_label (bool *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (uint8_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (char *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (int32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (float32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (float64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (int16_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (uint16_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (int8_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (uint32_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (int64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (uint64_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_string_and_label (floatmax_t *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< bool > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< uint8_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< char > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< int32_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< float32_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< float64_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< int16_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< uint16_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< int8_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< uint32_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< int64_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< uint64_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector (SGSparseVectorEntry< floatmax_t > *&vector, int32_t &len) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< bool > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< uint8_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< char > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< int32_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< float32_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< float64_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< int16_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< uint16_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< int8_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< uint32_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< int64_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< uint64_t > *&vector, int32_t &len, float64_t &label) |
| virtual void | get_sparse_vector_and_label (SGSparseVectorEntry< floatmax_t > *&vector, int32_t &len, float64_t &label) |
Public Member Functions inherited from CSGObject | |
| CSGObject () | |
| CSGObject (const CSGObject &orig) | |
| virtual | ~CSGObject () |
| virtual bool | is_generic (EPrimitiveType *generic) const |
| template<class T > | |
| void | set_generic () |
| void | unset_generic () |
| virtual void | print_serializable (const char *prefix="") |
| virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
| virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
| void | set_global_io (SGIO *io) |
| SGIO * | get_global_io () |
| void | set_global_parallel (Parallel *parallel) |
| Parallel * | get_global_parallel () |
| void | set_global_version (Version *version) |
| Version * | get_global_version () |
| SGVector< char * > | get_modelsel_names () |
| char * | get_modsel_param_descr (const char *param_name) |
| index_t | get_modsel_param_index (const char *param_name) |
Protected Attributes | |
| CVwCacheReader * | cache_reader |
| Cache reader. | |
| CVwEnvironment * | env |
| Environment used for vw. | |
| EVwCacheType | cache_format |
| Cache type. | |
Protected Attributes inherited from CStreamingFile | |
| CIOBuffer * | buf |
| Buffer to hold stuff in memory. | |
| char | task |
| Task. | |
| char * | filename |
| Name of the handled file. | |
Additional Inherited Members | |
Public Attributes inherited from CSGObject | |
| SGIO * | io |
| Parallel * | parallel |
| Version * | version |
| Parameter * | m_parameters |
| Parameter * | m_model_selection_parameters |
Protected Member Functions inherited from CSGObject | |
| virtual void | load_serializable_pre () throw (ShogunException) |
| virtual void | load_serializable_post () throw (ShogunException) |
| virtual void | save_serializable_pre () throw (ShogunException) |
| virtual void | save_serializable_post () throw (ShogunException) |
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.
|
virtual |
Destructor
Definition at line 32 of file StreamingVwCacheFile.cpp.
| CVwEnvironment* get_env | ( | ) |
Return the environment
Definition at line 102 of file StreamingVwCacheFile.h.
|
virtual |
Reimplemented from CStreamingFile.
Definition at line 85 of file StreamingVwCacheFile.h.
|
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.
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.
|
virtual |
Whether this stream is seekable
Reimplemented from CStreamingFile.
Definition at line 113 of file StreamingVwCacheFile.h.
|
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.
|
protected |
Cache type.
Definition at line 138 of file StreamingVwCacheFile.h.
|
protected |
Cache reader.
Definition at line 132 of file StreamingVwCacheFile.h.
|
protected |
Environment used for vw.
Definition at line 135 of file StreamingVwCacheFile.h.