code: def plot_performance_vs_trials(
      results,
      output_directory,
      save_file="PerformanceVsTrials.png",
      plot_title="",
      show_plot=True,
  ):
      try:
          import matplotlib.pyplot as plt
  
          matplotlib_imported = True
      except ImportError:
          matplotlib_imported = False
  
      if not matplotlib_imported:
          warnings.warn(
              'AutoGluon summary plots cannot be created because matplotlib is not installed. Please do: "pip install matplotlib"'
          )
          return None
  
      ordered_trials = sorted(list(results["trial_info"].keys()))
      ordered_val_perfs = [
          results["trial_info"][trial_id][results["reward_attr"]]
          for trial_id in ordered_trials
      ]
      x = range(1, len(ordered_trials) + 1)
      y = []
      for i in x:
          y.append(
              max([ordered_val_perfs[j] for j in range(i)])
          )  # best validation performance in trials up until ith one (assuming higher = better)
      fig, ax = plt.subplots()
      ax.plot(x, y)
      ax.set(
          xlabel="Completed Trials",
          ylabel="Best Performance",
          title=plot_title,
      )
      if output_directory is not None:
          outputfile = os.path.join(output_directory, save_file)
          fig.savefig(outputfile)
          print(
              "Plot of HPO performance saved to file: %s" % outputfile
          )
      if show_plot:
          plt.show()
  
file_path: autogluon/core/src/autogluon/core/utils/plots.py
imports: import os
  import warnings
  from collections import OrderedDict
  import numpy
  from .miscs import warning_filter
label_desc: Use image node_id 1 for calling a global function with example usage: plot_performance_vs_trials(results, output_directory, save_file, plot_title, show_plot) and returns: None