| 63 | |
| 64 | |
| 65 | def main_plot_histogram(trials, do_show=True, title="Loss Histogram"): |
| 66 | # -- import here because file-level import is too early |
| 67 | import matplotlib.pyplot as plt |
| 68 | |
| 69 | status_colors = default_status_colors |
| 70 | Xs, Ys, Ss, Cs = zip( |
| 71 | *[ |
| 72 | (x, y, s, status_colors[s]) |
| 73 | for (x, y, s) in zip(trials.specs, trials.losses(), trials.statuses()) |
| 74 | if y is not None |
| 75 | ] |
| 76 | ) |
| 77 | |
| 78 | # XXX: deal with ok vs. un-finished vs. error trials |
| 79 | print("Showing Histogram of %i jobs" % len(Ys)) |
| 80 | plt.hist(Ys) |
| 81 | plt.xlabel("loss") |
| 82 | plt.ylabel("frequency") |
| 83 | |
| 84 | plt.title(title) |
| 85 | if do_show: |
| 86 | plt.show() |
| 87 | |
| 88 | |
| 89 | def main_plot_vars( |