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

Warm start for cbify #1534

Merged
merged 150 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 139 commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
c891ae8
/
Jan 25, 2018
cc0ac23
not sure if the cost vector retrieved is correct
Jan 29, 2018
4a27941
not sure if the cost vector retrieved is correct
Jan 29, 2018
539b1e4
added cbify warm start code
zcc1307 Feb 8, 2018
961a5a5
commented out the multiple lambda code in cbify
zcc1307 Feb 9, 2018
0fbc26a
commented out the multiple lambda code in cbify
zcc1307 Feb 9, 2018
369b3ea
the cbexplore approach seems not working, as the first stage cannot p…
zcc1307 Feb 9, 2018
8f096a5
.
zcc1307 Feb 9, 2018
904134f
properly store the temp labels
zcc1307 Feb 12, 2018
e271344
back
zcc1307 Feb 12, 2018
8879525
.
zcc1307 Feb 12, 2018
ced4bbd
fixed the bug with assigning cb label before cost sensitive predictio…
zcc1307 Feb 13, 2018
ac71d8d
the cumulative cost become diverse
zcc1307 Feb 13, 2018
9debba8
modified csoaa so that it can take example weights now.
zcc1307 Feb 13, 2018
e295aff
.
zcc1307 Feb 16, 2018
ed2f2bf
added some results of warm starting
zcc1307 Feb 16, 2018
0da506a
added some results of warm starting
zcc1307 Feb 16, 2018
122c8a3
before modifying cbify adf code
zcc1307 Feb 19, 2018
c01f8cc
start modifying cbify adf code
zcc1307 Feb 19, 2018
0d4d633
unkwown segfault error
zcc1307 Feb 21, 2018
ded8f53
everything good except for the cost sensitive learn part
zcc1307 Feb 21, 2018
68d8600
.
zcc1307 Feb 22, 2018
aace037
.
zcc1307 Feb 22, 2018
41127f8
fixed the bug of empty example cost wrongly set
zcc1307 Feb 23, 2018
94c8103
fixed the bug of empty example cost wrongly set
zcc1307 Feb 26, 2018
0a25495
partially fix the importance weight issue
zcc1307 Feb 28, 2018
46d91c0
fixed memory leak bug
zcc1307 Feb 28, 2018
fad3955
start changing the sample size paramters
zcc1307 Mar 2, 2018
1351a31
adding the bandit period as an explicit option
zcc1307 Mar 2, 2018
f921051
merged with adf_modification
zcc1307 Mar 2, 2018
e7384bb
file reorg
zcc1307 Mar 6, 2018
630fd5f
tweak the python script
zcc1307 Mar 9, 2018
a7d5360
added scatterplot script
zcc1307 Mar 13, 2018
601a756
resolved conflicts by accepting ours
zcc1307 Mar 13, 2018
f2f9bb6
retracted the matplotlib inclusion
zcc1307 Mar 15, 2018
8298ec6
.
zcc1307 Mar 15, 2018
543bab9
.
zcc1307 Mar 16, 2018
c9beeb0
regexp based line parsing for vw output (not tested yet)
zcc1307 Mar 19, 2018
2343af4
.
zcc1307 Mar 19, 2018
32d33ba
.
zcc1307 Mar 20, 2018
f1355b7
tweaked the scripts
zcc1307 Apr 2, 2018
caac66e
.
zcc1307 Apr 2, 2018
9a4eef5
.
zcc1307 Apr 3, 2018
b30d987
label corruption code
zcc1307 Apr 3, 2018
6735a02
supervised dataset validation
zcc1307 Apr 3, 2018
024d9cc
lambda script
zcc1307 Apr 3, 2018
bd5fe57
weighting scheme
zcc1307 Apr 3, 2018
e3cda02
Merge branch 'master' of github.com:zcc1307/vowpal_wabbit
zcc1307 Apr 3, 2018
3f64541
.
zcc1307 Apr 3, 2018
87f9afa
start properly copying the examples
zcc1307 Apr 6, 2018
2e10698
Merge branch 'master' of https://github.com/zcc1307/vowpal_wabbit
zcc1307 Apr 6, 2018
4b54dc0
model is not updating in the supervised phase
zcc1307 Apr 6, 2018
5e993af
change to using proper copy example functions. Memory leak issues per…
zcc1307 Apr 7, 2018
24c79e8
.
zcc1307 Apr 9, 2018
502d593
updated the lambda tuning scheme
zcc1307 Apr 10, 2018
b06e454
.
zcc1307 Apr 12, 2018
1922659
fixed bug on zero warm start examples on small datasets
zcc1307 Apr 12, 2018
f6539b5
added a refined weighting scheme and cumulative var calculation (not …
zcc1307 Apr 24, 2018
b471ddb
warm start = 0 does not work
zcc1307 Apr 27, 2018
6259c67
fixed the csl label zero problem - now the label is set properly: 1,2…
zcc1307 Apr 29, 2018
c330450
.
zcc1307 Apr 29, 2018
6fa0031
make the lambda weighting more modular
zcc1307 Apr 29, 2018
7240acb
make adf modular
zcc1307 Apr 30, 2018
621b392
the version where there is an error on memory free
zcc1307 Apr 30, 2018
d1fbfd7
finished cleanup (need to double check the cb label swap in the adf c…
zcc1307 Apr 30, 2018
6bddc96
adjusted the output of the script so that it is more systematic
zcc1307 Apr 30, 2018
f529db0
a more complete summary file
zcc1307 Apr 30, 2018
e84c7d9
bring back the pairwise comparison plot
zcc1307 May 2, 2018
7e6b889
added type 3 noise
zcc1307 May 5, 2018
6f7fc00
(warm start type = 2, adf) setting gives wrong results
zcc1307 May 7, 2018
1a5b3e0
(warm start type = 2, adf) setting gives wrong results
zcc1307 May 7, 2018
9e431ed
fixed the place of weight multiplier calculation
zcc1307 May 7, 2018
d157858
merged
zcc1307 May 7, 2018
bc94f6c
force the changes
zcc1307 May 7, 2018
1bab4c3
before modifying the baseline of no update
zcc1307 May 8, 2018
0f6e8db
a new parameter enumeration scheme
zcc1307 May 9, 2018
a32c2e7
.
zcc1307 May 11, 2018
4ab1d8c
.
zcc1307 May 11, 2018
5d7dc31
updated scripts
zcc1307 May 21, 2018
a4fb02f
cleaned up the run vw script; need more tests on more choices of para…
zcc1307 May 21, 2018
f8d14ab
fixed memory lost problems; still reachable problems still not resolved
zcc1307 May 25, 2018
67ffd89
started cleaning up the cost-sensitive mc to cs conversion
zcc1307 May 28, 2018
7b6e2ba
begin changing the cb learning w/o adf part
zcc1307 May 28, 2018
8fce742
finished cleaning up the no adf part
zcc1307 May 28, 2018
0f3b946
before cleaning up adf
zcc1307 May 29, 2018
cf3b488
mwt explorer kept outputting action 0
zcc1307 May 29, 2018
e9ec432
roll back to a state before reorg that is working
zcc1307 May 29, 2018
b60e872
intermediate state
zcc1307 May 29, 2018
df4267d
fixed a problem in noadf:lambda selection now happens before update
zcc1307 May 29, 2018
a350e0a
there is still a memory leak issue for ecs[0].pred.a_s
zcc1307 Jun 5, 2018
f7f1366
lines for respective validation methods
zcc1307 Jun 6, 2018
9d6a364
commented out matplotlib
zcc1307 Jun 6, 2018
a47aba8
commented out matplotlib
zcc1307 Jun 6, 2018
b4d87e0
rename running script
zcc1307 Jun 8, 2018
19c161c
trial on compiling vw in one of the subtasks
zcc1307 Jun 8, 2018
405622d
before merging
zcc1307 Jun 11, 2018
e2502f6
in the middle of merging
zcc1307 Jun 12, 2018
ed980e3
cleaned up all errors except for calling cost sensitive learning
zcc1307 Jun 23, 2018
36b174a
incorporating multi_ex
zcc1307 Jul 5, 2018
4c3eed3
fixed offset bugs in cb_explore and multiline_predict_or_learn
zcc1307 Jul 9, 2018
8117896
fixed error on split/nosplit swapping
zcc1307 Jul 10, 2018
e12a8da
fixed all memory leaks in warm start ground truth
zcc1307 Jul 14, 2018
4e639bc
fixed memory leaks in supervised ground truth
zcc1307 Jul 14, 2018
6540308
added cbify warm start test cases
zcc1307 Jul 16, 2018
be93a25
removed unnecessary include path prefix
zcc1307 Jul 16, 2018
5fa45cb
Merge branch 'master' into cbify_ws
zcc1307 Jul 18, 2018
2020c50
Merge branch 'master' into cbify_ws
JohnLangford Jul 18, 2018
8a51d16
cleaning up script
zcc1307 Jul 23, 2018
24648e2
Merge branch 'cbify_ws' of github.com:zcc1307/vowpal_wabbit into cbif…
zcc1307 Jul 23, 2018
f95d154
finished updating the running vw script
zcc1307 Jul 23, 2018
558f1a2
.
zcc1307 Aug 6, 2018
648f0d9
removed running scripts
zcc1307 Aug 6, 2018
5561a12
removed spurious changes
zcc1307 Aug 6, 2018
6069739
removed spurious changes
zcc1307 Aug 6, 2018
d9573e1
undoing the weight scaling by 1/k in mtr
zcc1307 Aug 6, 2018
01bf93e
updated tests
zcc1307 Aug 6, 2018
83da642
added warm_cb as a separate file
zcc1307 Aug 6, 2018
3f03785
.
zcc1307 Aug 6, 2018
452e4aa
removed part on non-adf
zcc1307 Aug 6, 2018
aa9e9f7
redoing the importance weight scaling by a factor of 1/k
zcc1307 Aug 6, 2018
52439aa
.
zcc1307 Aug 6, 2018
2f146e7
Merge branch 'master' into cbify_ws
zcc1307 Aug 6, 2018
e5db844
comma typo
zcc1307 Aug 6, 2018
4f12bb6
Merge branch 'cbify_ws' of github.com:zcc1307/vowpal_wabbit into cbif…
zcc1307 Aug 6, 2018
2011b7a
removed redundant comments
zcc1307 Aug 16, 2018
24f970c
resolve conflicts
zcc1307 Feb 7, 2019
4d8811d
resolve conflicts
zcc1307 Feb 7, 2019
7bc56af
compile error on peeking epsilon in warm_cb.cc
zcc1307 Feb 7, 2019
4971477
fixed sim-bandit option, disallow cost-sensitive corruption
zcc1307 Feb 7, 2019
db1da5e
begin fixing importance weight in cs examples
zcc1307 Feb 8, 2019
12b36b9
revert cost_sensitive.cc
zcc1307 Feb 8, 2019
1c0400b
fixed the weighting issue in cs examples
zcc1307 Feb 8, 2019
0e3b7bc
.
zcc1307 Feb 8, 2019
63d8c40
edited vw_core.vcxproj
zcc1307 Feb 8, 2019
99d642b
added new warm cb test cases
zcc1307 Feb 8, 2019
217ee32
resolve test case conflict
zcc1307 Feb 8, 2019
6cf41b6
Merge branch 'master' of github.com:VowpalWabbit/vowpal_wabbit into c…
zcc1307 Feb 25, 2019
3ad0f7b
overwrote regcb test results, as we further divide importance weights…
zcc1307 Feb 25, 2019
2fa610e
corrected a mistake in new regcb test result
zcc1307 Feb 25, 2019
5775bd6
Merge branch 'master' into cbify_ws
JohnLangford Mar 5, 2019
753d885
Merge branch 'master' into cbify_ws
zcc1307 Mar 20, 2019
5e923d8
reorder reduction stack
zcc1307 Mar 20, 2019
35d9ab0
Merge branch 'master' into cbify_ws
jackgerrits Mar 20, 2019
c71d3e3
changed the weight scaling back without 1/K; changed the central valu…
zcc1307 Mar 27, 2019
94c7147
Merge branch 'master' into cbify_ws
zcc1307 Mar 27, 2019
a7408f0
resolve conflict on test data
zcc1307 Mar 27, 2019
3df666e
resolve conflict on test data
zcc1307 Mar 27, 2019
13bf77c
changed back regcbopt test results; undo changes in cb_adf.cc
zcc1307 Mar 27, 2019
cca8449
Merge branch 'master' into cbify_ws
JohnLangford Apr 1, 2019
5776849
Merge branch 'master' into cbify_ws
zcc1307 Apr 2, 2019
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
32 changes: 32 additions & 0 deletions test/RunTests
Original file line number Diff line number Diff line change
Expand Up @@ -1647,3 +1647,35 @@ echo "1 | feature:1" | {VW} -a --initial_weight 0.1 --initial_t 0.3
# Test 175: cbify ldf, regcbopt
{VW} -d train-sets/cs_test.ldf --cbify_ldf --cb_type mtr --regcbopt --mellowness 0.01
train-sets/ref/cbify_ldf_regcbopt.stderr

# Test 176 cb_adf, sharedfeatures
{VW} --dsjson --cb_adf -d train-sets/no_shared_features.json
train-sets/ref/no_shared_features.stderr

# Test 177 warm_cb warm start
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 3 --interaction 7 --choices_lambda 8 --warm_start_update --interaction_update -d train-sets/multiclass
train-sets/ref/warm_cb.stderr

# Test 178 warm_cb warm start with lambda set containing 0/1
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 3 --interaction 7 --choices_lambda 8 --lambda_scheme 2 --warm_start_update --interaction_update -d train-sets/multiclass
train-sets/ref/warm_cb_lambda_zeroone.stderr

# Test 179 warm_cb warm start with warm start update turned off
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 3 --interaction 7 --choices_lambda 8 --interaction_update -d train-sets/multiclass
train-sets/ref/warm_cb_no_ws_upd.stderr

# Test 180 warm_cb warm start with interaction update turned off
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.0 --warm_start 3 --interaction 7 --choices_lambda 8 --warm_start_update -d train-sets/multiclass
train-sets/ref/warm_cb_no_int_upd.stderr

# Test 181 warm_cb warm start with bandit warm start type (Sim-Bandit)
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 3 --interaction 7 --choices_lambda 1 --warm_start_update --interaction_update --sim_bandit -d train-sets/multiclass
train-sets/ref/warm_cb_simbandit.stderr

# Test 182 warm_cb warm start with CYC supervised corruption
{VW} --warm_cb 10 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 3 --interaction 7 --choices_lambda 8 --warm_start_update --interaction_update --corrupt_type_warm_start 2 --corrupt_prob_warm_start 0.5 -d train-sets/multiclass
train-sets/ref/warm_cb_cyc.stderr

# Test 183 warm_cb warm start with input cost-sensitive examples
{VW} --warm_cb 3 --cb_explore_adf --cb_type mtr --epsilon 0.05 --warm_start 1 --interaction 2 --choices_lambda 8 --warm_start_update --interaction_update --warm_cb_cs -d train-sets/cs_cb
train-sets/ref/warm_cb_cs.stderr
6 changes: 3 additions & 3 deletions test/train-sets/ref/cbify_regcb.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 1 1.0 1 5 2
1.000000 1.000000 2 2.0 2 10 2
0.750000 0.500000 4 4.0 4 7 2
0.750000 0.750000 8 8.0 8 4 2
0.750000 0.500000 4 4.0 4 8 2
0.875000 1.000000 8 8.0 8 4 2

finished run
number of examples = 10
weighted example sum = 10.000000
weighted label sum = 0.000000
average loss = 0.800000
average loss = 0.900000
total feature number = 20
8 changes: 4 additions & 4 deletions test/train-sets/ref/cbify_regcbopt.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 1 1.0 1 5 2
1.000000 1.000000 2 2.0 2 9 2
1.000000 1.000000 4 4.0 4 7 2
0.875000 0.750000 8 8.0 8 4 2
1.000000 1.000000 2 2.0 2 10 2
0.750000 0.500000 4 4.0 4 7 2
0.750000 0.750000 8 8.0 8 4 2

finished run
number of examples = 10
weighted example sum = 10.000000
weighted label sum = 0.000000
average loss = 0.900000
average loss = 0.800000
total feature number = 20
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 4 1.0 4 3 2
1.000000 1.000000 5 2.0 5 3 2
1.000000 1.000000 7 4.0 7 3 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 1.000000
total feature number = 20
average variance estimate = 171.578140
theoretical average variance = 200.000000
last lambda chosen = 0.031250 among lambdas ranging from 0.031250 to 0.937500
21 changes: 21 additions & 0 deletions test/train-sets/ref/warm_cb_cs.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/cs_cb
num sources = 1
average since example example current current current
loss last counter weight label predict features
0.000000 0.000000 2 1.0 known 2 4
0.000000 0.000000 3 2.0 known 2 4

finished run
number of examples = 3
weighted example sum = 2.000000
weighted label sum = 0.000000
average loss = 0.000000
total feature number = 12
average variance estimate = 1.034483
theoretical average variance = 60.000000
last lambda chosen = 0.031250 among lambdas ranging from 0.031250 to 0.937500
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb_cyc.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
0.000000 0.000000 4 1.0 4 4 2
0.500000 1.000000 5 2.0 5 4 2
0.750000 1.000000 7 4.0 7 3 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 0.857143
total feature number = 20
average variance estimate = 143.156311
theoretical average variance = 200.000000
last lambda chosen = 0.937500 among lambdas ranging from 0.031250 to 0.937500
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb_lambda_zeroone.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 4 1.0 4 3 2
1.000000 1.000000 5 2.0 5 9 2
0.750000 0.500000 7 4.0 7 7 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 0.857143
total feature number = 20
average variance estimate = 60.903835
theoretical average variance = 200.000000
last lambda chosen = 0.000000 among lambdas ranging from 0.000000 to 1.000000
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb_no_int_upd.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 4 1.0 4 3 2
1.000000 1.000000 5 2.0 5 3 2
1.000000 1.000000 7 4.0 7 3 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 1.000000
total feature number = 20
average variance estimate = 1.000000
theoretical average variance = inf
last lambda chosen = 0.000000 among lambdas ranging from 0.000000 to 0.000000
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb_no_ws_upd.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 4 1.0 4 5 2
1.000000 1.000000 5 2.0 5 9 2
0.750000 0.500000 7 4.0 7 7 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 0.714286
total feature number = 20
average variance estimate = 7.512840
theoretical average variance = 200.000000
last lambda chosen = 1.000000 among lambdas ranging from 1.000000 to 1.000000
22 changes: 22 additions & 0 deletions test/train-sets/ref/warm_cb_simbandit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/multiclass
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 4 1.0 4 7 2
1.000000 1.000000 5 2.0 5 1 2
0.750000 0.500000 7 4.0 7 10 2

finished run
number of examples = 10
weighted example sum = 7.000000
weighted label sum = 0.000000
average loss = 0.857143
total feature number = 20
average variance estimate = 4.685901
theoretical average variance = 200.000000
last lambda chosen = 0.500000 among lambdas ranging from 0.500000 to 0.500000
4 changes: 2 additions & 2 deletions vowpalwabbit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(vw_all_headers
binary.h nn.h boosting.h ftrl.h no_label.h spanning_tree.h bs.h gd.h noop.h stable_unique.h
cache.h gd_mf.h oaa.h stagewise_poly.h cb_adf.h gd_predict.h OjaNewton.h svrg.h cb_algs.h
gen_cs_example.h parse_args.h topk.h cb_explore_adf.h parse_dispatch_loop.h unique_sort.h
interact.h interactions.h parse_example_json.h cbify.h interactions_predict.h vw_allreduce.h
interact.h interactions.h parse_example_json.h cbify.h warm_cb.h interactions_predict.h vw_allreduce.h
classweight.h parse_regressor.h kernel_svm.h confidence.h label_dictionary.h
config.h.in primitives.h lda_core.h print.h vw_versions.h
)
Expand All @@ -46,7 +46,7 @@ set(vw_all_sources
search_multiclasstask.cc search_entityrelationtask.cc search_graph.cc parse_example.cc scorer.cc
network.cc parse_args.cc accumulate.cc gd.cc learner.cc mwt.cc lda_core.cc gd_mf.cc mf.cc bfgs.cc
noop.cc print.cc example.cc parser.cc loss_functions.cc sender.cc nn.cc confidence.cc bs.cc
cbify.cc explore_eval.cc topk.cc stagewise_poly.cc log_multi.cc recall_tree.cc active.cc
cbify.cc warm_cb.cc explore_eval.cc topk.cc stagewise_poly.cc log_multi.cc recall_tree.cc active.cc
active_cover.cc cs_active.cc kernel_svm.cc best_constant.cc ftrl.cc svrg.cc lrqfa.cc interact.cc
comp_io.cc interactions.cc vw_validate.cc audit_regressor.cc gen_cs_example.cc cb_explore.cc
action_score.cc cb_explore_adf.cc OjaNewton.cc baseline.cc classweight.cc
Expand Down
6 changes: 2 additions & 4 deletions vowpalwabbit/cb_adf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ void learn_MTR(cb_adf& mydata, multi_learner& base, multi_ex& examples)
gen_cs_example_mtr(mydata.gen_cs, examples, mydata.cs_labels);
uint32_t nf = (uint32_t)examples[mydata.gen_cs.mtr_example]->num_features;
float old_weight = examples[mydata.gen_cs.mtr_example]->weight;
examples[mydata.gen_cs.mtr_example]->weight *= 1.f / examples[mydata.gen_cs.mtr_example]->l.cb.costs[0].probability *
((float)mydata.gen_cs.event_sum / (float)mydata.gen_cs.action_sum);
GEN_CS::call_cs_ldf<true>(
base, mydata.gen_cs.mtr_ec_seq, mydata.cb_labels, mydata.cs_labels, mydata.prepped_cs_labels, mydata.offset);
examples[mydata.gen_cs.mtr_example]->weight *= 1.f / examples[mydata.gen_cs.mtr_example]->l.cb.costs[0].probability * ((float)mydata.gen_cs.event_sum / (float)mydata.gen_cs.action_sum) * (1.f / (float)examples.size());
GEN_CS::call_cs_ldf<true>(base, mydata.gen_cs.mtr_ec_seq, mydata.cb_labels, mydata.cs_labels, mydata.prepped_cs_labels, mydata.offset);
Copy link
Contributor Author

@zcc1307 zcc1307 Feb 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am a little confused about this line - what is ((float)mydata.gen_cs.event_sum / (float)mydata.gen_cs.action_sum)? Is it 1/K?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples[mydata.gen_cs.mtr_example]->num_features = nf;
examples[mydata.gen_cs.mtr_example]->weight = old_weight;
swap(examples[0]->pred.a_s, mydata.a_s);
Expand Down
4 changes: 3 additions & 1 deletion vowpalwabbit/cb_explore_adf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ void predict_or_learn_first(cb_explore_adf& data, multi_learner& base, multi_ex&
template <bool is_learn>
void predict_or_learn_greedy(cb_explore_adf& data, multi_learner& base, multi_ex& examples)
{
// Explore uniform random an epsilon fraction of the time.
data.offset = examples[0]->ft_offset;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set something which is never used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we need this additional line - we had an email discussion on this on July 7, 2018:

If we don't have this line, in warm_cb.cc, base.learn(data.adf_data.ecs, 0) / base.learn(data.adf_data.ecs, 1)'s updates seem to be on the same set of weights.

//Explore uniform random an epsilon fraction of the time.

if (is_learn && test_adf_sequence(examples) != nullptr)
multiline_learn_or_predict<true>(base, examples, data.offset);
else
Expand Down
4 changes: 2 additions & 2 deletions vowpalwabbit/cost_sensitive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ void output_example(vw& all, example& ec)
if (chosen_loss == FLT_MAX)
cerr << "warning: csoaa predicted an invalid class. Are all multi-class labels in the {1..k} range?" << endl;

loss = chosen_loss - min;
loss = (chosen_loss - min) * ec.weight;
// TODO(alberto): add option somewhere to allow using absolute loss instead?
// loss = chosen_loss;
}

all.sd->update(ec.test_only, !test_label(&ld), loss, 1.f, ec.num_features);
all.sd->update(ec.test_only, !test_label(&ld), loss, ec.weight, ec.num_features);

for (int sink : all.final_prediction_sink)
if (!all.sd->ldict)
Expand Down
2 changes: 1 addition & 1 deletion vowpalwabbit/learner.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ single_learner* as_singleline(learner<T, E>* l)
template <bool is_learn>
void multiline_learn_or_predict(multi_learner& base, multi_ex& examples, const uint64_t offset, const uint32_t id = 0)
{
std::vector<uint64_t> saved_offsets(examples.size());
std::vector<uint64_t> saved_offsets;
for (auto ec : examples)
{
saved_offsets.push_back(ec->ft_offset);
Expand Down
2 changes: 2 additions & 0 deletions vowpalwabbit/parse_args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ license as described in the file LICENSE.
#include "explore_eval.h"
#include "baseline.h"
#include "classweight.h"
#include "warm_cb.h"
// #include "cntk.h"

#include "options.h"
Expand Down Expand Up @@ -1268,6 +1269,7 @@ void parse_reductions(options_i& options, vw& all)
all.reduction_stack.push_back(mwt_setup);
all.reduction_stack.push_back(cb_explore_setup);
all.reduction_stack.push_back(cb_explore_adf_setup);
all.reduction_stack.push_back(warm_cb_setup);
all.reduction_stack.push_back(cbify_setup);
all.reduction_stack.push_back(cbifyldf_setup);
all.reduction_stack.push_back(explore_eval_setup);
Expand Down
4 changes: 3 additions & 1 deletion vowpalwabbit/vw_core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
<ClInclude Include="gen_cs_example.h" />
<ClInclude Include="cb_adf.h" />
<ClInclude Include="cbify.h" />
<ClInclude Include="warm_cb.h" />
<ClInclude Include="comp_io.h" />
<ClInclude Include="confidence.h" />
<ClInclude Include="constant.h" />
Expand Down Expand Up @@ -269,6 +270,7 @@
<ClCompile Include="cache.cc" />
<ClCompile Include="cb.cc" />
<ClCompile Include="cbify.cc" />
<ClCompile Include="warm_cb.cc" />
<ClCompile Include="cb_explore.cc" />
<ClCompile Include="cb_explore_adf.cc" />
<ClCompile Include="gen_cs_example.cc" />
Expand Down Expand Up @@ -371,4 +373,4 @@
<Error Condition="!Exists('$(SolutionDir)\packages\zlib.v140.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.static.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\zlib.v140.windesktop.msvcstl.static.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.static.rt-dyn.targets'))" />
</Target>
<Import Project="..\sdl\SDL-7.0-NativeAnalysis.targets" />
</Project>
</Project>
Loading