code: def get_summary(
      model_names: List[str],
      final_out: str,
      summary_out: str,
      stat_name: str,
      pval_name: str,
  ):
      """
      For each embedding model, get average and max correlation between score and
      perturbation ground truth.
      """
      # The final summary file
      summary_lines = []
      metrics = []
      scores = {}
      n_meta_columns = 4
      with open(final_out) as file_obj:
          reader_obj = csv.reader(file_obj)
  
          r = 0
          for row in reader_obj:
              if r == 0:
                  metrics = row[n_meta_columns:]
                  r += 1
                  continue
  
              data_name = row[0]
              data_split = row[1]  # train/dev/test
              correlation_type = row[2]
              model = row[3]
  
              if model not in scores:
                  scores[model] = {}
              if correlation_type not in scores[model]:
                  scores[model][correlation_type] = {}
                  for metric in metrics:
                      scores[model][correlation_type][metric] = []
  
              if not is_single_perturbation(
                  data_name
              ) and not is_sentinel(data_name):
                  continue
  
              for metric_idx in range(len(metrics)):
                  score_value = row[n_meta_columns + metric_idx]
                  if score_value != "":
                      scores[model][correlation_type][
                          metrics[metric_idx]
                      ].append(float(score_value))
                  elif not_found(metrics[metric_idx], model):
                      print(
                          f"Missing {data_split} {metrics[metric_idx]} value for {model}"
                      )
  
          ### Report AVERAGE
  
          for model, score_dict in scores.items():
              if model not in model_names:
                  continue
              summary_lines.append(
                  ",".join(
                      [
                          model,
                          f"Average {stat_name}",
                          f"Average {pval_name}",
                          f"Max {stat_name}",
                          f"{pval_name}",
                      ]
                  )
                  + "\n"
              )
              stat_score = score_dict[stat_name]
              stat_pvalue = score_dict[pval_name]
              for metric in stat_score.keys():
                  if metric not in REASONING_SCORES:
                      print(f"{metric} not in known scores")
                      continue
                  if len(stat_score[metric]) == 0:
                      if not_found(metric, model):
                          print(f"No {metric} scores found for {model}")
                      continue
  
                  average_score = np.average(stat_score[metric])
                  average_p_value = np.average(stat_pvalue[metric])
  
                  max_score = np.max(stat_score[metric])
                  max_pvalue = stat_pvalue[metric][
                      stat_score[metric].index(max_score)
                  ]
                  summary_lines.append(
                      ",".join(
                          [
                              metric,
                              str(average_score),
                              str(average_p_value),
                              str(max_score),
                              str(max_pvalue),
                          ]
                      )
                      + "\n"
                  )
              summary_lines.append("\n")
  
      with open(summary_out, "w") as f:
          f.writelines(summary_lines)
  
      print(f"summary written to {summary_out}")
  
imports: import csv
  from glob import glob
  import json
  import os
  import pathlib
  import numpy
  import pandas
  from parlai.core.params import ParlaiParser
  from projects.roscoe.meta_evaluation.correlations import Analyzer
  from projects.roscoe.score import EMB_MODEL_SCORES, EMBEDDING_MODEL_NAMES, GRAMMAR_MODEL_SCORES, LANGUAGE_MODEL_SCORES, NLI_MODEL_SCORES, REASONING_SCORES, SCORE_GROUPS, SUPERVISED_SCORES, UNSUPERVISED_SCORES
  from typing import Callable, List
label_desc: Use image node_id 11 for calling a global function with example usage: get_summary(model_names, final_out, summary_out, stat_name, pval_name) without return types