code: def build_metrics_summary(
      experiment_local_directory: str,
  ) -> MetricsSummary:
      """Build a metrics summary for an experiment.
  
      :param experiment_local_directory: directory where the experiment artifacts live.
          e.g. local_experiment_repo/ames_housing/some_experiment/
      """
      config = load_json(
          os.path.join(
              experiment_local_directory,
              "experiment_run",
              "model",
              MODEL_HYPERPARAMETERS_FILE_NAME,
          )
      )
      report = load_json(
          os.path.join(
              experiment_local_directory,
              "experiment_run",
              "test_statistics.json",
          )
      )
      output_feature_type: str = config["output_features"][0]["type"]
      output_feature_name: str = config["output_features"][0]["name"]
      metric_dict = report[output_feature_name]
      full_metric_names = get_metric_classes(output_feature_type)
      metric_to_values: Dict[str, Union[float, int]] = {
          metric_name: metric_dict[metric_name]
          for metric_name in full_metric_names
          if metric_name in metric_dict
      }
      metric_names: Set[str] = set(metric_to_values)
  
      return MetricsSummary(
          experiment_local_directory=experiment_local_directory,
          config=config,
          output_feature_name=output_feature_name,
          output_feature_type=output_feature_type,
          metric_to_values=metric_to_values,
          metric_names=metric_names,
      )
  
imports: import csv
  import logging
  import os
  from dataclasses import dataclass
  from statistics import mean
  from typing import Dict, List, Optional, Set, Union
  import ludwig.modules.metric_modules
  from ludwig.benchmarking.utils import format_memory, format_time
  from ludwig.globals import MODEL_HYPERPARAMETERS_FILE_NAME
  from ludwig.modules.metric_registry import get_metric_classes, metric_feature_type_registry
  from ludwig.types import ModelConfigDict
  from ludwig.utils.data_utils import load_json
label_desc: Use image node_id 3 for calling a global function with example usage: build_metrics_summary(experiment_local_directory) and returns: MetricsSummary