18 using namespace shogun;
58 if (adaptive_learning)
90 reg_dump_text = is_text;
95 save_predictions =
true;
96 prediction_fd = open(file_name, O_CREAT|O_TRUNC|O_WRONLY, 0666);
97 if (prediction_fd < 0)
98 SG_SERROR(
"Unable to open prediction file %s for writing!\n", file_name);
120 const char* header_fmt =
"%-10s %-10s %8s %8s %10s %8s %8s\n";
125 "average",
"since",
"example",
"example",
126 "current",
"current",
"current");
128 "loss",
"last",
"counter",
"weight",
"label",
"predict",
"features");
141 if (example->
pass != current_pass)
144 current_pass = example->
pass;
152 output_example(example);
168 for (uint32_t i = 0; i < length; i++)
172 if (reg_name != NULL)
182 prediction = inline_l1_predict(ex);
184 prediction = inline_predict(ex);
199 update = (
env->
eta * exact_norm)/sum_abs_x;
224 dump_interval = exp(1.);
225 sum_loss_since_last_dump = 0.;
227 reg_dump_text =
true;
228 save_predictions =
false;
236 void CVowpalWabbit::set_learner()
265 ex->
atomics[(int32_t)(i[1])], thread_mask,
303 if (ret < env->min_label)
309 void CVowpalWabbit::output_example(
VwExample* &example)
313 sum_loss_since_last_dump += example->
loss;
316 print_update(example);
321 if (save_predictions)
331 void CVowpalWabbit::print_update(
VwExample* &ex)
333 SG_SPRINT(
"%-10.6f %-10.6f %8lld %8.1f %8.4f %8.4f %8lu\n",
341 sum_loss_since_last_dump = 0.0;
351 int32_t num = sprintf(temp,
"%f", res);
353 t = write(f, temp, num);
360 t = write(f, temp, 1);
364 t = write(f, tag.
begin,
sizeof(
char)*tag.
index());
365 if (t != (ssize_t) (
sizeof(char)*tag.
index()))
370 t = write(f, temp, 1);
376 void CVowpalWabbit::set_verbose(
bool verbose)
378 quiet=verbose==
false;
389 if (g == 0)
return 0.;
398 float32_t* w_vec = &weights[f->weight_index & thread_mask];
401 sum_abs_x += fabsf(f->x);
424 float32_t update2 = g * page_feature.
x * page_feature.
x;
427 float32_t* w_vec = &weights[(halfhash + elem->weight_index) & mask];
430 sum_abs_x += fabsf(elem->x);