code: def testFairessIndicatorsMetricsGeneral(self):
      computations = fairness_indicators.FairnessIndicators(
          thresholds=[0.3, 0.7]
      ).computations()
      histogram = computations[0]
      matrices = computations[1]
      metrics = computations[2]
      examples = [
          {
              "labels": np.array([0.0]),
              "predictions": np.array([0.1]),
              "example_weights": np.array([1.0]),
          },
          {
              "labels": np.array([0.0]),
              "predictions": np.array([0.5]),
              "example_weights": np.array([1.0]),
          },
          {
              "labels": np.array([1.0]),
              "predictions": np.array([0.5]),
              "example_weights": np.array([1.0]),
          },
          {
              "labels": np.array([1.0]),
              "predictions": np.array([0.9]),
              "example_weights": np.array([1.0]),
          },
      ]
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create" >> beam.Create(examples)
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "ComputeHistogram"
              >> beam.CombinePerKey(histogram.combiner)
              | "ComputeMatrices"
              >> beam.Map(
                  lambda x: (x[0], matrices.result(x[1]))
              )  # pyformat: ignore
              | "ComputeMetrics"
              >> beam.Map(lambda x: (x[0], metrics.result(x[1])))
          )  # pyformat: ignore
  
          # 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, ())
                  np.testing.assert_equal(
                      got_metrics,
                      {
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_positive_rate@0.3"
                          ): 0.5,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_negative_rate@0.3"
                          ): 0.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/true_positive_rate@0.3"
                          ): 1.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/true_negative_rate@0.3"
                          ): 0.5,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/positive_rate@0.3"
                          ): 0.75,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/negative_rate@0.3"
                          ): 0.25,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_discovery_rate@0.3"
                          ): 1.0
                          / 3.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_omission_rate@0.3"
                          ): 0.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/precision@0.3"
                          ): 2.0
                          / 3.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/recall@0.3"
                          ): 1.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_positive_rate@0.7"
                          ): 0.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_negative_rate@0.7"
                          ): 0.5,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/true_positive_rate@0.7"
                          ): 0.5,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/true_negative_rate@0.7"
                          ): 1.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/positive_rate@0.7"
                          ): 0.25,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/negative_rate@0.7"
                          ): 0.75,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_discovery_rate@0.7"
                          ): 0.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/false_omission_rate@0.7"
                          ): 1.0
                          / 3.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/precision@0.7"
                          ): 1.0,
                          metric_types.MetricKey(
                              name="fairness_indicators_metrics/recall@0.7"
                          ): 0.5,
                      },
                  )
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
file_path: model-analysis/tensorflow_model_analysis/addons/fairness/metrics/fairness_indicators_test.py
imports: import math
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import pandas
  import tensorflow
  from tensorflow_model_analysis.addons.fairness.metrics import fairness_indicators
  from tensorflow_model_analysis.api import model_eval_lib
  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.proto import config_pb2
label_desc: Use image node_id 1 for calling the FairnessIndicatorsTest obj's underlying member method code with example usage: obj.testFairessIndicatorsMetricsGeneral() without return types