code: def performance_histogram_model_vs_random(runs, id2conf, show=False):
      model_based_runs = list(
          filter(
              lambda r: id2conf[r.config_id]["config_info"][
                  "model_based_pick"
              ],
              runs,
          )
      )
      random_runs = list(
          filter(
              lambda r: not id2conf[r.config_id]["config_info"][
                  "model_based_pick"
              ],
              runs,
          )
      )
  
      budgets = list(set([r.budget for r in runs]))
      budgets.sort()
  
      losses = {}
      for b in budgets:
          losses[b] = {"model_based": [], "random": []}
  
      for r in model_based_runs:
          if r.loss is None or not np.isfinite(r.loss):
              continue
          losses[r.budget]["model_based"].append(r.loss)
  
      for r in random_runs:
          if r.loss is None or not np.isfinite(r.loss):
              continue
          losses[r.budget]["random"].append(r.loss)
  
      fig, axarr = plt.subplots(
          len(budgets), 2, sharey="row", sharex="row"
      )
      plt.suptitle(
          "Loss of model based configurations (left) vs. random configuration (right)"
      )
  
      for i, b in enumerate(budgets):
          mbax, rax = axarr[i]
          mbax.hist(
              losses[b]["model_based"],
              label="b = %f \n n = %i"
              % (b, len(losses[b]["model_based"])),
          )
          mbax.set_ylabel("frequency")
          mbax.legend()
  
          rax.hist(
              losses[b]["random"],
              label="b = %f \n n = %i" % (b, len(losses[b]["random"])),
          )
          rax.legend()
  
          if i == len(budgets) - 1:
              mbax.set_xlabel("loss")
              rax.set_xlabel("loss")
      if show:
          plt.show()
  
      return (fig, axarr)
  
file_path: HpBandSter/hpbandster/visualization.py
imports: import copy
  import numpy
  import scipy.stats
  import matplotlib.pyplot
  from matplotlib.widgets import CheckButtons, Button
label_desc: Use image node_id 4 for calling a global function with example usage: performance_histogram_model_vs_random(runs, id2conf, show) and returns: fig,  axarr