-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_solver.py
66 lines (43 loc) · 1.29 KB
/
test_solver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from __future__ import division
import pprint
# for debugging
import ipdb
import sys
import traceback
import dcd
import dcd_data
def test_solver():
"""
call dcd and record duality gap
"""
data, task_sim = dcd_data.get_toy_data()
#solver_names = ["finite_diff_primal", "finite_diff_dual", "cvxopt_dual_solver", "dcd", "dcd_shrinking", "dcd_shogun", "mtk_shogun"]
#solver_names = ["finite_diff_primal", "cvxopt_dual_solver", "dcd", "dcd_shrinking", "dcd_shogun", "mtk_shogun"]
#solver_names = ["finite_diff_primal", "cvxopt_dual_solver", "dcd", "dcd_shrinking", "mtk_shogun"]
#solver_names = ["dcd_shogun", "mtk_shogun"]
solver_names = ["dcd_shogun", "mtk_shogun"]
vecs = {}
for sn in solver_names:
solver = dcd.train_mtl_svm(data, task_sim, sn)
print sn
pprint.pprint(solver.W)
vecs[sn] = solver.W
print "="*40
for key, value in vecs.items():
print key
pprint.pprint(value)
def main():
"""
runs experiment in different settings
"""
test_solver()
if __name__ == '__main__':
# enable post-mortem debugging
try:
main()
except:
type, value, tb = sys.exc_info()
traceback.print_exc()
ipdb.post_mortem(tb)
if __name__ == "pyreport.main":
main()