code: def testExactMatchScoreWithWeights(self):
      computations = exact_match.ExactMatch().computations(
          example_weighted=True
      )
      metric = computations[0]
      example1 = {
          "labels": np.array(["Test 1 two 3"]),
          "predictions": np.array(["Test 1 two 3"]),
          "example_weights": np.array([3.0]),
      }
      example2 = {
          "labels": np.array(["Testing"]),
          "predictions": np.array(["Dog"]),
          "example_weights": np.array([1.0]),
      }
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create" >> beam.Create([example1, example2])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "ComputeMetric" >> beam.CombinePerKey(metric.combiner)
          )
  
          # pylint: enable=no-value-for-parameter
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  key = metric.keys[0]
                  # example1 is a perfect match (score 100)
                  # example2 is a complete miss (score 0)
                  # average score: (1*3 + 0*1) / 4 = 0.75
                  self.assertDictElementsAlmostEqual(
                      got_metrics, {key: 0.75}, places=5
                  )
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
file_path: model-analysis/tensorflow_model_analysis/metrics/exact_match_test.py
imports: import json
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.metrics import exact_match
  from tensorflow_model_analysis.metrics import metric_util
label_desc: Use image node_id 2 for calling the ExactMatchTest obj's underlying member method code with example usage: obj.testExactMatchScoreWithWeights() without return types