code: def make_correlations_table(values_by_title: Dict[str, List[float]]):
      """
      Given all the annotations and scores, finds the correlations between comparable
      pairs.
      """
      # separate scores and labels
      human_column_titles, score_row_titles = split_list(
          sorted(values_by_title.keys()),
          is_human_label_column_title,
      )
  
      # separate out step-wise labels
      stepwise_labels = [
          h for h in human_column_titles if is_label_stepwise(h)
      ]
  
      # final row & column ordering
      column_titles = filter_and_order_column_titles(
          human_labels=human_column_titles,
          stepwise_labels=stepwise_labels,
      )
      row_titles = filter_and_order_row_titles(
          score_titles=score_row_titles
      )
  
      # this is the top row, where the upper-left-most cell is the title of the table
      somersd_table = [["SomersD"] + column_titles]
      pval_table = [["p"] + column_titles]
  
      for score_title in row_titles:
          somersd_row = [score_title]
          pval_row = [score_title]
          for i, human_title in enumerate(column_titles):
              assert (
                  human_title == somersd_table[0][i + 1]
              ), "values don't align with columns!"
  
              if len(values_by_title[human_title]) != len(
                  values_by_title[score_title]
              ):
                  raise Exception(
                      f"Attempting to compare values whose rows do not align. Score: {score_title}, Label: {human_title}"
                  )
  
              analyzer = Analyzer(reference_column=human_title)
  
              somersd_stat = analyzer.correlation_stat(
                  df=pandas.DataFrame.from_dict(
                      {
                          human_title: values_by_title[human_title],
                          score_title: values_by_title[score_title],
                      }
                  ),
                  hypo_column=score_title,
              )
  
              correl = somersd_stat.statistic
              p_val = somersd_stat.pvalue
  
              somersd_row.append(f"{correl:.3f}")
              pval_row.append(p_val)
          somersd_table.append(somersd_row)
          pval_table.append(pval_row)
  
      return somersd_table, pval_table
  
imports: import argparse
  from collections import defaultdict
  import csv
  import math
  import os
  import pathlib
  from typing import Dict, Iterable, List, Optional, Set, Tuple, Union
  import pandas
  from projects.roscoe.meta_evaluation.correlations import Analyzer
  from projects.roscoe.score import ROSCOE_SA, ROSCOE_SS, ROSCOE_LI, ROSCOE_LC, SUPERVISED_SCORES, UNSUPERVISED_SCORES
  from projects.roscoe.utils import assert_all_elements_same_length, ordered_union, split_list
  from projects.roscoe.meta_evaluation.table_file_writing import ANNOTATION_COLUMN_ORDER, COLUMN_RENAMES, MODELS, ROSCOE_SECTIONS, STEP_COLUMN_RENAMES, section_rows, write_every_dataset_summary_table_tex, write_every_dataset_final_summary_table_tex, write_granular_summary_tex
label_desc: Use image node_id 22 for calling a global function with example usage: make_correlations_table(values_by_title) and returns: somersd_table,  pval_table