Vowpal Wabbit
no_label.cc
Go to the documentation of this file.
1 #include <cstring>
2 #include <float.h>
3 #include <math.h>
4 #include <stdio.h>
5 
6 #include "cache.h"
7 #include "accumulate.h"
8 #include "best_constant.h"
9 
10 namespace no_label
11 {
12 char* bufread_no_label(shared_data*, label_data*, char* c) { return c; }
13 
14 size_t read_cached_no_label(shared_data*, void*, io_buf&) { return 1; }
15 
16 float get_weight(void*) { return 1.; }
17 
18 char* bufcache_no_label(label_data*, char* c) { return c; }
19 
20 void cache_no_label(void*, io_buf&) {}
21 
22 void default_no_label(void*) {}
23 
24 bool test_label(void*) { return false; }
25 
26 void delete_no_label(void*) {}
27 
29 {
30  switch (words.size())
31  {
32  case 0:
33  break;
34  default:
35  std::cout << "Error: " << words.size() << " is too many tokens for a simple label: ";
36  for (unsigned int i = 0; i < words.size(); ++i) print_substring(words[i]);
37  std::cout << std::endl;
38  }
39 }
40 
42  get_weight, nullptr, test_label, sizeof(nullptr)};
43 
45 {
47  !all.bfgs)
48  {
50  all.progress_arg);
51  }
52 }
53 
55 {
56  all.sd->update(ec.test_only, false, ec.loss, ec.weight, ec.num_features);
57 
58  all.print(all.raw_prediction, ec.partial_prediction, -1, ec.tag);
59  for (size_t i = 0; i < all.final_prediction_sink.size(); i++)
60  {
61  int f = (int)all.final_prediction_sink[i];
62  all.print(f, ec.pred.scalar, 0, ec.tag);
63  }
64 
65  print_no_label_update(all, ec);
66 }
67 
68 void return_no_label_example(vw& all, void*, example& ec)
69 {
71  VW::finish_example(all, ec);
72 }
73 } // namespace no_label
v_array< char > tag
Definition: example.h:63
int raw_prediction
Definition: global_data.h:519
float scalar
Definition: example.h:45
double weighted_unlabeled_examples
Definition: global_data.h:143
void output_and_account_example(vw &all, active &a, example &ec)
Definition: active.cc:105
v_array< int > final_prediction_sink
Definition: global_data.h:518
float partial_prediction
Definition: example.h:68
bool quiet
Definition: global_data.h:487
bool holdout_set_off
Definition: global_data.h:499
float get_weight(void *)
Definition: no_label.cc:16
bool progress_add
Definition: global_data.h:545
size_t size() const
Definition: v_array.h:68
char * bufcache_no_label(label_data *, char *c)
Definition: no_label.cc:18
void output_and_account_no_label_example(vw &all, example &ec)
Definition: no_label.cc:54
shared_data * sd
Definition: global_data.h:375
float progress_arg
Definition: global_data.h:546
void print_update(bool holdout_set_off, size_t current_pass, float label, float prediction, size_t num_features, bool progress_add, float progress_arg)
Definition: global_data.h:225
bool bfgs
Definition: global_data.h:412
size_t num_features
Definition: example.h:67
void return_no_label_example(vw &all, void *, example &ec)
Definition: no_label.cc:68
char * bufread_no_label(shared_data *, label_data *, char *c)
Definition: no_label.cc:12
uint64_t current_pass
Definition: global_data.h:396
void cache_no_label(void *, io_buf &)
Definition: no_label.cc:20
Definition: io_buf.h:54
void finish_example(vw &, example &)
Definition: parser.cc:881
void update(bool test_example, bool labeled_example, float loss, float weight, size_t num_features)
Definition: global_data.h:190
float loss
Definition: example.h:70
void parse_no_label(parser *, shared_data *, void *, v_array< substring > &words)
Definition: no_label.cc:28
void print_no_label_update(vw &all, example &ec)
Definition: no_label.cc:44
size_t read_cached_no_label(shared_data *, void *, io_buf &)
Definition: no_label.cc:14
void default_no_label(void *)
Definition: no_label.cc:22
double weighted_labeled_examples
Definition: global_data.h:141
Definition: parser.h:38
void delete_no_label(void *)
Definition: no_label.cc:26
polyprediction pred
Definition: example.h:60
void print_substring(substring s)
bool test_label(void *)
Definition: no_label.cc:24
float weight
Definition: example.h:62
float dump_interval
Definition: global_data.h:147
constexpr uint64_t c
Definition: rand48.cc:12
void(* print)(int, float, float, v_array< char >)
Definition: global_data.h:521
float f
Definition: cache.cc:40
label_parser no_label_parser
Definition: no_label.cc:41
bool test_only
Definition: example.h:76