Skip to content

Commit

Permalink
Make cbify reduction respect is_learn parameter (VowpalWabbit#1722)
Browse files Browse the repository at this point in the history
  • Loading branch information
lokitoth authored and JohnLangford committed Jan 22, 2019
1 parent 5b020c4 commit b50fb59
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vowpalwabbit/cbify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,18 @@ void predict_or_learn(cbify& data, single_learner& base, example& ec)
//Create a new cb label
data.cb_label.costs.push_back(cl);
ec.l.cb = data.cb_label;
base.learn(ec);

if (is_learn)
base.learn(ec);

data.a_s.clear();
data.a_s = ec.pred.a_s;

if (use_cs)
ec.l.cs = csl;
else
ec.l.multi = ld;

ec.pred.multiclass = cl.action;
}

Expand Down Expand Up @@ -191,7 +196,9 @@ void predict_or_learn_adf(cbify& data, multi_learner& base, example& ec)
auto& lab = data.adf_data.ecs[cl.action - 1]->l.cb;
lab.costs.push_back(cl);

base.learn(data.adf_data.ecs);
if (is_learn)
base.learn(data.adf_data.ecs);

ec.pred.multiclass = cl.action;
}

Expand Down

0 comments on commit b50fb59

Please sign in to comment.