-
Notifications
You must be signed in to change notification settings - Fork 0
/
runExperiments.py
193 lines (130 loc) · 5.6 KB
/
runExperiments.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import tensorflow as tf
import trainBatchNorm
import inspect, sys
FLAGS = tf.app.flags.FLAGS
def set_flags(FLAGS, n_layers, epochs, state_cells, dropout, tie_weights):
FLAGS.n_layers = n_layers
FLAGS.n_epochs = epochs
FLAGS.size = state_cells
FLAGS.dropout = dropout
FLAGS.tie_weights = tie_weights
################################################################### EXPERIMENT 1
def exp1_10layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 10, 100, 1, False)
def exp1_20layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 10, 100, 1, False)
def exp1_30layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 10, 100, 1, False)
def exp1_10layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 20, 100, 1, False)
def exp1_20layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 20, 100, 1, False)
def exp1_30layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 20, 100, 1, False)
def exp1_10layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 10, 200, 1, False)
def exp1_20layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 10, 200, 1, False)
def exp1_30layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 10, 200, 1, False)
def exp1_10layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 20, 200, 1, False)
def exp1_20layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 20, 200, 1, False)
def exp1_30layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 20, 200, 1, False)
################################################################### EXPERIMENT 2
def exp2_10layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 10, 100, 0.5, False)
def exp2_20layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 10, 100, 0.5, False)
def exp2_30layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 10, 100, 0.5, False)
def exp2_10layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 20, 100, 0.5, False)
def exp2_20layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 20, 100, 0.5, False)
def exp2_30layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 20, 100, 0.5, False)
def exp2_10layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 10, 200, 0.5, False)
def exp2_20layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 10, 200, 0.5, False)
def exp2_30layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 10, 200, 0.5, False)
def exp2_10layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 20, 200, 0.5, False)
def exp2_20layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 20, 200, 0.5, False)
def exp2_30layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 20, 200, 0.5, False)
################################################################### EXPERIMENT 3
def exp3_10layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 10, 100, 0.5, True)
def exp3_20layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 10, 100, 0.5, True)
def exp3_30layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 10, 100, 0.5, True)
def exp3_10layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 20, 100, 0.5, True)
def exp3_20layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 20, 100, 0.5, True)
def exp3_30layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 20, 100, 0.5, True)
def exp3_10layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 10, 200, 0.5, True)
def exp3_20layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 10, 200, 0.5, True)
def exp3_30layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 10, 200, 0.5, True)
def exp3_10layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 20, 200, 0.5, True)
def exp3_20layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 20, 200, 0.5, True)
def exp3_30layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 20, 200, 0.5, True)
################################################################### EXPERIMENT 4
def exp4_10layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 10, 100, 1, True)
def exp4_20layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 10, 100, 1, True)
def exp4_30layers_10epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 10, 100, 1, True)
def exp4_10layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 10, 20, 100, 1, True)
def exp4_20layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 20, 20, 100, 1, True)
def exp4_30layers_20epochs_100statecells(FLAGS):
set_flags(FLAGS, 30, 20, 100, 1, True)
def exp4_10layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 10, 200, 1, True)
def exp4_20layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 10, 200, 1, True)
def exp4_30layers_10epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 10, 200, 1, True)
def exp4_10layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 10, 20, 200, 1, True)
def exp4_20layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 20, 20, 200, 1, True)
def exp4_30layers_20epochs_200statecells(FLAGS):
set_flags(FLAGS, 30, 20, 200, 1, True)
################################################################## MAIN FUNCTION
def get_experiments(regex):
experiments = [obj for name,obj in inspect.getmembers(
sys.modules[__name__])
if (inspect.isfunction(obj) and
regex in name)]
return experiments
tf.app.flags.DEFINE_string("run_experiments", '',
"What experiments to runi.")
def main(_):
experiments = get_experiments(FLAGS.run_experiments)
for e in experiments:
e(FLAGS)
print(("n_layers: {}, n_epochs: {}, size: {}, " +
"dropout: {}, tie: {}").format(
FLAGS.n_layers, FLAGS.n_epochs, FLAGS.size,
FLAGS.dropout, FLAGS.tie_weights))
trainBatchNorm.train(False)
if __name__ == '__main__':
tf.app.run()