code: def generate_graphs(result_file_name):
      """
      Generate graphs describing performance statistics.
      The input result_file_name should be the path of the "results.csv" generated by automlbenchmark.
      For each task, this function outputs two graphs in the "reports/" directory located in the same
      parent directory as "results.csv".
      The graph named task_foldx_1.jpg summarizes the best score each tuner gets after n trials.
      The graph named task_foldx_2.jpg summarizes the score each tuner gets in each trial.
      """
      markers = list(Line2D.markers.keys())
      result = pd.read_csv(result_file_name)
      scorelog_dir = result_file_name.replace(
          "results.csv", "scorelogs/"
      )
      output_dir = result_file_name.replace("results.csv", "reports/")
      task_ids = result["id"].unique()
      for task_id in task_ids:
          task_results = result[result["id"] == task_id]
          task_name = task_results.task.unique()[0]
          folds = task_results["fold"].unique()
  
          for fold in folds:
              # load scorelog files
              trial_scores, best_scores = [], []
              tuners = list(
                  task_results[task_results.fold == fold][
                      "framework"
                  ].unique()
              )
              for tuner in tuners:
                  scorelog_name = "{}_{}_{}.csv".format(
                      tuner.lower(), task_name, fold
                  )
                  intermediate_scores = pd.read_csv(
                      scorelog_dir + scorelog_name
                  )
                  bs = list(intermediate_scores["best_score"])
                  ts = [
                      (i + 1, x)
                      for i, x in enumerate(
                          list(intermediate_scores["trial_score"])
                      )
                      if x != 0
                  ]
                  best_scores.append([tuner, bs])
                  trial_scores.append([tuner, ts])
  
              # generate the best score graph
              plt.figure(figsize=(16, 8))
              for i, (tuner, score) in enumerate(best_scores):
                  plt.plot(score, label=tuner, marker=markers[i])
              plt.title("{} Fold {}".format(task_name, fold))
              plt.xlabel("Number of Trials")
              plt.ylabel("Best Score")
              plt.legend()
              plt.savefig(
                  output_dir + "{}_fold{}_1.jpg".format(task_name, fold)
              )
              plt.close()
  
              # generate the trial score graph
              plt.figure(figsize=(16, 8))
              for i, (tuner, score) in enumerate(trial_scores):
                  x = [l[0] for l in score]
                  y = [l[1] for l in score]
                  plt.plot(x, y, label=tuner)  # , marker=markers[i])
              plt.title("{} Fold {}".format(task_name, fold))
              plt.xlabel("Trial Number")
              plt.ylabel("Trial Score")
              plt.legend()
              plt.savefig(
                  output_dir + "{}_fold{}_2.jpg".format(task_name, fold)
              )
              plt.close()
  
imports: import pandas
  import sys
  import matplotlib.pyplot
  from matplotlib.lines import Line2D
label_desc: Use image node_id 2 for calling a global function with example usage: generate_graphs(result_file_name) without return types