class_docstr: Summarize the benchmark results in JSON files to be displayed in the UI.
docstr: Creates a list of tables, one for each metric group (e.g., accuracy, robustness).
  Each table has `adapter_spec`s as rows and scenarios or groups as columns.
docstr_tok: ["Creates","a","list","of","tables",",","one","for","each","metric","group","(","e.g.",",","accuracy",",","robustness",")",".","Each","table","has","`","adapter_spec","`","s","as","rows","and","scenarios","or","groups","as","columns","."]
code: def create_group_tables_by_metric_group(
      self, group: RunGroup
  ) -> List[Table]:
      """Creates a list of tables, one for each metric group (e.g., accuracy, robustness).
      Each table has `adapter_spec`s as rows and scenarios or groups as columns.
      """
      tables: List[Table] = []
      adapter_to_runs: Dict[AdapterSpec, List[Run]] = defaultdict(list)
      subgroups = self.expand_subgroups(group)
      for subgroup in subgroups:
          for adapter_spec, runs in self.group_adapter_to_runs[
              subgroup.name
          ].items():
              coarse_adapter_spec = get_coarse_adapter_spec(
                  adapter_spec,
                  adapter_keys_shown=group.adapter_keys_shown,
              )
              filtered_runs = self.filter_runs_by_visibility(
                  runs, group
              )
              if filtered_runs:
                  adapter_to_runs[coarse_adapter_spec].extend(
                      filtered_runs
                  )
  
      all_metric_groups: List[str] = []
      if (
          group.metric_groups
      ):  # if the group specifies the metric groups, use them
          all_metric_groups = group.metric_groups
      else:  # otherwise, collect them from subgroups
          for subgroup in subgroups:
              all_metric_groups.extend(subgroup.metric_groups)
          # deduplicate, remove basic metric group if we include the detailed one, remove hidden metric groups
          all_metric_groups = [
              metric_group
              for metric_group in dict.fromkeys(all_metric_groups)
              if f"{metric_group}_detailed" not in all_metric_groups
              and metric_group
              not in group.subgroup_metric_groups_hidden
          ]
  
      if len(adapter_to_runs) > 0:
          for metric_group in all_metric_groups:
              display_name = self.schema.name_to_metric_group[
                  metric_group
              ].get_short_display_name()
              table = self.create_group_table(
                  name=metric_group,
                  title=display_name,
                  adapter_to_runs=adapter_to_runs,
                  columns=[
                      (subgroup, metric_group) for subgroup in subgroups
                  ],
                  link_to_runs=False,
                  add_win_rate=True,
              )
              tables.append(table)
      return tables
  
imports: import argparse
  import os
  import datetime
  import urllib.parse
  import dacite
  import json
  from collections import defaultdict
  from dataclasses import dataclass, replace
  from statistics import mean, median
  from typing import List, Optional, Dict, Any, Tuple, Set
  from tqdm import tqdm
  from helm.common.general import write, ensure_directory_exists, asdict_without_nones, parallel_map, singleton, unique_simplification
  from helm.common.hierarchical_logger import hlog, htrack, htrack_block
  from helm.benchmark.scenarios.scenario import ScenarioSpec
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.benchmark.metrics.metric_name import MetricName
  from helm.benchmark.metrics.metric import get_all_stats_by_name
  from helm.benchmark.metrics.statistic import Stat, merge_stat
  from helm.benchmark.runner import RunSpec, LATEST_SYMLINK
  from .table import Cell, HeaderCell, Table, Hyperlink, table_to_latex
  from .schema import MetricNameMatcher, RunGroup, read_schema, SCHEMA_YAML_FILENAME, BY_GROUP, THIS_GROUP_ONLY, NO_GROUPS
  from .contamination import read_contamination, validate_contamination, CONTAMINATION_SYMBOLS, CONTAMINATION_STYLES, CONTAMINATION_LEVEL_STRONG
  from .run_display import write_run_display_json
label_desc: Use image node_id 15 for calling the Summarizer obj's underlying member method code with example usage: obj.create_group_tables_by_metric_group(group) and returns: tables