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

feat: Added the parameter-free online learning algorithm FreeGrad #3067

Merged
merged 32 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7747857
Added the parameter-free online algorithm FreeGrad
zmhammedi Jun 14, 2021
e0e8ba9
Fixed float overflow in FreeGrad calculations
zmhammedi Jun 14, 2021
a9dc2f9
added missing line in parse_args.cc
zmhammedi Jun 14, 2021
e376bad
Changed the freegrad option to lower case
zmhammedi Jun 15, 2021
acaecd6
tracking the value of the parameters
zmhammedi Jun 16, 2021
2c8b3ba
modified the freegrad prediction to match eq 9 in the pap
zmhammedi Jun 16, 2021
58634e4
Merge branch 'master' into master
zmhammedi Jun 17, 2021
12914e9
renamed a freegrad option
zmhammedi Jun 18, 2021
bc5786c
Merge branch 'master' of https://github.com/zmhammedi/vowpal_wabbit
zmhammedi Jun 18, 2021
a46ed67
dealing with importance weights properly
zmhammedi Jun 18, 2021
05957a9
Merge branch 'master' into master
lalo Jul 20, 2021
eae4048
Update vowpalwabbit/freegrad.cc
jackgerrits Nov 19, 2021
5da9941
Update vowpalwabbit/freegrad.cc
jackgerrits Nov 19, 2021
dd4798a
Merge branch 'master' into zmhammedi/master
jackgerrits Nov 19, 2021
309cf68
add tests, format, cleanup, integrate code changes
jackgerrits Nov 19, 2021
c6153e9
Fix test, add wiki link and fix option group name
jackgerrits Nov 19, 2021
7aa392c
Fix test
jackgerrits Nov 19, 2021
6b48271
Merge branch 'master' into zmhammedi/master
jackgerrits Nov 19, 2021
ffcd10b
Formatting
jackgerrits Nov 19, 2021
15cf8fd
update ref
jackgerrits Nov 19, 2021
c461854
Merge branch 'master' into master
jackgerrits Nov 29, 2021
5df5289
warning
jackgerrits Nov 29, 2021
a88fd27
Merge branch 'master' into master
jackgerrits Nov 29, 2021
3f7414f
formatting
jackgerrits Nov 29, 2021
d873444
fix printout, fix test
jackgerrits Nov 29, 2021
aa2fa6a
Merge branch 'master' into zmhammedi/master
jackgerrits Nov 30, 2021
906d943
formatting
jackgerrits Nov 30, 2021
ac73468
warnings
jackgerrits Nov 30, 2021
d92830c
formatting
jackgerrits Nov 30, 2021
be7eaa7
Merge branch 'master' into master
olgavrou Nov 30, 2021
ee66f47
Add missing file header
jackgerrits Dec 1, 2021
1f4cca4
remove commented out code
jackgerrits Dec 1, 2021
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
29 changes: 28 additions & 1 deletion test/core.vwtest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4359,5 +4359,32 @@
"input_files": [
"train-sets/rcv1_multiclass.dat"
]
},
{
"id": 369,
"desc": "Freegrad",
"vw_command": "--freegrad -d train-sets/0001.dat -f models/freegrad.model -k -c --passes 4",
"diff_files": {
"stderr": "train-sets/ref/freegrad.stderr"
},
"input_files": [
"train-sets/0001.dat"
]
},
{
"id": 370,
"desc": "Freegrad load model",
"vw_command": "-d train-sets/0001.dat -i models/freegrad.model -k -t -p freegrad.predict",
"diff_files": {
"stderr": "train-sets/ref/freegrad_load.stderr",
"freegrad.predict": "pred-sets/ref/freegrad.predict"
},
"input_files": [
"train-sets/0001.dat",
"models/freegrad.model"
],
"depends_on": [
369
]
}
]
]
200 changes: 200 additions & 0 deletions test/pred-sets/ref/freegrad.predict
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
1
0
0
0
0
0.965797
0
0
0
0.782102
0
0
0
0
1
1
1
0
0
0.038974
1
1
0
1
0
0
0
0
1
0.377762
1
0
0
0
1
0
1
0
1
0.797009
0
1
0
0
0
0
0.028436
0.010243
1
0.357274
1
1
0
0
0.901110
0.017772
0
0
1
0.170360
1
0
1
0
1
0
0.002721
0
0
0.627691
0
1
1
0
0.994092
1
0
0
0
0.332845
0
0
1
0
0
0
1
1
1
0
0
0.988268
1
0
1
0
1
0
0.856255
0.356337
0
1
0
1
0.005745
1
0
0
0
0.469874
1
0
0
1
0
0
0.820517
1
0.992771
0.126444
0
1
0
1
1
0.972440
0
1
0
0.634233
0
1
0
1
0
0
1
1
1
0.214775
0
0
1
1
1
1
0.966476
1
0
0.156040
1
1
1
0.216000
0
1
1
0
1
0.258705
1
0
0
0.947910
0
1
1
0.033638
1
0.800311
0.868122
0
0
0.984126
0.005594
0
0
1
1
0.710266
0.985484
0.024802
1
0
0
0
1
0
0
0.633951
1
0.030655
0
0
0.006107
1
1
0
0
0.167157
36 changes: 36 additions & 0 deletions test/train-sets/ref/freegrad.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
final_regressor = models/freegrad.model
Enabling FreeGrad based optimization
Algorithm used: FreeGrad
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
decay_learning_rate = 1
creating cache_file = train-sets/0001.dat.cache
Reading datafile = train-sets/0001.dat
num sources = 1
Enabled reductions: freegrad, scorer-identity, count_label
Input label = simple
Output pred = scalar
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 1 1.0 1.0000 0.0000 51
0.570071 0.140141 2 2.0 0.0000 0.3744 104
0.290144 0.010218 4 4.0 0.0000 0.0364 135
0.270084 0.250024 8 8.0 0.0000 0.0000 146
0.295007 0.319929 16 16.0 1.0000 0.0000 143
0.292001 0.288995 32 32.0 1.0000 0.3208 70
0.275237 0.258473 64 64.0 0.0000 0.5163 34
0.258924 0.242611 128 128.0 0.0000 0.2918 30
0.209539 0.209539 256 256.0 0.0000 0.0000 72 h
0.197807 0.186074 512 512.0 0.0000 0.1012 37 h

finished run
number of examples per pass = 180
passes used = 4
weighted example sum = 720.000000
weighted label sum = 320.000000
average loss = 0.159649 h
best constant = 0.444444
best constant's loss = 0.246914
total feature number = 55132
33 changes: 33 additions & 0 deletions test/train-sets/ref/freegrad_load.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
only testing
predictions = freegrad.predict
Enabling FreeGrad based optimization
Algorithm used: FreeGrad
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = train-sets/0001.dat
num sources = 1
Enabled reductions: freegrad, scorer-identity, count_label
Input label = simple
Output pred = scalar
average since example example current current current
loss last counter weight label predict features
0.000000 0.000000 1 1.0 1.0000 1.0000 51
0.000000 0.000000 2 2.0 0.0000 0.0000 104
0.000000 0.000000 4 4.0 0.0000 0.0000 135
0.000146 0.000292 8 8.0 0.0000 0.0000 146
0.003041 0.005935 16 16.0 1.0000 1.0000 24
0.006027 0.009014 32 32.0 0.0000 0.0000 32
0.006277 0.006528 64 64.0 0.0000 0.0000 61
0.011065 0.015854 128 128.0 1.0000 1.0000 106

finished run
number of examples = 200
weighted example sum = 200.000000
weighted label sum = 91.000000
average loss = 0.016990
best constant = 0.455000
best constant's loss = 0.247975
total feature number = 15482
8 changes: 8 additions & 0 deletions test/train-sets/ref/help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,14 @@ Explore Evaluation Options:
Debug: Metrics Options:
--extra_metrics arg Specify filename to write metrics to. Note: There is no
fixed schema
FreeGrad Options:
--freegrad Diagonal FreeGrad Algorithm
--restart Use the FreeRange restarts
--project Project the outputs to adapt to both the lipschitz and
comparator norm
--radius arg Radius of the l2-ball for the projection. If not
supplied, an adaptive radius will be used.
--fepsilon arg (=1, ) Initial wealth
Follow the Regularized Leader Options:
--ftrl FTRL: Follow the Proximal Regularized Leader
--coin Coin betting optimizer
Expand Down
2 changes: 2 additions & 0 deletions vowpalwabbit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ set(vw_all_headers
fast_pow10.h
feature_group.h
ftrl.h
freegrad.h
gd_mf.h
gd_predict.h
gd.h
Expand Down Expand Up @@ -296,6 +297,7 @@ set(vw_all_sources
explore_eval.cc
feature_group.cc
ftrl.cc
freegrad.cc
gd_mf.cc
gd.cc
gen_cs_example.cc
Expand Down
Loading