code: def disparate_impact_ratio(
      y_true,
      y_pred=None,
      *,
      prot_attr=None,
      priv_group=1,
      pos_label=1,
      sample_weight=None,
      zero_division="warn",
  ):
      r"""Ratio of selection rates.
  
      .. math::
          \frac{Pr(\hat{Y} = \text{pos_label} | D = \text{unprivileged})}
          {Pr(\hat{Y} = \text{pos_label} | D = \text{privileged})}
  
      Note:
          If only y_true is provided, this will return the ratio of base rates
          (disparate impact of the original dataset). If both y_true and y_pred
          are provided, only y_pred is used.
  
      Args:
          y_true (pandas.Series): Ground truth (correct) target values. If y_pred
              is provided, this is ignored.
          y_pred (array-like, optional): Estimated targets as returned by a
              classifier.
          prot_attr (array-like, keyword-only): Protected attribute(s). If
              ``None``, all protected attributes in y_true are used.
          priv_group (scalar, optional): The label of the privileged group.
          pos_label (scalar, optional): The label of the positive class.
          sample_weight (array-like, optional): Sample weights.
          zero_division ('warn', 0 or 1): Sets the value to return when there is a
              zero division. If set to “warn”, this acts as 0, but warnings are
              also raised.
  
      Returns:
          float: Disparate impact.
  
      See also:
          :func:`selection_rate`, :func:`base_rate`
      """
      rate = base_rate if y_pred is None else selection_rate
      return ratio(
          rate,
          y_true,
          y_pred,
          prot_attr=prot_attr,
          priv_group=priv_group,
          pos_label=pos_label,
          sample_weight=sample_weight,
          zero_division=zero_division,
      )
  
imports: from itertools import permutations
  from typing import Union
  import warnings
  import numpy
  import pandas
  from scipy.special import rel_entr
  from sklearn.metrics import make_scorer, recall_score, precision_score
  from sklearn.metrics import multilabel_confusion_matrix
  from sklearn.metrics._classification import _prf_divide, _check_zero_division
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_X_y
  from aif360.metrics import ot_metric
  from aif360.sklearn.utils import check_inputs, check_groups
  from aif360.detectors.mdss.ScoringFunctions import BerkJones, Bernoulli
  from aif360.detectors.mdss.MDSS import MDSS
label_desc: Use image node_id 18 for calling a global function with example usage: disparate_impact_ratio(y_true, y_pred) and returns: ratio