19 size_t num = *(
size_t*)c;
23 if (cache.
buf_read(c, total) < total)
25 std::cout <<
"error in demarshal of cost data" << std::endl;
28 for (
size_t i = 0; i < num; i++)
32 ld->
costs.push_back(temp);
44 size_t total =
sizeof(size_t);
45 if (cache.
buf_read(c, total) < total)
60 *(
size_t*)c = ld->
costs.size();
62 for (
auto const& cost : ld->
costs)
90 if (ld->
costs.empty())
92 for (
auto const& cost : ld->
costs)
93 if (FLT_MAX != cost.cost && cost.probability > 0.)
101 ld->
costs.delete_v();
118 for (
auto const& word : words)
133 if (std::isnan(f.
cost))
145 std::cerr <<
"invalid probability > 1 specified for an action, resetting to 1." << std::endl;
150 std::cerr <<
"invalid probability < 0 specified for an action, resetting to 0." << std::endl;
160 std::cerr <<
"shared feature vectors should not have costs" << std::endl;
163 ld->
costs.push_back(f);
173 if (costs.
size() != 1)
175 if (costs[0].probability == -1.
f)
187 if (ec_seq !=
nullptr)
191 for (
size_t i = 0; i < (*ec_seq).size(); i++)
193 num_features += (*ec_seq)[i]->num_features;
195 std::string label_buf;
197 label_buf =
" unknown";
199 label_buf =
" known";
203 std::ostringstream pred_buf;
206 pred_buf << ec.
pred.
a_s[0].action <<
":" << ec.
pred.
a_s[0].score <<
"...";
208 pred_buf <<
"no action";
231 size_t total =
sizeof(uint32_t);
232 if (cache.
buf_read(c, total) < total)
234 ld->
action = *(uint32_t*)c;
244 *(uint32_t*)c = ld->
action;
280 if (words.
size() < 2)
281 THROW(
"Evaluation can not happen without an action and an exploration");
void copy_label(void *dst, void *src)
void parse_label(parser *p, shared_data *sd, void *v, v_array< substring > &words)
ACTION_SCORE::action_scores a_s
void copy_label(void *dst, void *src)
char * bufcache_label(CB::label *ld, char *c)
void cache_label(void *v, io_buf &cache)
bool ec_is_example_header(example const &ec)
void parse_label(parser *p, shared_data *, void *v, v_array< substring > &words)
void copy_array(v_array< T > &dst, const v_array< T > &src)
v_array< action_score > action_scores
v_array< cb_class > costs
void delete_label(void *v)
void cache_label(void *v, io_buf &cache)
v_array< substring > parse_name
void print_update(vw &all, bool is_test, example &ec, multi_ex *ec_seq, bool action_scores)
float float_of_substring(substring s)
void default_label(void *v)
size_t read_cached_label(shared_data *sd, void *v, io_buf &cache)
void tokenize(char delim, substring s, ContainerT &ret, bool allow_empty=false)
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)
void default_label(void *v)
void buf_write(char *&pointer, size_t n)
std::vector< example * > multi_ex
VW_STD14_CONSTEXPR uint64_t hashstring(substring s, uint64_t h)
size_t read_cached_label(shared_data *, void *v, io_buf &cache)
bool substring_equal(const substring &a, const substring &b)
static constexpr int col_current_predict
void delete_label(void *v)
double weighted_examples()
char * bufread_label(CB::label *ld, char *c, io_buf &cache)
size_t buf_read(char *&pointer, size_t n)