diff options
-rw-r--r-- | benchmarks.txt | 7 | ||||
-rw-r--r-- | main.py | 16 |
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 @@ -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() |