class_docstr: Computes binary confusion matrix.
docstr: Initializes the class.
  
  Args:
    thresholds: A specific set of thresholds to use. The caller is responsible
      for marking the boundaries with +/-epsilon if desired.
    example_ids_count: Max number of example ids to be extracted for each
      result in the binary confusion matrix (tp, tn, fp, and fn).
    enable_fractional_labels: If false, labels will be compared to the
      threshold in the same way predictions are. If true, each incoming tuple
      of (label, prediction, and example weight) will be split into two tuples
      as follows (where l, p, w represent the resulting label, prediction, and
      example weight values): (1) l = 0.0, p = prediction, and w =
      example_weight * (1.0 - label) (2) l = 1.0, p = prediction, and w =
      example_weight * label. If enabled, an exception will be raised if
      labels are not within [0, 1]. The implementation is such that tuples
      associated with a weight of zero are not yielded. This means it is safe
      to enable fractional labels even when the labels only take on the values
      of 0.0 or 1.0.
code: def __init__(
      self,
      thresholds: Sequence[float],
      example_ids_count: int = DEFAULT_NUM_EXAMPLE_IDS,
      enable_fractional_labels: bool = True,
  ):
      """Initializes the class.
  
      Args:
        thresholds: A specific set of thresholds to use. The caller is responsible
          for marking the boundaries with +/-epsilon if desired.
        example_ids_count: Max number of example ids to be extracted for each
          result in the binary confusion matrix (tp, tn, fp, and fn).
        enable_fractional_labels: If false, labels will be compared to the
          threshold in the same way predictions are. If true, each incoming tuple
          of (label, prediction, and example weight) will be split into two tuples
          as follows (where l, p, w represent the resulting label, prediction, and
          example weight values): (1) l = 0.0, p = prediction, and w =
          example_weight * (1.0 - label) (2) l = 1.0, p = prediction, and w =
          example_weight * label. If enabled, an exception will be raised if
          labels are not within [0, 1]. The implementation is such that tuples
          associated with a weight of zero are not yielded. This means it is safe
          to enable fractional labels even when the labels only take on the values
          of 0.0 or 1.0.
      """
      self._thresholds = thresholds
      self._example_ids_count = example_ids_count
      self._enable_fractional_labels = enable_fractional_labels
  
file_path: model-analysis/tensorflow_model_analysis/contrib/aggregates/binary_confusion_matrices.py
imports: from typing import Dict, Iterable, List, NamedTuple, Optional, Sequence
  from tensorflow_model_analysis.experimental.lazytf import api
label_desc: Use image node_id 1 to create a new BinaryConfusionMatrices object from inherited base classes: lazytf with example: obj = BinaryConfusionMatrices(thresholds, example_ids_count, enable_fractional_labels)