code: def equalized_odds_difference(
      y_true,
      y_pred,
      *,
      sensitive_features,
      method="between_groups",
      sample_weight=None,
  ) -> float:
      """Calculate the equalized odds difference.
  
      The greater of two metrics: `true_positive_rate_difference` and
      `false_positive_rate_difference`. The former is the difference between the
      largest and smallest of :math:`P[h(X)=1 | A=a, Y=1]`, across all values :math:`a`
      of the sensitive feature(s). The latter is defined similarly, but for
      :math:`P[h(X)=1 | A=a, Y=0]`.
      The equalized odds difference of 0 means that all groups have the same
      true positive, true negative, false positive, and false negative rates.
  
      Read more in the :ref:`User Guide <disparity_metrics>`.
  
      Parameters
      ----------
      y_true : array-like
          Ground truth (correct) labels.
  
      y_pred : array-like
          Predicted labels :math:`h(X)` returned by the classifier.
  
      sensitive_features : array-like
          The sensitive features over which demographic parity should be assessed
  
      method : str
          How to compute the differences. See :func:`fairlearn.metrics.MetricFrame.difference`
          for details.
  
      sample_weight : array-like
          The sample weights
  
      Returns
      -------
      float
          The equalized odds difference
      """
      eo = _get_eo_frame(
          y_true, y_pred, sensitive_features, sample_weight
      )
  
      return max(eo.difference(method=method))
  
file_path: fairlearn/fairlearn/metrics/_fairness_metrics.py
imports: from ._base_metrics import false_positive_rate, selection_rate, true_positive_rate
  from ._metric_frame import MetricFrame
label_desc: Use image node_id 3 for calling a global function with example usage: equalized_odds_difference(y_true, y_pred) and returns: max