-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_experiments.py
executable file
·36 lines (29 loc) · 1.12 KB
/
run_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
#!/usr/bin/env python3
from itertools import product
import sys
import subprocess
cli_template = "pipenv run signscan cw1 neural-net --classifier={} --model-cache=models {}{}"
latex_template = """
\\begin{{figure}}
\\begin{{Verbatim}}[fontsize=\\scriptsize]
{}
\\end{{Verbatim}}
\\caption{{Sample Output From The {} {} Neural Net With {}}}
\\label{{script:{}-{}-{}}}
\\end{{figure}}
"""
figures = []
for (command, arg), classifier in product((*product(("kfold",), (10,)), *product(("train-test",), (0, 4000, 9000))), ("linear", "multilayer")):
if command == "kfold":
cli = cli_template.format(classifier, command, f" --splits={arg}")
description = f"{arg} Folds"
elif command == "train-test":
cli = cli_template.format(classifier, command, f" cw2 --train-data-offset={arg}")
description = f"{arg} Moved To Test Set"
else:
sys.exit(1)
out = subprocess.check_output(cli.split(" "))
print(latex_template.format(
out.decode('utf8'), classifier.capitalize(), command.capitalize(), description,
classifier, command, description.replace(" ", "-").lower()
))