-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_smc_benchmark.py
More file actions
57 lines (47 loc) · 1.5 KB
/
run_smc_benchmark.py
File metadata and controls
57 lines (47 loc) · 1.5 KB
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
import subprocess
import sys
from bcolors import bcolors
with open("evaluation/smc_results.csv", "w") as f:
f.write("model,n_data,n_particles,none,static,rel_static\n")
filenames = [
# "aircraft.jl",
# "bayesian_network.jl",
# "captcha.jl",
"dirichlet_process.jl",
# "geometric.jl",
"gmm_fixed_numclust.jl",
"gmm_variable_numclust.jl",
"hmm.jl",
# "hurricane.jl",
"lda_fixed_numtopic.jl",
"lda_variable_numtopic.jl",
# "linear_regression.jl",
# "marsaglia.jl",
# "pcfg.jl",
# "pedestrian.jl",
# "urn.jl"
]
filenames_unrolled = [
# "gmm_fixed_numclust.jl",
"hmm.jl",
# "lda_fixed_numtopic.jl",
# "linear_regression.jl",
]
N_repetitions = int(sys.argv[1])
for i in range(N_repetitions):
for filename in filenames:
print(bcolors.HEADER + filename + bcolors.ENDC)
cmd = ["julia", "--project=.", "evaluation/bench_smc.jl", "benchmark", filename]
subprocess.run(cmd, capture_output=False)
print()
print("\nUnrolled programs:\n")
for filename in filenames_unrolled:
print(bcolors.HEADER + filename + bcolors.ENDC)
cmd = ["julia", "--project=.", "evaluation/bench_smc.jl", "unrolled", filename]
subprocess.run(cmd, capture_output=False)
print()
import pandas as pd
df = pd.read_csv("evaluation/smc_results.csv")
avg_df = df.groupby("model").median()
avg_df = avg_df.reset_index()
avg_df.to_csv("evaluation/smc_results_aggregated.csv", index=False, sep=",", na_rep="NA")