code: def single_dataset_summary(
      correls_by_model: Dict[str, pandas.DataFrame],
  ) -> Dict[str, Union[pandas.DataFrame, Dict[str, pandas.DataFrame]]]:
      summary_column = "ANY_ERROR"
  
      summary_sections = {}
      for model, correls_df in correls_by_model.items():
          seq_lvl_columns = correls_df[[summary_column]]
  
          baseline_score_names = (
              EXTRA_REPORTED_BASELINES + REPORTED_BASELINES
          )
          summary_sections["baselines"] = seq_lvl_columns.loc[
              baseline_score_names
          ].astype(float)
  
          data = []
          row_titles = []
          for agg_score, group_scores in ROSCOE_SECTIONS.items():
              # some models don't have all scores; don't use those to aggregate
              if not all(
                  g in seq_lvl_columns[summary_column]
                  for g in group_scores
              ):
                  continue
  
              group_summary_correlation = max(
                  float(seq_lvl_columns[summary_column][gs])
                  for gs in group_scores
              )
              data.append([group_summary_correlation])
              row_titles.append(agg_score)
  
              for score in group_scores:
                  if score in row_titles:
                      continue
                  data.append(
                      [float(seq_lvl_columns[summary_column][score])]
                  )
                  row_titles.append(score)
  
          model_df = pandas.DataFrame(
              data=data,
              index=row_titles,
              columns=[summary_column],
          )
  
          for emb_section in ("ROSCOE-SA", "ROSCOE-SS"):
              section_df = model_df.loc[section_rows(emb_section)]
              if emb_section not in summary_sections:
                  summary_sections[emb_section] = {}
              summary_sections[emb_section][model] = section_df
  
          summary_sections["ROSCOE-LI"] = model_df.loc[
              section_rows("ROSCOE-LI")
          ]
          summary_sections["ROSCOE-LC"] = model_df.loc[
              section_rows("ROSCOE-LC")
          ]
  
      return summary_sections
  
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 27 for calling a global function with example usage: single_dataset_summary(correls_by_model) and returns: summary_sections