class_docstr: A combiner which computes boolean flip rate metrics.
class_docstr_tok: ["A","combiner","which","computes","boolean","flip","rate","metrics","."]
code: def add_input(
      self,
      accumulator: _BooleanFlipRatesAccumulator,
      element: metric_types.StandardMetricInputs,
  ) -> _BooleanFlipRatesAccumulator:
      _, base_prediction, base_example_weight = next(
          metric_util.to_label_prediction_example_weight(
              element,
              eval_config=self._eval_config,
              model_name=self._baseline_model_name,
              output_name=self._output_name,
              flatten=True,
              example_weighted=self._example_weighted,
              allow_none=True,
          )
      )
  
      _, model_prediction, _ = next(
          metric_util.to_label_prediction_example_weight(
              element,
              eval_config=self._eval_config,
              model_name=self._model_name,
              output_name=self._output_name,
              flatten=True,
              example_weighted=self._example_weighted,
              allow_none=True,
          )
      )
      base_example_weight = metric_util.safe_to_scalar(
          base_example_weight
      )
      accumulator.num_weighted_examples += base_example_weight
      base_prediciton_bool = base_prediction > self._threshold
      model_prediction_bool = model_prediction > self._threshold
      accumulator.num_weighted_neg_to_neg += base_example_weight * int(
          not base_prediciton_bool and not model_prediction_bool
      )
      accumulator.num_weighted_neg_to_pos += base_example_weight * int(
          not base_prediciton_bool and model_prediction_bool
      )
      accumulator.num_weighted_pos_to_neg += base_example_weight * int(
          base_prediciton_bool and not model_prediction_bool
      )
      accumulator.num_weighted_pos_to_pos += base_example_weight * int(
          base_prediciton_bool and model_prediction_bool
      )
      return accumulator
  
file_path: model-analysis/tensorflow_model_analysis/metrics/flip_metrics.py
imports: import dataclasses
  from typing import Optional, Iterable, List
  import apache_beam
  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.utils import model_util
label_desc: Use image node_id 3 for calling the _BooleanFlipRatesCombiner obj's underlying member method code with example usage: obj.add_input(accumulator, element) and returns: accumulator