Vowpal Wabbit
cost_sensitive.h
Go to the documentation of this file.
1 /*
2 Copyright (c) by respective owners including Yahoo!, Microsoft, and
3 individual contributors. All rights reserved. Released under a BSD
4 license as described in the file LICENSE.
5  */
6 #pragma once
7 #include "label_parser.h"
8 #include <vector>
9 
10 struct example;
11 struct vw;
12 
13 namespace COST_SENSITIVE
14 {
15 struct wclass
16 {
17  float x;
18  uint32_t class_index;
19  float partial_prediction; // a partial prediction: new!
20  float wap_value; // used for wap to store values derived from costs
21  bool operator==(wclass j) { return class_index == j.class_index; }
22 };
23 /* if class_index > 0, then this is a "normal" example
24  if class_index == 0, then:
25  if x == -FLT_MAX then this is a 'shared' example
26  if x > 0 then this is a label feature vector for (size_t)x
27 */
28 
29 struct label
30 {
32 };
33 
34 void output_example(vw& all, example& ec);
35 void finish_example(vw& all, example& ec);
36 template <class T>
37 void finish_example(vw& all, T&, example& ec)
38 {
39  finish_example(all, ec);
40 }
41 
42 extern label_parser cs_label;
43 
44 void print_update(
45  vw& all, bool is_test, example& ec, std::vector<example*>* ec_seq, bool multilabel, uint32_t prediction);
46 bool ec_is_example_header(example const& ec); // example headers look like "0:-1" or just "shared"
47 } // namespace COST_SENSITIVE
label_parser cs_label
bool ec_is_example_header(example const &ec)
bool operator==(wclass j)
void finish_example(vw &all, example &ec)
label_parser multilabel
Definition: multilabel.cc:118
void print_update(vw &all, bool is_test, example &ec, multi_ex *ec_seq, bool action_scores, uint32_t prediction)
v_array< wclass > costs
void output_example(vw &all, example &ec)