Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: cb_adf is not including some examples in stats calculation #1686

Merged
merged 3 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/RunTests
Original file line number Diff line number Diff line change
Expand Up @@ -1632,3 +1632,7 @@ echo "1 | feature:1" | {VW} -a --initial_weight 0.1 --initial_t 0.3
# Test 174 cbify adf, regcbopt
{VW} --cbify 10 --cb_explore_adf --cb_type mtr --regcbopt --mellowness 0.01 -d train-sets/multiclass
train-sets/ref/cbify_regcbopt.stderr

# Test 175 cb_adf, sharedfeatures
{VW} --dsjson --cb_adf -d train-sets/no_shared_features.json
train-sets/ref/no_shared_features.stderr
1 change: 1 addition & 0 deletions test/train-sets/no_shared_features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_label_cost":0,"_label_probability":0.333333343,"_label_Action":2,"_labelIndex":1,"o":[{"EventId":"f5547244f88543d1bcad0e3416fbd592","v":{"reward":0.0,"value4":0.0,"value1":0.0,"value2":1400.0,"value3":0.0}}],"Timestamp":"2018-11-22T02:31:39.1440000Z","Version":"1","EventId":"f5547244f88543d1bcad0e3416fbd592","a":[2,1,3],"c":{"_multi":[{"name3":{"name4":4.65312243,"name2":1.0}},{"name3":{"name":4.65312243,"name2":1.0}},{"name3":{"name5":4.65312243}}]},"p":[0.333333343,0.333333343,0.333333343],"VWState":{"m":"N/A"}}
17 changes: 17 additions & 0 deletions test/train-sets/ref/no_shared_features.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/no_shared_features.json
num sources = 1
average since example example current current current
loss last counter weight label predict features
0.000000 0.000000 1 1.0 known 0:0... 8

finished run
number of examples = 1
weighted example sum = 1.000000
weighted label sum = 0.000000
average loss = 0.000000
total feature number = 8
2 changes: 1 addition & 1 deletion vowpalwabbit/cb_adf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ bool update_statistics(vw& all, cb_adf& c, example& ec, multi_ex* ec_seq)

void output_example(vw& all, cb_adf& c, example& ec, multi_ex* ec_seq)
{
if (example_is_newline(ec) || (CB::ec_is_example_header(ec) && ec_seq->size() == 1)) return;
if (example_is_newline_not_header(ec)) return;

bool labeled_example = update_statistics(all, c, ec, ec_seq);

Expand Down