-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_test.py
128 lines (83 loc) · 4.45 KB
/
run_test.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
import os
import subprocess
dimension = [4, 8, 16, 32, 64]
dataset = ["cora", "pubmed", "airport"]
params = ["Euclidean", "PoincareBall", "Spherical", "S1S1", "P1P1", "S1P1", \
"S1S1P1P1", "S2P1P1", "S1S1P2"]
tasks = ["nc", "lp"]
def run_test():
for task in tasks:
for dim in dimension:
for data in dataset:
for param in params:
command = "python3 train.py --task %s --dataset %s --model HypGCN --lr 0.01 --dim %d --num-layers 2 --act relu --bias 0 --dropout 0.5 --weight-decay 0.001 --manifold %s --log-freq 5 --cuda -1 --c 1" % (task, data, dim, param)
print(command)
process = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
stdout, stderr = process.communicate()
process.wait()
prefix = task + "_" + data + "_" + str(dim)+ "_" + param
stdout_name = prefix + ".out"
stderr_name = prefix + ".err"
with open(stdout_name, "w") as out, open(stderr_name, "w") as err:
out.write(stdout.decode("utf-8"))
err.write(stderr.decode("utf-8"))
def run_dummy_test():
task = "nc"
data = "cora"
dim = 4
param = "Euclidean"
command = "python3 train.py --task %s --dataset %s --model HypGCN --lr 0.01 --dim %d --num-layers 2 --act relu --bias 0 --dropout 0.5 --weight-decay 0.001 --manifold %s --log-freq 5 --cuda -1 --c 1" % (task, data, dim, param)
print(command)
process = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
stdout, stderr = process.communicate()
process.wait()
prefix = task + "_" + data + "_" + str(dim)+ "_" + "param"
stdout_name = prefix + ".out"
stderr_name = prefix + ".err"
with open(stdout_name, "w") as out, open(stderr_name, "w") as err:
out.write(str(stdout))
err.write(str(stderr))
def run_disease():
for task in ["lp"]:
for dim in dimension:
for param in params:
if task == 'nc':
data = 'disease_nc'
else:
data = 'disease_lp'
command = "python3 train.py --task %s --dataset %s --model HypGCN --lr 0.01 --dim %d --num-layers 2 --act relu --bias 0 --dropout 0.5 --weight-decay 0.001 --manifold %s --log-freq 5 --cuda -1 --c 1" % (task, data, dim, param)
print(command)
process = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
stdout, stderr = process.communicate()
process.wait()
prefix = task + "_" + data + "_" + str(dim)+ "_" + param
stdout_name = prefix + ".out"
stderr_name = prefix + ".err"
with open(stdout_name, "w") as out, open(stderr_name, "w") as err:
out.write(stdout.decode("utf-8"))
err.write(stderr.decode("utf-8"))
params2 = ["E1S1","E1P1", "E1P2S1", "E1P1S2", "E2P1P1", "E2S1S1"]
def run_Euclidean():
dataset.append("disease_lp")
for task in tasks:
for dim in [16]:
for data in dataset:
if task == "nc" and data == "disease_lp":
pass
for param in params2:
command = "python3 train.py --task %s --dataset %s --model HypGCN --lr 0.01 --dim %d --num-layers 2 --act relu --bias 0 --dropout 0.5 --weight-decay 0.001 --manifold %s --log-freq 5 --cuda -1 --c 1" % (task, data, dim, param)
print(command)
process = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
stdout, stderr = process.communicate()
process.wait()
prefix = task + "_" + data + "_" + str(dim)+ "_" + param
stdout_name = prefix + ".out"
stderr_name = prefix + ".err"
with open(stdout_name, "w") as out, open(stderr_name, "w") as err:
out.write(stdout.decode("utf-8"))
err.write(stderr.decode("utf-8"))
if __name__ == "__main__":
#run_dummy_test()
#run_test()
run_disease()
run_Euclidean()