code: def testEvaluateWithAttributions(self):
      eval_config = config_pb2.EvalConfig(
          model_specs=[config_pb2.ModelSpec()],
          metrics_specs=[
              config_pb2.MetricsSpec(
                  metrics=[
                      config_pb2.MetricConfig(
                          class_name=attributions.TotalAttributions().__class__.__name__
                      )
                  ]
              )
          ],
          options=config_pb2.Options(
              disabled_outputs={"values": ["eval_config_pb2.json"]}
          ),
      )
      extractors = [slice_key_extractor.SliceKeyExtractor()]
      evaluators = [
          metrics_plots_and_validations_evaluator.MetricsPlotsAndValidationsEvaluator(
              eval_config=eval_config
          )
      ]
  
      example1 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "features": {},
          "attributions": {"feature1": 1.1, "feature2": 1.2},
      }
      example2 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "features": {},
          "attributions": {"feature1": 2.1, "feature2": 2.2},
      }
      example3 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "features": {},
          "attributions": {
              "feature1": np.array([3.1]),
              "feature2": np.array([3.2]),
          },
      }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          results = (
              pipeline
              | "Create" >> beam.Create([example1, example2, example3])
              | "ExtractEvaluate"
              >> model_eval_lib.ExtractAndEvaluate(
                  extractors=extractors, evaluators=evaluators
              )
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_attributions(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_attributions = got[0]
                  self.assertEqual(got_slice_key, ())
                  total_attributions_key = metric_types.MetricKey(
                      name="total_attributions"
                  )
                  self.assertIn(
                      total_attributions_key, got_attributions
                  )
                  self.assertDictElementsAlmostEqual(
                      got_attributions[total_attributions_key],
                      {
                          "feature1": (1.1 + 2.1 + 3.1),
                          "feature2": (1.2 + 2.2 + 3.2),
                      },
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(
              results[constants.ATTRIBUTIONS_KEY],
              check_attributions,
              label="attributions",
          )
  
imports: import os
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.addons.fairness.metrics import lift
  from tensorflow_model_analysis.api import model_eval_lib
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.eval_saved_model.example_trainers import dnn_classifier
  from tensorflow_model_analysis.eval_saved_model.example_trainers import fixed_prediction_estimator_extra_fields
  from tensorflow_model_analysis.eval_saved_model.example_trainers import linear_classifier
  from tensorflow_model_analysis.eval_saved_model.example_trainers import multi_head
  from tensorflow_model_analysis.evaluators import metrics_plots_and_validations_evaluator
  from tensorflow_model_analysis.extractors import example_weights_extractor
  from tensorflow_model_analysis.extractors import features_extractor
  from tensorflow_model_analysis.extractors import labels_extractor
  from tensorflow_model_analysis.extractors import legacy_predict_extractor
  from tensorflow_model_analysis.extractors import materialized_predictions_extractor
  from tensorflow_model_analysis.extractors import predictions_extractor
  from tensorflow_model_analysis.extractors import slice_key_extractor
  from tensorflow_model_analysis.extractors import unbatch_extractor
  from tensorflow_model_analysis.metrics import attributions
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import calibration
  from tensorflow_model_analysis.metrics import calibration_plot
  from tensorflow_model_analysis.metrics import confusion_matrix_plot
  from tensorflow_model_analysis.metrics import metric_specs
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import ndcg
  from tensorflow_model_analysis.post_export_metrics import metrics
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import validation_result_pb2
  from tfx_bsl.tfxio import raw_tf_record
  from tfx_bsl.tfxio import tensor_adapter
  from tfx_bsl.tfxio import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 9 for calling the MetricsPlotsAndValidationsEvaluatorTest obj's underlying member method code with example usage: obj.testEvaluateWithAttributions() without return types