class_docstr: Dataset evaluator.
class_docstr_tok: ["Dataset","evaluator","."]
docstr: Evaluate inference data on the given metrics.
  
  Args:
      data: Data to be evaluated.
      dataset_name: Name of the dataset
      model_name: Name of the model
      metrics: Metrics used to evaluate.
docstr_tok: ["Evaluate","inference","data","on","the","given","metrics",".","Args",":","data",":","Data","to","be","evaluated",".","dataset_name",":","Name","of","the","dataset","model_name",":","Name","of","the","model","metrics",":","Metrics","used","to","evaluate","."]
code: def get_evaluation_results(
      self,
      data: Dict[str, Union[str, Dict]],
      dataset_name: str,
      model_name: str,
      metrics: List[str],
  ):
      """
      Evaluate inference data on the given metrics.
  
      Args:
          data: Data to be evaluated.
          dataset_name: Name of the dataset
          model_name: Name of the model
          metrics: Metrics used to evaluate.
  
      """
      self.data = data["inference_results"]
      self.dataset_name = dataset_name
      self.dataset_class = data["dataset_class"]
      self.model_name = model_name
      self.categories = list(self.data.keys())
      self.metrics = metrics
      self.judgements = {}
  
      self.evaluation_results = {
          metric: {
              category: 0 for category in (["ALL"] + self.categories)
          }
          for metric in self.metrics
      }
  
      self.total_length = 0
      self.total_single_choices = 0
      for value in self.data.values():
          self.total_length += len(value["data"])
          if value["inference_kwargs"]["all_classes"] is not None:
              self.total_single_choices += len(value["data"])
  
      self.metric_total_length = {metric: 0 for metric in self.metrics}
      self.suggested_categories = {
          metric: [] for metric in self.metrics
      }
  
      for metric in self.metrics:
          # Train and reference split use same metric as test split.
          self.suggested_categories[
              metric
          ] = metric_helper.metrics4subcategory[self.dataset_class][
              metric
          ]
          if "ALL" in self.suggested_categories[metric]:
              self.suggested_categories[metric] = self.categories
              self.metric_total_length[metric] = self.total_length
              continue
          for category in self.suggested_categories[metric]:
              self.metric_total_length[metric] += len(
                  self.data[category]["data"]
              )
  
      if (
          "per_byte_perplexity" in self.metrics
          or "per_byte_ppl_score" in self.metrics
      ):
          self.N_bytes = {category: [] for category in self.categories}
          for category in self.categories:
              samples = self.data[category]["data"]
              for sample in samples:
                  self.N_bytes[category].append(sample["byte_num"][0])
  
      return self._evaluate()
  
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 8 for calling the DatasetEvaluator obj's underlying member method code with example usage: obj.get_evaluation_results(data, dataset_name, model_name, metrics) and returns: self