| Total Complexity | 1 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from tqdm import tqdm |
||
| 2 | import numpy as np |
||
| 3 | import pandas as pd |
||
| 4 | import matplotlib.pyplot as plt |
||
| 5 | |||
| 6 | |||
| 7 | def create_performance_plots(study_name): |
||
| 8 | results = pd.read_csv("./_data/" + study_name + ".csv", index_col=0) |
||
| 9 | |||
| 10 | total_time = results.loc["total_time_mean"].values |
||
| 11 | eval_time = results.loc["eval_time_mean"].values |
||
| 12 | iter_time = results.loc["iter_time_mean"].values |
||
| 13 | |||
| 14 | ind = np.arange(total_time.shape[0]) # the x locations for the groups |
||
| 15 | width = 0.35 # the width of the bars: can also be len(x) sequence |
||
| 16 | |||
| 17 | plt.figure(figsize=(15, 5)) |
||
| 18 | |||
| 19 | p2 = plt.bar(ind, iter_time, width, bottom=eval_time) |
||
| 20 | p1 = plt.bar(ind, eval_time, width) |
||
| 21 | |||
| 22 | plt.ylabel("Time [s]") |
||
| 23 | # plt.title(title) |
||
| 24 | plt.xticks(ind, results.columns, rotation=75) |
||
| 25 | # plt.yticks() |
||
| 26 | plt.legend((p1[0], p2[0]), ("Eval time", "Opt time")) |
||
| 27 | |||
| 28 | plt.tight_layout() |
||
| 29 | plt.savefig("./_plots/performance.png", dpi=300) |
||
| 30 | |||
| 31 | |||
| 32 | create_performance_plots("simple function") |
||
| 33 |