code: def testMultiClassMetricsUsingKerasConfig(
      self, metric_name, expected_value
  ):
      metric = tf_metric_wrapper.tf_metric_computations(
          [self._tf_metric_by_name(metric_name)], example_weighted=True
      )[0]
  
      # top_k = 2
      #   TP = 0.5*0 + 0.7*1 + 0.9*1 + 0.3*0 = 1.6
      #   FP = 0.5*2 + 0.7*1 + 0.9*1 + 0.3*2 = 3.2
      #   FN = 0.5*1 + 0.7*0 + 0.9*0 + 0.3*1 = 0.8
      #
      # top_k = 3
      #   TP = 0.5*0 + 0.7*1 + 0.9*1 + 0.3*1 = 1.9
      #   FP = 0.5*3 + 0.7*2 + 0.9*2 + 0.3*2 = 5.3
      #   FN = 0.5*1 + 0.7*0 + 0.9*0 + 0.3*0 = 0.5
      example1 = {
          "labels": np.array([2]),
          "predictions": np.array([0.1, 0.2, 0.1, 0.25, 0.35]),
          "example_weights": np.array([0.5]),
      }
      example2 = {
          "labels": np.array([1]),
          "predictions": np.array([0.2, 0.3, 0.05, 0.15, 0.3]),
          "example_weights": np.array([0.7]),
      }
      example3 = {
          "labels": np.array([3]),
          "predictions": np.array([0.01, 0.2, 0.09, 0.5, 0.2]),
          "example_weights": np.array([0.9]),
      }
      example4 = {
          "labels": np.array([1]),
          "predictions": np.array([0.3, 0.2, 0.05, 0.4, 0.05]),
          "example_weights": np.array([0.3]),
      }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create"
              >> beam.Create([example1, example2, example3, example4])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "Combine" >> 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, ())
                  top_k = int(metric_name.split("@")[1])
                  key = metric_types.MetricKey(
                      name=metric_name,
                      sub_key=metric_types.SubKey(top_k=top_k),
                      example_weighted=True,
                  )
                  self.assertDictElementsAlmostEqual(
                      got_metrics, {key: expected_value}, places=5
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
imports: 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 metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_wrapper
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 6 for calling the ConfusionMatrixMetricsTest obj's underlying member method code with example usage: obj.testMultiClassMetricsUsingKerasConfig(metric_name, expected_value) without return types