code: def main_plot_history(
      trials, do_show=True, status_colors=None, title="Loss History"
  ):
      # -- import here because file-level import is too early
      import matplotlib.pyplot as plt
  
      # self is an Experiment
      if status_colors is None:
          status_colors = default_status_colors
  
      # XXX: show the un-finished or error trials
      Ys, colors = zip(
          *[
              (y, status_colors[s])
              for y, s in zip(trials.losses(), trials.statuses())
              if y is not None
          ]
      )
      plt.scatter(range(len(Ys)), Ys, c=colors)
      plt.xlabel("time")
      plt.ylabel("loss")
  
      best_err = trials.average_best_error()
      print("avg best error:", best_err)
      plt.axhline(best_err, c="g")
  
      plt.title(title)
      if do_show:
          plt.show()
  
file_path: hyperopt/hyperopt/plotting.py
imports: import pickle
  import numpy
  from .None import base
  from .base import miscs_to_idxs_vals
label_desc: Use image node_id 1 for calling a global function with example usage: main_plot_history(trials, do_show, status_colors, title) without return types