Vowpal Wabbit
vowpalwabbit
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
{
31
v_array<wclass>
costs
;
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
COST_SENSITIVE
Definition:
cost_sensitive.cc:7
COST_SENSITIVE::cs_label
label_parser cs_label
Definition:
cost_sensitive.cc:187
COST_SENSITIVE::wclass::wap_value
float wap_value
Definition:
cost_sensitive.h:20
COST_SENSITIVE::wclass
Definition:
cost_sensitive.h:15
COST_SENSITIVE::ec_is_example_header
bool ec_is_example_header(example const &ec)
Definition:
cost_sensitive.cc:308
COST_SENSITIVE::label
Definition:
cost_sensitive.h:29
vw
Definition:
global_data.h:369
COST_SENSITIVE::wclass::operator==
bool operator==(wclass j)
Definition:
cost_sensitive.h:21
label_parser
Definition:
label_parser.h:10
COST_SENSITIVE::finish_example
void finish_example(vw &all, example &ec)
Definition:
cost_sensitive.cc:291
example
Definition:
example.h:54
COST_SENSITIVE::wclass::class_index
uint32_t class_index
Definition:
cost_sensitive.h:18
COST_SENSITIVE::wclass::partial_prediction
float partial_prediction
Definition:
cost_sensitive.h:19
label_parser.h
MULTILABEL::multilabel
label_parser multilabel
Definition:
multilabel.cc:118
COST_SENSITIVE::wclass::x
float x
Definition:
cost_sensitive.h:17
COST_SENSITIVE::print_update
void print_update(vw &all, bool is_test, example &ec, multi_ex *ec_seq, bool action_scores, uint32_t prediction)
Definition:
cost_sensitive.cc:190
COST_SENSITIVE::label::costs
v_array< wclass > costs
Definition:
cost_sensitive.h:31
v_array
Definition:
reductions_fwd.h:10
COST_SENSITIVE::output_example
void output_example(vw &all, example &ec)
Definition:
cost_sensitive.cc:236
Generated on Thu Apr 9 2020 14:45:24 for Vowpal Wabbit by
1.8.13