code: def analyze_gpt_evaluation_statistics(
      statistics_path: str, save_path: str
  ) -> None:
      """
      Analyze and visualize all GPT evaluation statistics in the given directory.
  
      Args:
          statistics_path: path to all the models' statistics.
          save_path: path to save table and visualization results.
      """
  
      if not os.path.exists(statistics_path):
          raise Exception(
              f'The given directory "{statistics_path}" doesn\'t exist! No statistics found!'
          )
  
      all_statistics = {}
  
      for file_name in os.listdir(statistics_path):
          if file_name.endswith("_evaluation_statistics.json"):
              model_name = file_name.split(
                  "_evaluation_statistics.json"
              )[0]
              all_statistics[model_name] = jload(
                  os.path.join(statistics_path, file_name)
              )
  
      if len(list(all_statistics.keys())) == 0:
          raise Exception(
              f'There are no statistics in the given directory "{statistics_path}"!'
          )
  
      frame_all = {
          "model": [],
          "category": [],
          "metric": [],
          "avg_score": [],
          "best_3": [],
          "worst_3": [],
      }
      frame_per_category = {}
      for model_name, model_statistics in all_statistics.items():
          for category, category_statistics in model_statistics.items():
              if frame_per_category.get(category) is None:
                  frame_per_category[category] = {
                      "model": [],
                      "metric": [],
                      "avg_score": [],
                      "best_3": [],
                      "worst_3": [],
                  }
  
              for (
                  metric,
                  metric_statistics,
              ) in category_statistics.items():
                  frame_all["model"].append(model_name)
                  frame_all["category"].append(category)
                  frame_all["metric"].append(metric)
                  frame_all["avg_score"].append(
                      metric_statistics["avg_score"]
                  )
                  frame_all["best_3"].append(
                      metric_statistics["best_3"]
                  )
                  frame_all["worst_3"].append(
                      metric_statistics["worst_3"]
                  )
  
                  frame_per_category[category]["model"].append(
                      model_name
                  )
                  frame_per_category[category]["metric"].append(metric)
                  frame_per_category[category]["avg_score"].append(
                      metric_statistics["avg_score"]
                  )
                  frame_per_category[category]["best_3"].append(
                      metric_statistics["best_3"]
                  )
                  frame_per_category[category]["worst_3"].append(
                      metric_statistics["worst_3"]
                  )
  
      if not os.path.exists(save_path):
          os.makedirs(save_path)
  
      frame_all = pd.DataFrame(frame_all)
      frame_all.to_csv(
          os.path.join(save_path, "gpt_evaluation_statistics.csv")
      )
  
      for category in tqdm.tqdm(
          frame_per_category.keys(),
          desc=f"GPT evaluation: ",
          total=len(frame_per_category.keys()),
      ):
          data = pd.DataFrame(frame_per_category[category])
  
          sns.set()
          fig = plt.figure(figsize=(16, 10))
          plt.ylim((0, 5))
  
          fig = sns.barplot(
              x="metric",
              y="avg_score",
              hue="model",
              data=data,
              dodge=True,
          )
          fig.set_title(
              f"Comparison between Different Models for Category {category.title()}"
          )
          plt.xlabel("Evaluation Metric")
          plt.ylabel("Average Score")
  
          figure = fig.get_figure()
          figure.savefig(
              os.path.join(save_path, f"{category}.png"), dpi=400
          )
  
          plt.close()
  
imports: import concurrent.futures
  import os
  import re
  import time
  from copy import deepcopy
  from typing import Any, Dict, List
  import matplotlib.pyplot
  import numpy
  import openai
  import pandas
  import seaborn
  import tqdm
  from colossal_eval.utils import jdump, jload
label_desc: Use image node_id 15 for calling a global function with example usage: analyze_gpt_evaluation_statistics(statistics_path, save_path) without return types