class_docstr: Summarize the benchmark results in JSON files to be displayed in the UI.
docstr: Filter the list of runs and only keep runs relevant to this group.
docstr_tok: ["Filter","the","list","of","runs","and","only","keep","runs","relevant","to","this","group","."]
code: def filter_runs_by_visibility(
      self, runs: List[Run], group: RunGroup
  ) -> List[Run]:
      """Filter the list of runs and only keep runs relevant to this group."""
      filtered_runs: List[Run] = []
      for run in runs:
          included = True
          if (
              group.visibility == THIS_GROUP_ONLY
          ):  # don't include the canonical runs when looking at, say, ablations
              included = False
          for (
              run_group_name
          ) in (
              run.run_spec.groups
          ):  # go through the groups of the run to determine visibility
              if run_group_name not in self.schema.name_to_run_group:
                  hlog(
                      f"WARNING: group {run_group_name} mentioned in run spec {run.run_spec.name} "
                      f"but undefined in {SCHEMA_YAML_FILENAME}, skipping"
                  )
                  continue
              run_group = self.schema.name_to_run_group[run_group_name]
              if (
                  run_group.visibility == NO_GROUPS
              ):  # this run should never be visible
                  included = False
                  break
              if (
                  run_group.visibility == THIS_GROUP_ONLY
              ):  # this run is part of a group with partial visibility
                  if (
                      run_group.name == group.name
                  ):  # if this is the exact group we are visualizing, include for sure
                      included = True
                      break
                  else:  # we won't visualize unless we hit exactly the group with partial visibility
                      included = False
          if included:
              filtered_runs.append(run)
      return filtered_runs
  
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 3 for calling the Summarizer obj's underlying member method code with example usage: obj.filter_runs_by_visibility(runs, group) and returns: filtered_runs