-
Notifications
You must be signed in to change notification settings - Fork 0
/
experiments.py
35 lines (27 loc) · 1.37 KB
/
experiments.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
import subprocess
import itertools
import sys
import os
import hashlib
# parameters to iterate over
cwd = './'
datasets = ['MUTAG', 'CSL', 'PAULUS25', 'BZR', 'IMDBBINARY', 'IMDBMULTI', 'REDDIT-BINARY', 'NCI1', 'ENZYMES', 'DD', 'COLLAB']
executables = ['graph-homomorphism-network/models/feature_extraction.py', ] #'graph-homomorphism-network/models/mlp.py', 'graph-homomorphism-network/models/svm.py']
run_ids = ['run1', 'run2','run3', 'run4', 'run5', 'run6', 'run7', 'run8', 'run9', 'run10']
pattern_counts = [30, ] #10, 50, 100, 200]
hom_types = ['random_ktree'] # 'product_graph_ktree_profile'
# a deterministic hash function returning a 32 bit integer value for a given utf-8 string
hashfct = lambda x: str(int(hashlib.sha1(bytes(x, 'utf-8')).hexdigest(), 16) & 0xFFFFFFFF)
for run_id, dataset, executable, pattern_count, hom_type in itertools.product(run_ids, datasets, executables, pattern_counts, hom_types):
print(f'{run_id}: {dataset} {executable}')
args = ['python', executable,
'--data', dataset,
'--seed', hashfct(run_id),
'--dloc', 'graph-homomorphism-network/data',
'--pattern_count', str(pattern_count),
'--run_id', run_id,
'--hom_type', hom_type,
'--hom_size', '-1',
]
print(args)
subprocess.run(args, cwd=cwd, stdout=sys.stdout, stderr=sys.stderr, check=True)