code: def _binary_confusion_matrix_computation(
      thresholds: List[float],
      name: Optional[str] = None,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      sub_key: Optional[metric_types.SubKey] = None,
      extract_label_prediction_and_weight: Optional[
          Callable[..., Any]
      ] = metric_util.to_label_prediction_example_weight,
      preprocessors: Optional[List[metric_types.Preprocessor]] = None,
      example_id_key: Optional[str] = None,
      example_ids_count: Optional[int] = None,
      aggregation_type: Optional[metric_types.AggregationType] = None,
      class_weights: Optional[Dict[int, float]] = None,
      example_weighted: bool = False,
      enable_fractional_labels: bool = True,
  ) -> metric_types.MetricComputations:
      """Returns metric computations for computing binary confusion matrix."""
      if example_ids_count is None:
          example_ids_count = bcm_computations.DEFAULT_NUM_EXAMPLE_IDS
  
      key = metric_types.MetricKey(
          name=name,
          model_name=model_name,
          output_name=output_name,
          sub_key=sub_key,
          aggregation_type=aggregation_type,
          example_weighted=example_weighted,
      )
  
      return [
          metric_types.MetricComputation(
              keys=[key],
              preprocessors=preprocessors,
              combiner=_BinaryConfusionMatrixCombiner(
                  key=key,
                  eval_config=eval_config,
                  thresholds=thresholds,
                  extract_label_prediction_and_weight=extract_label_prediction_and_weight,
                  example_id_key=example_id_key,
                  example_ids_count=example_ids_count,
                  aggregation_type=aggregation_type,
                  class_weights=class_weights,
                  example_weighted=example_weighted,
                  enable_fractional_labels=enable_fractional_labels,
              ),
          )
      ]
  
imports: from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.contrib.aggregates import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import calibration_histogram
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: _binary_confusion_matrix_computation(thresholds, name, eval_config, model_name, output_name, sub_key, extract_label_prediction_and_weight, preprocessors, example_id_key, example_ids_count, aggregation_type, class_weights, example_weighted, enable_fractional_labels) and returns: list