class_docstr: FlipeRate computes the rate at which predicitons between models switch.
  
  Given a pair of models and a threshold for converting continuous model outputs
  into boolean predictions, this metric will produce three numbers (keyed by
  separate MetricKeys):
  
  - (symmetric) flip rate: The number of times the boolean predictions don't
      match, regardless of the direction of the flip.
  - negative-to-positive flip rate: The rate at which the baseline model's
      boolean prediction is negative but the candidate model's is positive.
  - positive-to-negative flip rate: The rate at which the baseline model's
      boolean prediction is positive but the candidate model's is negative.
class_docstr_tok: ["FlipeRate","computes","the","rate","at","which","predicitons","between","models","switch",".","Given","a","pair","of","models","and","a","threshold","for","converting","continuous","model","outputs","into","boolean","predictions",",","this","metric","will","produce","three","numbers","(","keyed","by","separate","MetricKeys",")",":","-","(","symmetric",")","flip","rate",":","The","number","of","times","the","boolean","predictions","don't","match",",","regardless","of","the","direction","of","the","flip",".","-","negative-to-positive","flip","rate",":","The","rate","at","which","the","baseline","model's","boolean","prediction","is","negative","but","the","candidate","model","'s","is","positive",".","-","positive-to-negative","flip","rate",":","The","rate","at","which","the","baseline","model's","boolean","prediction","is","positive","but","the","candidate","model","'s","is","negative","."]
docstr: Initializes FlipRate metric.
  
  Args:
    threshold: The threshold to use for converting the model prediction into a
      boolean value that can be used for comparison between models.
    flip_rate_name: Metric name for symmetric flip rate.
    neg_to_neg_flip_rate_name: Metric name for the negative-to-negative flip
      rate.
    neg_to_pos_flip_rate_name: Metric name for the negative-to-positive flip
      rate.
    pos_to_neg_flip_rate_name: Metric name for the positive-to-negative flip
      rate.
    pos_to_pos_flip_rate_name: Metric name for the positive-to-positive flip
      rate.
docstr_tok: ["Initializes","FlipRate","metric",".","Args",":","threshold",":","The","threshold","to","use","for","converting","the","model","prediction","into","a","boolean","value","that","can","be","used","for","comparison","between","models",".","flip_rate_name",":","Metric","name","for","symmetric","flip","rate",".","neg_to_neg_flip_rate_name",":","Metric","name","for","the","negative-to-negative","flip","rate",".","neg_to_pos_flip_rate_name",":","Metric","name","for","the","negative-to-positive","flip","rate",".","pos_to_neg_flip_rate_name",":","Metric","name","for","the","positive-to-negative","flip","rate",".","pos_to_pos_flip_rate_name",":","Metric","name","for","the","positive-to-positive","flip","rate","."]
code: def __init__(
      self,
      threshold: float = _DEFAULT_FLIP_RATE_THRESHOLD,
      flip_rate_name: str = FLIP_RATE_NAME,
      neg_to_neg_flip_rate_name: str = NEG_TO_NEG_FLIP_RATE_NAME,
      neg_to_pos_flip_rate_name: str = NEG_TO_POS_FLIP_RATE_NAME,
      pos_to_neg_flip_rate_name: str = POS_TO_NEG_FLIP_RATE_NAME,
      pos_to_pos_flip_rate_name: str = POS_TO_POS_FLIP_RATE_NAME,
  ):
      """Initializes FlipRate metric.
  
      Args:
        threshold: The threshold to use for converting the model prediction into a
          boolean value that can be used for comparison between models.
        flip_rate_name: Metric name for symmetric flip rate.
        neg_to_neg_flip_rate_name: Metric name for the negative-to-negative flip
          rate.
        neg_to_pos_flip_rate_name: Metric name for the negative-to-positive flip
          rate.
        pos_to_neg_flip_rate_name: Metric name for the positive-to-negative flip
          rate.
        pos_to_pos_flip_rate_name: Metric name for the positive-to-positive flip
          rate.
      """
  
      super().__init__(
          _boolean_flip_rates_computations,
          threshold=threshold,
          flip_rate_name=flip_rate_name,
          neg_to_neg_flip_rate_name=neg_to_neg_flip_rate_name,
          neg_to_pos_flip_rate_name=neg_to_pos_flip_rate_name,
          pos_to_neg_flip_rate_name=pos_to_neg_flip_rate_name,
          pos_to_pos_flip_rate_name=pos_to_pos_flip_rate_name,
      )
  
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 1 to create a new BooleanFlipRates object from inherited base classes: metric_types with example: obj = BooleanFlipRates(threshold, flip_rate_name, neg_to_neg_flip_rate_name, neg_to_pos_flip_rate_name, pos_to_neg_flip_rate_name, pos_to_pos_flip_rate_name)