Skip to content
Snippets Groups Projects
Unverified Commit dc1ee2f3 authored by Shamith Achanta's avatar Shamith Achanta Committed by GitHub
Browse files

Update compare.py

parent 8af4463a
No related branches found
No related tags found
No related merge requests found
import sys
sys.path.append(r'/home/shamith/HyperSphere/')
sys.path.append(r'/home/shamith/HyperSphere/HyperSphere/')
sys.path.append(r'/home/shamith/HyperSphere/HyperSphere/BO/')
from matplotlib import pyplot as my_plt
from matplotlib import patches as my_patch
import numpy as np
......@@ -11,9 +6,9 @@ import json
import pandas as pd
data_config_filename = r'/home/shamith/HyperSphere/HyperSphere/experiments/neg_birdy_D2_1/data_config.pkl'
filename = r'/home/shamith/BayesianOptimization/logs/<function birdy at 0x7f3ca17abb70>.json'
rename = r'/home/shamith/BayesianOptimization/plots/<function birdy at 0x7f3ca17abb70>.json'
data_config_filename = r'/::host::/BayesianOptimization/HyperSphere/experiments/::func_name::/data_config.pkl'
log_file = r'/::host::/BayesianOptimization/fmfnBO/logs/::log_file::.json'
plot_file = r'/::host::/BayesianOptimization/fmfnBO/plots/::plot_file::.json'
# HyperSphere
data_config_file = open(data_config_filename, 'rb')
......@@ -27,21 +22,21 @@ for key, val in pickle.load(data_config_file).items():
data_config_file.close()
# fmfn/BayesianOptimization
with open(filename, "r") as f:
with open(log_file, "r") as f:
file_data = f.read()
with open(filename, "r") as f:
with open(log_file, "r") as f:
lines = f.readlines()
first_line = lines[0]
file_lines = [''.join([',', line.strip(), '\n']) for line in lines[1:]]
with open(rename, "w+") as f:
with open(plot_file, "w+") as f:
f.write('{' + '\n' + ' ' + '"logs"' + ':' + ' ' + '[' + '\n')
f.writelines(first_line)
f.writelines(file_lines)
f.write(" " + "]" + "\n" + "}")
with open(rename) as json_file:
with open(plot_file) as json_file:
data = json.load(json_file)
x2 = np.arange(1, len(lines)+1, 1)
......@@ -56,4 +51,4 @@ my_plt.legend(handles=[red, blue])
my_plt.plot(x1[:,0], y1, 'r')
my_plt.plot(x2, y2, 'b')
my_plt.show()
\ No newline at end of file
my_plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment