def plot_traing_info(x, ylist, path):
"""
Loads log file and plot x and y values as provided by input.
Saves as <path>/train_log.png
"""
file_name = os.path.join(path, __train_log_file_name)
try:
with open(file_name, "rb") as f:
log = pickle.load(f)
except IOError: # first time
warnings.warn("There is no {} file here!!!".format(file_name))
return
plt.figure()
x_vals = log[x]
for y in ylist:
y_vals = log[y]
if len(y_vals) != len(x_vals):
warning.warn("One of y's: {} does not have the same length as x:{}".format(y, x))
plt.plot(x_vals, y_vals, label=y)
# assert len(y_vals) == len(x_vals), "not the same len"
plt.xlabel(x)
plt.legend()
#plt.show()
plt.savefig(file_name[:-3]+'png', bbox_inches='tight')
plt.close('all')
评论列表
文章目录