summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 23:19:13 -0700
committerDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 23:19:13 -0700
commita4c78116861f6d21185d6cc0db777edb3569970f (patch)
treeb1475c7cea1f23497ecf676f259b86bdc7d7d5ff
parent651ec37ba8efa8fc1ffe3f490182e68bc468969d (diff)
Add benchmarking and fix bug
-rw-r--r--benchmarks.txt7
-rw-r--r--main.py16
2 files changed, 17 insertions, 6 deletions
diff --git a/benchmarks.txt b/benchmarks.txt
new file mode 100644
index 000000000..45ff5ddaf
--- /dev/null
+++ b/benchmarks.txt
@@ -0,0 +1,7 @@
+ml_type tr_size te_size sigma mae time
+CM 500 500 1000.0 43.85581118438912 10.458203600000001
+L-JM 500 500 1000.0 23.306555762464523 10.1301297
+CM 1000 500 1000.0 35.99848579852107 30.1420201
+L-JM 1000 500 1000.0 16.234721245433807 29.1719274
+CM 1500 500 1000.0 31.535353227520467 57.1196739
+L-JM 1500 500 1000.0 14.212853687139276 57.751048
diff --git a/main.py b/main.py
index f39b9b57b..059fa2213 100644
--- a/main.py
+++ b/main.py
@@ -82,18 +82,22 @@ def main():
ljm_pipes.append(ljm_recv)
p2.start()
- for proc in procs:
- proc.join()
-
cm_bench_results = []
ljm_bench_results = []
for cd_pipe, ljd_pipe in zip(cm_pipes, ljm_pipes):
cm_bench_results.append(cd_pipe.recv())
ljm_bench_results.append(ljd_pipe.recv())
- for cm, ljm, in zip(cm_bench_results, ljm_bench_results):
- print(cm)
- print(ljm)
+ for proc in procs:
+ proc.join()
+
+ with open('benchmarks.csv', 'w') as save_file:
+ save_file.write('ml_type,tr_size,te_size,sigma,mae,time\n')
+ for cm, ljm, in zip(cm_bench_results, ljm_bench_results):
+ cm_text = ','.join([str(field) for field in cm]) + '\n'
+ ljm_text = ','.join([str(field) for field in ljm]) + '\n'
+ save_file.write(cm_text)
+ save_file.write(ljm_text)
# End of program
end_time = time.perf_counter()