19 using namespace shogun;
63 for (
vw_size_t i = 0; i < num_threads; i++)
69 for (
vw_size_t j = 0; j < length/num_threads; j++)
86 int32_t f = io_temp.
open_file(reg_name,
'w');
89 SG_SERROR(
"Can't open: %s for writing! Exiting.\n", reg_name)
97 io_temp.
write_file((
char*)&v_length,
sizeof(v_length));
110 io_temp.
write_file((
char *)&len,
sizeof(len));
125 len = sprintf(buff,
"Version %s\n", vw_version);
134 len = sprintf(buff,
"\n");
138 len = sprintf(buff,
"ngram:%d skips:%d\nindex:weight pairs:\n", (int32_t)
env->
ngram, (int32_t)
env->
skips);
147 for(uint32_t i = 0; i < length; i++)
161 int32_t len = sprintf(buff,
"%d:%f\n", i, v);
173 int32_t fd = source.
open_file(file,
'r');
176 SG_SERROR(
"Unable to open file for loading regressor!\n")
180 source.
read_file((
char*)&v_length,
sizeof(v_length));
181 char* t = SG_MALLOC(
char, v_length);
186 SG_SERROR(
"Regressor source has an incompatible VW version!\n")
196 source.
read_file((
char *)&local_num_bits,
sizeof(local_num_bits));
199 SG_SERROR(
"Wrong number of bits in regressor source!\n")
204 source.
read_file((
char*)&local_thread_bits,
sizeof(local_thread_bits));
209 source.
read_file((
char *)&len,
sizeof(len));
213 for (; len > 0; len--)
229 source.
read_file((
char*)&local_ngram,
sizeof(local_ngram));
231 source.
read_file((
char*)&local_skips,
sizeof(local_skips));
241 ssize_t hash_bytes = source.
read_file((
char *)&hash,
sizeof(hash));
247 if (weight_bytes <= 0)
253 =
weight_vectors[hash % num_threads][(hash*stride)/num_threads] + w;