class_docstr: Metrics that can be used to evaluate the following fairness metrics.
  
    * Demographic Parity or Equality of Outcomes.
      For each slice measure the Positive* Rate, or the percentage of all
      examples receiving positive scores.
    * Equality of Opportunity
      Equality of Opportunity attempts to match the True Positive* rate
      (aka recall) of different data slices.
    * Equality of Odds
      In addition to looking at Equality of Opportunity, looks at equalizing the
      False Positive* rates of slices as well.
  
  The choice to focus on these metrics as a starting point is based primarily on
  the paper Equality of Opportunity in Supervised Learning and the excellent
  visualization created as a companion to the paper.
  
  https://arxiv.org/abs/1610.02413
  http://research.google.com/bigpicture/attacking-discrimination-in-ml/
  
  * Note that these fairness formulations assume that a positive prediction is
  associated with a positive outcome for the user--in certain contexts such as
  abuse, positive predictions translate to non-opportunity. You may want to use
  the provided negative rates for comparison instead.
class_docstr_tok: ["Metrics","that","can","be","used","to","evaluate","the","following","fairness","metrics",".","*","Demographic","Parity","or","Equality","of","Outcomes",".","For","each","slice","measure","the","Positive","*","Rate",",","or","the","percentage","of","all","examples","receiving","positive","scores",".","*","Equality","of","Opportunity","Equality","of","Opportunity","attempts","to","match","the","True","Positive","*","rate","(","aka","recall",")","of","different","data","slices",".","*","Equality","of","Odds","In","addition","to","looking","at","Equality","of","Opportunity",",","looks","at","equalizing","the","False","Positive","*","rates","of","slices","as","well",".","The","choice","to","focus","on","these","metrics","as","a","starting","point","is","based","primarily","on","the","paper","Equality","of","Opportunity","in","Supervised","Learning","and","the","excellent","visualization","created","as","a","companion","to","the","paper",".","https",":","\/\/arxiv.org\/abs\/1610.02413","http",":","\/\/research.google.com\/bigpicture\/attacking-discrimination-in-ml\/","*","Note","that","these","fairness","formulations","assume","that","a","positive","prediction","is","associated","with","a","positive","outcome","for","the","user","--","in","certain","contexts","such","as","abuse",",","positive","predictions","translate","to","non-opportunity",".","You","may","want","to","use","the","provided","negative","rates","for","comparison","instead","."]
code: def __init__(
      self,
      thresholds: Optional[List[float]] = None,
      example_weight_key: Optional[str] = None,
      target_prediction_keys: Optional[List[str]] = None,
      labels_key: Optional[str] = None,
      metric_tag: Optional[str] = None,
      tensor_index: Optional[int] = None,
  ) -> None:
      if not thresholds:
          thresholds = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
  
      # Determine the number of threshold digits to display as part of the metric
      # key. We want lower numbers for readability, but allow differentiation
      # between close thresholds.
      self._key_digits = 2
      for t in thresholds:
          if len(str(t)) - 2 > self._key_digits:
              self._key_digits = len(str(t)) - 2
  
      super().__init__(
          thresholds,
          example_weight_key,
          target_prediction_keys,
          labels_key,
          metric_tag,
          tensor_index=tensor_index,
      )
  
file_path: model-analysis/tensorflow_model_analysis/addons/fairness/post_export_metrics/fairness_indicators.py
imports: from typing import Any, Dict, List, Optional, Tuple
  import tensorflow
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.post_export_metrics import metric_keys
  from tensorflow_model_analysis.post_export_metrics import post_export_metrics
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
label_desc: Use image node_id 1 to create a new _FairnessIndicators object from inherited base classes: post_export_metrics with example: obj = _FairnessIndicators(thresholds, example_weight_key, target_prediction_keys, labels_key, metric_tag, tensor_index)