57 void CVwNativeCacheReader::init()
 
   71         SG_SERROR(
"Cache version too long, cache file is probably invalid.\n")
 
   73     char* t=SG_MALLOC(
char, v_length);
 
   75     if (strcmp(t,vw_version) != 0)
 
   78         SG_SERROR(
"Cache has possibly incompatible version!\n")
 
   86     if (cache_numbits != numbits)
 
   87         SG_SERROR(
"Bug encountered in caching! Bits used for weight in cache: %d.\n", cache_numbits)
 
   90 char* CVwNativeCacheReader::run_len_decode(
char *p, 
vw_size_t& i)
 
   95         i = i | ((*(p++) & 127) << 7*count++);
 
   96     i = i | (*(p++) << 7*count);
 
  100 char* CVwNativeCacheReader::bufread_label(
VwLabel* 
const ld, 
char* c)
 
  103     c += 
sizeof(ld->
label);
 
  120     c = bufread_label(ld,c);
 
  129     if (
buf.
buf_read(c, 
sizeof(tag_size)) < 
sizeof(tag_size))
 
  132     c += 
sizeof(tag_size);
 
  140     return tag_size+
sizeof(tag_size);
 
  149     if (read_cached_tag(ae) == 0)
 
  153     unsigned char num_indices = 0;
 
  154     if (
buf.
buf_read(c, 
sizeof(num_indices)) < 
sizeof(num_indices))
 
  156     num_indices = *(
unsigned char*)c;
 
  157     c += 
sizeof(num_indices);
 
  161     for (; num_indices > 0; num_indices--)
 
  164         unsigned char index = 0;
 
  167         if (temp < 
sizeof(index) + 
sizeof(
vw_size_t))
 
  168             SG_SERROR(
"Truncated example! %d < %d bytes expected.\n",
 
  171         index = *(
unsigned char*) c;
 
  183             SG_SERROR(
"Truncated example! Wanted %d bytes!\n", storage)
 
  185         char *end = c + storage;
 
  193             c = run_len_decode(c, temp);
 
  200                 f.
x = ((one_float*)c)->f;
 
  204             *our_sum_feat_sq += f.
x*f.
x;
 
  207             int32_t s_diff = ZigZagDecode(diff);
 
uint32_t weight_index
Hashed index in weight vector. 
uint32_t vw_size_t
vw_size_t typedef to work across platforms 
CIOBuffer buf
Buffer to read from. 
Base class from which all cache readers for VW should be derived. 
void push_many(const T *new_elem, size_t num)
Class CVwEnvironment is the environment used by VW. 
virtual void use_file(int fd)
Class v_array taken directly from JL's implementation. 
vw_size_t num_bits
log_2 of the number of features 
virtual void set_file(int32_t f)
float64_t sum_feat_sq[256]
Sum of square of features. 
virtual bool close_file()
void push(const T &new_elem)
CVwEnvironment * env
Environment. 
float32_t label
Label value. 
virtual void set_minmax(float64_t label)
v_array< vw_size_t > indices
Array of namespaces. 
float32_t weight
Weight of example. 
Class VwLabel holds a label object used by VW. 
bool sorted
Whether features are sorted by weight index. 
void check_cache_metadata()
virtual ssize_t read_file(void *buf, size_t nbytes)
unsigned int buf_read(char *&pointer, int n)
vw_size_t mask
Mask used for hashing. 
float32_t initial
Initial approximation. 
float32_t x
Feature value. 
all of classes and functions are contained in the shogun namespace 
VwLabel * ld
Label object. 
virtual bool read_cached_example(VwExample *const ae)
virtual ~CVwNativeCacheReader()
const char * vw_version
VW version. 
int32_t fd
File descriptor. 
v_array< VwFeature > atomics[256]
Array of features.