-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
73 lines (55 loc) · 1.93 KB
/
run.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
# Run main in a loop
import constants
import os
import main
import json
import time
from utils.aggregator import aggregate_all
from utils.aggregator import clear_all
epochs = [1,20,40,60,80,100,150,200]
#David's run 1
# thresholds = [100,500]
# num_neurons = [5,10]
# latent_dims = [2,5]
#David's run 2
#thresholds = [100,500]
#num_neurons = [50]
#latent_dims = [2,5,10,50]
#David's run 3
thresholds = [890]#,500]
num_neurons = [30]
latent_dims = [2]#,5,10,50]
#Asia run 1
#thresholds=[1500]
#num_neurons=[5,10]
#latent_dims=[2,5]
#asia run 2
#thresholds=[1500]
#num_neurons = [50]
#latent_dims = [2,5,10,50]
#asia run 3
#thresholds=[1500]
#num_neurons = [100]
#latent_dims = [2,5,10,50]
clear_all(latent_dims, thresholds, num_neurons)
rows_output=[]
for d in latent_dims:
for t in thresholds:
for n in num_neurons:
if n < d: continue
##result proc
results = main.run(var_th_index=t,number_of_neurons=n, latent_dim=d, num_of_epochs=epochs)
with open(os.path.join(constants.OUTPUT_GLOBAL_DIR, "results_{}_{}_{}.txt".format(d,t,n)),'a+') as f:
f.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format("threshold", "number_of_neurons", "latent_dims", "epochs", "type", "average", "variance", "loss", "val_loss"))
for cur_line in results:
cur_row = str(t)+"\t"+str(n)+"\t"+str(d)+"\t"
method = cur_line['type']
avg = cur_line['avg']
var = cur_line['var']
e = cur_line.get('epochs'," " )
results = cur_line['results']
loss=cur_line.get('loss', " ")
val_loss =cur_line.get('val_loss', " ")
cur_row += (str(e)+'\t'+method +'\t'+str(avg)+'\t'+str(var)+"\t"+str(loss)+"\t"+str(val_loss)+"\t"+results+'\n')
f.write(cur_row)
aggregate_all(latent_dims, thresholds, num_neurons,time.time())