Skip to content
peterychang edited this page Apr 23, 2020 · 1 revision

Current

void save_predictor(vw& all, std::string reg_name); 
void save_predictor(vw& all, io_buf& buf); 

inline uint64_t hash_space(vw& all, const std::string& s) 
inline uint64_t hash_space_static(const std::string& s, const std::string& hash) 
inline uint64_t hash_space_cstr(vw& all, const char* fstr) 

// Then use it as the seed for hashing features. 
inline uint64_t hash_feature(vw& all, const std::string& s, uint64_t u) 
inline uint64_t hash_feature_static(const std::string& s, uint64_t u, const std::string& h, uint32_t num_bits) 
inline uint64_t hash_feature_cstr(vw& all, char* fstr, uint64_t u) 

inline float get_weight(vw& all, uint32_t index, uint32_t offset) 
inline void set_weight(vw& all, uint32_t index, uint32_t offset, float value) 
inline uint32_t num_weights(vw& all) { return (uint32_t)all.length(); } 

inline uint32_t get_stride(vw& all) { return all.weights.stride(); } 

inline void init_features(primitive_feature_space& fs, size_t features_count) 
inline void set_feature(primitive_feature_space& fs, size_t index, uint64_t feature_hash, float value) 

Deprecate

void save_predictor(vw& all, io_buf& buf);  // Don’t expose io_buf. Maybe allow some kind of file handle instead? 

inline uint64_t hash_space(vw& all, const std::string& s)  // Generic interface uses hash type 
inline uint64_t hash_feature(vw& all, const std::string& s, uint64_t u)  // Generic interface uses hash type 

Proposed

ErrorCode save_predictor(const vw* all, const char* filename) 

uint64_t vw_hash(const vw* all, const uint8_t* data, size_t length, HashType hash_type) 
uint64_t vw_hash_str(vw* all, const char*) 
uint64_t vw_hash_seed(const vw* all, const uint8_t* data, size_t length, uint64_t seed, HashType hash_type) 
uint64_t vw_hash_seed_str(vw* all, const char* data, uint64_t seed) 

float get_weight(const vw*, uint32_t idx, uint32_t offset) 
void set_weight(vw*, uint32_t idx, uint32_t offset, float value) 
size_t num_weights(const vw*) 

uint32_t get_stride(const vw*) 

primitive_feature_space* create_features(size_t size) 

void set_feature(primitive_feature_space* fs, size_t index, uint64_t feature_hash, float value) // not reaslly necessary, but maybe handy to keep around? We can unexpose the primitive_feature_space if we have this 
Clone this wiki locally