code: def evaluate(
      prediction_dir: str,
      data_dir: str,
      eval_dataset: str,
      in_domain_services: set,
      joint_acc_across_turn: bool,
      use_fuzzy_match: bool,
  ) -> dict:
      """Calculate the DSTC8/SGD metrics for given data.
  
      Args:
          prediction_dir: prediction location
          data_dir: ground truth data location.
          eval_dataset: evaluation data split
          in_domain_services: The set of services which are present in the training set.
          joint_acc_across_turn: Whether to compute joint goal accuracy across turn instead of across service. Should be set to True when conducting multiwoz style evaluation.
          use_fuzzy_match: Whether to use fuzzy string matching when comparing non-categorical slot values. Should be set to False when conducting multiwoz style evaluation.
  
      Returns:
          A dict mapping a metric collection name to a dict containing the values
          for various metrics for all dialogues and all services
      """
  
      with open(
          os.path.join(data_dir, eval_dataset, "schema.json"),
          encoding="UTF-8",
      ) as f:
          eval_services = {}
          list_services = json.load(f)
          for service in list_services:
              eval_services[service["service_name"]] = service
          f.close()
  
      dataset_ref = get_dataset_as_dict(
          os.path.join(data_dir, eval_dataset, "dialogues_*.json")
      )
      dataset_hyp = get_dataset_as_dict(
          os.path.join(prediction_dir, "*.json")
      )
  
      # has ALLSERVICE, SEEN_SERVICES, UNSEEN_SERVICES, SERVICE, DOMAIN
      all_metric_aggregate, _ = get_metrics(
          dataset_ref,
          dataset_hyp,
          eval_services,
          in_domain_services,
          joint_acc_across_turn,
          use_fuzzy_match,
      )
      if SEEN_SERVICES in all_metric_aggregate:
          logging.info(
              f"Dialog metrics for {SEEN_SERVICES}  : {sorted(all_metric_aggregate[SEEN_SERVICES].items())}"
          )
      if UNSEEN_SERVICES in all_metric_aggregate:
          logging.info(
              f"Dialog metrics for {UNSEEN_SERVICES}: {sorted(all_metric_aggregate[UNSEEN_SERVICES].items())}"
          )
      if ALL_SERVICES in all_metric_aggregate:
          logging.info(
              f"Dialog metrics for {ALL_SERVICES}   : {sorted(all_metric_aggregate[ALL_SERVICES].items())}"
          )
  
      # Write the per-frame metrics values with the corrresponding dialogue frames.
      with open(
          os.path.join(prediction_dir, PER_FRAME_OUTPUT_FILENAME),
          "w",
          encoding="UTF-8",
      ) as f:
          json.dump(dataset_hyp, f, indent=2, separators=(",", ": "))
          f.close()
      return all_metric_aggregate[ALL_SERVICES]
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/sgd/evaluate.py
imports: import collections
  import glob
  import json
  import os
  import numpy
  from nemo.collections.nlp.metrics.sgd_metrics import ACTIVE_INTENT_ACCURACY, JOINT_CAT_ACCURACY, JOINT_GOAL_ACCURACY, JOINT_NONCAT_ACCURACY, NAN_VAL, REQUESTED_SLOTS_F1, REQUESTED_SLOTS_PRECISION, REQUESTED_SLOTS_RECALL, SLOT_TAGGING_F1, SLOT_TAGGING_PRECISION, SLOT_TAGGING_RECALL, get_active_intent_accuracy, get_average_and_joint_goal_accuracy, get_requested_slots_f1, get_slot_tagging_f1
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: evaluate(prediction_dir, data_dir, eval_dataset, in_domain_services, joint_acc_across_turn, use_fuzzy_match) and returns: all_metric_aggregate