code: def testBinaryConfusionMatricesPerRow(
      self,
      thresholds,
      example_ids_count,
      example_weights,
      example_ids,
      expected_result,
  ):
      labels = (0, 0, 1, 1)
      predictions = (0, 0.5, 0.3, 0.9)
  
      confusion_matrix = (
          binary_confusion_matrices.BinaryConfusionMatrices(
              thresholds=thresholds,
              example_ids_count=example_ids_count,
          )
      )
      accumulator = confusion_matrix.create_accumulator()
      for label, prediction, example_weight, example_id in zip(
          labels, predictions, example_weights, example_ids
      ):
          accumulator = confusion_matrix.add_input(
              accumulator=accumulator,
              labels=[label],
              predictions=[prediction],
              example_weights=[example_weight]
              if example_weight
              else None,
              example_id=example_id,
          )
      self.assertDictEqual(accumulator, expected_result)
  
file_path: model-analysis/tensorflow_model_analysis/contrib/aggregates/binary_confusion_matrices_test.py
imports: from absl.testing import parameterized
  import tensorflow
  from tensorflow_model_analysis.contrib.aggregates import binary_confusion_matrices
  from tensorflow_model_analysis.eval_saved_model import testutil
label_desc: Use image node_id 1 for calling the BinaryConfusionMatricesTest obj's underlying member method code with example usage: obj.testBinaryConfusionMatricesPerRow(thresholds, example_ids_count, example_weights, example_ids, expected_result) without return types