-
Notifications
You must be signed in to change notification settings - Fork 22
/
exp_configs.py
131 lines (111 loc) · 5.3 KB
/
exp_configs.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from haven import haven_utils as hu
import itertools
# datasets
kernel_datasets = ["mushrooms",
# "w8a", "ijcnn",
# "rcv1"
]
# define runs
run_list = [0]
# define optimizers
c_list = [0.2]
sps_list = []
for c, adapt_flag in itertools.product(c_list, ['smooth_iter']):
sps_list += [{'name':"sps", "c":c, 'adapt_flag':adapt_flag}]
opt_list = sps_list + [{'name': 'adam'}]
EXP_GROUPS = {}
# define interpolation exp groups
EXP_GROUPS['kernel'] = hu.cartesian_exp_group({"dataset":kernel_datasets,
"model":["linear"],
"loss_func": ['logistic_loss'],
"acc_func": ["logistic_accuracy"],
"opt": opt_list ,
"batch_size":[100],
"max_epoch":[35],
"runs":run_list})
EXP_GROUPS['mf'] = hu.cartesian_exp_group({"dataset":["matrix_fac"],
"model":["matrix_fac_1", "matrix_fac_4", "matrix_fac_10", "linear_fac"],
"loss_func": ["squared_loss"],
"opt": opt_list,
"acc_func":["mse"],
"batch_size":[100],
"max_epoch":[50],
"runs":run_list})
EXP_GROUPS['mnist'] = hu.cartesian_exp_group({"dataset":["mnist"],
"model":["mlp"],
"loss_func": ["softmax_loss"],
"opt":[{'name':"sps", "c":c,
'adapt_flag':'smooth_iter',
'centralize_grad':True}] + opt_list,
"acc_func":["softmax_accuracy"],
"batch_size":[128],
"max_epoch":[200],
"runs":run_list})
EXP_GROUPS['deep'] = (hu.cartesian_exp_group({"dataset":["cifar10"],
"model":["resnet34", "densenet121"],
"loss_func": ["softmax_loss"],
"opt": opt_list,
"acc_func":["softmax_accuracy"],
"batch_size":[128],
"max_epoch":[200],
"runs":run_list}) +
hu.cartesian_exp_group({"dataset":["cifar100"],
"model":["resnet34_100", "densenet121_100"],
"loss_func": ["softmax_loss"],
"opt": opt_list,
"acc_func":["softmax_accuracy"],
"batch_size":[128],
"max_epoch":[200],
"runs":run_list})
)
EXP_GROUPS['cifar'] = hu.cartesian_exp_group({"dataset":["cifar10"],
"model":["resnet34"],
"loss_func": ["softmax_loss"],
"opt": opt_list + [{'name':"sps", "c":c,
'adapt_flag':'smooth_iter',
'centralize_grad':True}] ,
"acc_func":["softmax_accuracy"],
"batch_size":[128],
"max_epoch":[200],
"runs":[0]})
# define non-interpolation exp groups
eta_max_list = [1, 5, 100]
c_list = [0.5]
sps_l2_list = []
for c, eta_max in itertools.product(c_list, eta_max_list):
sps_l2_list += [{'name':"sps", "c":c,
'fstar_flag':True, 'eps':0,
'adapt_flag':'constant',
'eta_max':eta_max}]
sps_list = []
for c, eta_max in itertools.product(c_list, eta_max_list):
sps_list += [{'name':"sps", "c":c,
'fstar_flag':False, 'eps':0,
'adapt_flag':'constant',
'eta_max':eta_max}]
sgd_list = [{'name':"sgd",
"lr":10.0},{'name':"sgd",
"lr":1.0}, {'name':"sgd",
"lr":1e-3}, {'name':"sgd",
"lr":1e-1}, {'name':"sgd",
"lr":1e-2}]
EXP_GROUPS['syn_l2'] = (hu.cartesian_exp_group({"dataset":['syn'],
"model":["logistic"],
"loss_func": [
'logistic_l2_loss',
],
"acc_func": ["logistic_accuracy"],
"opt": sps_l2_list + sgd_list,
"batch_size":[1],
"max_epoch":[50],
"runs":run_list}))
EXP_GROUPS['syn'] = (hu.cartesian_exp_group({"dataset":['syn'],
"model":["logistic"],
"loss_func": [
'logistic_loss',
],
"acc_func": ["logistic_accuracy"],
"opt": sps_list + sgd_list,
"batch_size":[1],
"max_epoch":[50],
"runs":run_list}))