19 using namespace shogun;
61 for (
vw_size_t i = 0; i < num_threads; i++)
67 for (
vw_size_t j = 0; j < length/num_threads; j++)
84 int32_t f = io_temp.
open_file(reg_name,
'w');
87 SG_SERROR(
"Can't open: %s for writing! Exiting.\n", reg_name);
95 io_temp.
write_file((
char*)&v_length,
sizeof(v_length));
108 io_temp.
write_file((
char *)&len,
sizeof(len));
123 len = sprintf(buff,
"Version %s\n", vw_version);
132 len = sprintf(buff,
"\n");
136 len = sprintf(buff,
"ngram:%d skips:%d\nindex:weight pairs:\n", (int32_t)
env->
ngram, (int32_t)
env->
skips);
145 for(uint32_t i = 0; i < length; i++)
159 int32_t len = sprintf(buff,
"%d:%f\n", i, v);
171 int32_t fd = source.
open_file(file,
'r');
174 SG_SERROR(
"Unable to open file for loading regressor!\n");
178 source.
read_file((
char*)&v_length,
sizeof(v_length));
184 SG_SERROR(
"Regressor source has an incompatible VW version!\n");
194 source.
read_file((
char *)&local_num_bits,
sizeof(local_num_bits));
197 SG_SERROR(
"Wrong number of bits in regressor source!\n");
202 source.
read_file((
char*)&local_thread_bits,
sizeof(local_thread_bits));
207 source.
read_file((
char *)&len,
sizeof(len));
211 for (; len > 0; len--)
227 source.
read_file((
char*)&local_ngram,
sizeof(local_ngram));
229 source.
read_file((
char*)&local_skips,
sizeof(local_skips));
239 ssize_t hash_bytes = source.
read_file((
char *)&hash,
sizeof(hash));
245 if (weight_bytes <= 0)
251 =
weight_vectors[hash % num_threads][(hash*stride)/num_threads] + w;