code: def _evaluate(dataset, predictions):
      """
      Evaluate function.
      """
      f1_result = exact_match = total = 0
      count = 0
      for article in dataset:
          for paragraph in article["paragraphs"]:
              for qa_pair in paragraph["qas"]:
                  total += 1
                  if qa_pair["id"] not in predictions:
                      count += 1
                      continue
                  ground_truths = list(
                      map(lambda x: x["text"], qa_pair["answers"])
                  )
                  prediction = predictions[qa_pair["id"]]
                  exact_match += metric_max_over_ground_truths(
                      exact_match_score, prediction, ground_truths
                  )
                  f1_result += metric_max_over_ground_truths(
                      f1_score, prediction, ground_truths
                  )
      print(
          "total",
          total,
          "exact_match",
          exact_match,
          "unanswer_question ",
          count,
      )
      exact_match = 100.0 * exact_match / total
      f1_result = 100.0 * f1_result / total
      return {"exact_match": exact_match, "f1": f1_result}
  
file_path: nni/examples/trials/weight_sharing/ga_squad/evaluate.py
imports: from __future__ import print_function
  from collections import Counter
  import string
  import re
  import argparse
  import json
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: _evaluate(dataset, predictions) and returns: dict