code: def conditional_demographic_disparity(
      y_true,
      y_pred=None,
      *,
      prot_attr=None,
      pos_label=1,
      sample_weight=None,
  ):
      r"""Conditional demographic disparity, :math:`CDD = \frac{1}{\sum_i N_i}
      \sum_i N_i\cdot DD_i`
  
      where :math:`DD_i = \frac{N_{i, -}}{\sum_j N_{j, -}} - \frac{N_{i, +}}{
      \sum_j N_{j, +}}`.
  
      :math:`N_{i, +}` signifies the number of samples belonging to group
      :math:`i` that have favorable labels while :math:`N_{i, -}` signifies those
      that have negative labels [#watcher21]_.
  
      Args:
          y_true (pandas.Series): Ground truth (correct) target values. If y_pred
              is provided, this is ignored.
          y_pred (array-like): 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.
          pos_label (scalar, optional): The label of the positive class.
          sample_weight (array-like, optional): Sample weights.
  
      Returns:
          float: Conditional demographic disparity.
  
      References:
          .. [#watcher21] `S. Wachter, B. Mittelstadt, and C. Russell, "Why
             fairness cannot be automated: Bridging the gap between EU
             non-discrimination law and AI," Computer Law & Security Review,
             Volume 41, 2021. <https://doi.org/10.1016/j.clsr.2021.105567>`_
      """
  
      def dd(
          y_true,
          y_pred=None,
          pop_pos=1,
          pop_neg=1,
          pos_label=1,
          sample_weight=None,
      ):
          y_group = y_true if y_pred is None else y_pred
          y_pos, y_neg = num_pos_neg(
              y_group, pos_label=pos_label, sample_weight=sample_weight
          )
          return y_neg / pop_neg - y_pos / pop_pos
  
      pop_pos, pop_neg = num_pos_neg(
          y_true,
          y_pred,
          pos_label=pos_label,
          sample_weight=sample_weight,
      )
      ddi = intersection(
          dd,
          y_true,
          y_pred,
          pop_pos=pop_pos,
          pop_neg=pop_neg,
          prot_attr=prot_attr,
          pos_label=pos_label,
          sample_weight=sample_weight,
      )
      n = intersection(
          num_samples,
          y_true,
          prot_attr=prot_attr,
          sample_weight=sample_weight,
      )
      return np.dot(n, ddi) / sum(n)
  
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 25 for calling a global function with example usage: conditional_demographic_disparity(y_true, y_pred) and returns: unknown, unknown