class_docstr: Dataset evaluator.
class_docstr_tok: ["Dataset","evaluator","."]
docstr: Calculate gpt metrics.
docstr_tok: ["Calculate","gpt","metrics","."]
code: def _calculate_gpt_metrics(self, metric: str, category: str):
      """Calculate gpt metrics."""
      weight = (
          len(self.data[category]["data"])
          / self.metric_total_length[metric]
      )
  
      metric_method = eval("gpt_helper." + metric)
  
      judgements, avg_ratings = metric_method(
          self.data[category]["data"], self.config_path
      )
      self.judgements[category] = judgements
  
      self.evaluation_results[metric][category] = (
          np.mean(avg_ratings),
          len(self.data[category]["data"]),
      )
      self.evaluation_results[metric]["ALL"] += (
          np.mean(avg_ratings) * weight
      )
  
      for i in range(avg_ratings.shape[0]):
          if f"{metric}_{i+1}" not in self.evaluation_results:
              self.evaluation_results[f"{metric}_{i+1}"] = {
                  cat: 0 for cat in (["ALL"] + self.categories)
              }
          self.evaluation_results[f"{metric}_{i+1}"][category] = (
              avg_ratings[i],
              len(self.data[category]["data"]),
          )
          self.evaluation_results[f"{metric}_{i+1}"]["ALL"] += (
              avg_ratings[i] * weight
          )
  
file_path: colossalai/applications/ColossalEval/colossal_eval/evaluate/dataset_evaluator/dataset_evaluator.py
imports: import os
  from typing import Dict, List, Union
  import colossal_eval.evaluate.dataset_evaluator.metrics
  import numpy
  import tqdm
  from colossal_eval.utils import jdump
  import colossal_eval.evaluate.dataset_evaluator.gpt_judge
label_desc: Use image node_id 5 for calling the DatasetEvaluator obj's underlying member method code with example usage: obj._calculate_gpt_metrics(metric, category) without return types