MCPcopy
hub / github.com/hyperopt/hyperopt / main_plot_history

Function main_plot_history

hyperopt/plotting.py:36–62  ·  view source on GitHub ↗
(trials, do_show=True, status_colors=None, title="Loss History")

Source from the content-addressed store, hash-verified

34
35
36def main_plot_history(trials, do_show=True, status_colors=None, title="Loss History"):
37 # -- import here because file-level import is too early
38 import matplotlib.pyplot as plt
39
40 # self is an Experiment
41 if status_colors is None:
42 status_colors = default_status_colors
43
44 # XXX: show the un-finished or error trials
45 Ys, colors = zip(
46 *[
47 (y, status_colors[s])
48 for y, s in zip(trials.losses(), trials.statuses())
49 if y is not None
50 ]
51 )
52 plt.scatter(range(len(Ys)), Ys, c=colors)
53 plt.xlabel("time")
54 plt.ylabel("loss")
55
56 best_err = trials.average_best_error()
57 print("avg best error:", best_err)
58 plt.axhline(best_err, c="g")
59
60 plt.title(title)
61 if do_show:
62 plt.show()
63
64
65def main_plot_histogram(trials, do_show=True, title="Loss Histogram"):

Callers

nothing calls this directly

Calls 3

lossesMethod · 0.80
statusesMethod · 0.80
average_best_errorMethod · 0.80

Tested by

no test coverage detected