code: def compare_eval_results(
      output_uri: str,
      expected_uri: str,
      threshold: float,
      metrics: List[str],
  ) -> bool:
      """Compares accuracy on overall dataset using two EvalResult.
  
      Args:
        output_uri: pipeline output artifact uri.
        expected_uri: recorded pipeline output artifact uri.
        threshold: a float larger than 0.
        metrics: metric names to compare.
  
      Returns:
        boolean whether the eval result values differ within a threshold.
      """
      eval_result = tfma.load_eval_result(output_uri)
      expected_eval_result = tfma.load_eval_result(expected_uri)
      slice_map = _group_metric_by_slice(eval_result)
      expected_slice_map = _group_metric_by_slice(expected_eval_result)
      for metric_name, value in slice_map[()].items():
          if metric_name not in metrics:
              continue
          expected_value = expected_slice_map[()][metric_name]
          if not _compare_relative_difference(
              value, expected_value, threshold
          ):
              logging.warning("Check following metric: %s", metric_name)
              return False
      return True
  
imports: import filecmp
  import os
  from typing import Dict, List, Optional
  from absl import logging
  import tensorflow_model_analysis
  from tfx import types
  from tfx.dsl.io import fileio
  from tfx.experimental.pipeline_testing import pipeline_recorder_utils
  from tfx.orchestration import metadata
  from tfx.types import artifact_utils
  from tfx.utils import io_utils
  from ml_metadata.proto import metadata_store_pb2
  from tensorflow_metadata.proto.v0 import anomalies_pb2
label_desc: Use image node_id 6 for calling a global function with example usage: compare_eval_results(output_uri, expected_uri, threshold, metrics) and returns: True, False