diff --git a/test/RunTests b/test/RunTests index d7e87b85858..29319e13ea3 100755 --- a/test/RunTests +++ b/test/RunTests @@ -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 diff --git a/test/train-sets/no_shared_features.json b/test/train-sets/no_shared_features.json new file mode 100644 index 00000000000..e4dbd911623 --- /dev/null +++ b/test/train-sets/no_shared_features.json @@ -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"}} diff --git a/test/train-sets/ref/no_shared_features.stderr b/test/train-sets/ref/no_shared_features.stderr new file mode 100644 index 00000000000..83a007cec25 --- /dev/null +++ b/test/train-sets/ref/no_shared_features.stderr @@ -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 diff --git a/vowpalwabbit/cb_adf.cc b/vowpalwabbit/cb_adf.cc index 41c7782253d..3bda421626e 100644 --- a/vowpalwabbit/cb_adf.cc +++ b/vowpalwabbit/cb_adf.cc @@ -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);