docstr: :param fair_eval: a lambda function that is used to assess fairness
      (e.g. 80% rule)
  :param tau: the threshold for fair/unfair evaluation
  :param fair_measures_depend: a dictionary containing fairness measures
      as keys and the corresponding input bias disparity as values
  :param type_parity_depend: a dictionary with Type I, Type II, and
      Equalized Odds fairness measures as keys and lists of their
      underlying bias metric parities as values
  :param high_level_fairness_depend: a dictionary with supervised and
      unsupervised fairness as keys and lists of their underlying metric
      parities as values.
code: def __init__(
      self,
      fair_eval=None,
      tau=None,
      fair_measures_depend=None,
      type_parity_depend=None,
      high_level_fairness_depend=None,
  ):
      """
  
      :param fair_eval: a lambda function that is used to assess fairness
          (e.g. 80% rule)
      :param tau: the threshold for fair/unfair evaluation
      :param fair_measures_depend: a dictionary containing fairness measures
          as keys and the corresponding input bias disparity as values
      :param type_parity_depend: a dictionary with Type I, Type II, and
          Equalized Odds fairness measures as keys and lists of their
          underlying bias metric parities as values
      :param high_level_fairness_depend: a dictionary with supervised and
          unsupervised fairness as keys and lists of their underlying metric
          parities as values.
      """
  
      if not fair_eval:
          self.fair_eval = (
              lambda tau: lambda x: np.nan
              if np.isnan(x)
              else (True if tau <= x <= 1 / tau else False)
          )
      else:
          self.fair_eval = fair_eval
      # tau is the fairness_threshold and should be a real ]0.0 and 1.0]
      if not tau:
          self.tau = 0.8
      else:
          self.tau = tau
  
      # Set high-level fairness evaluation to NA (undefined) if both
      # underlying parity determinations are NA. If only one parity is NA,
      # evaluation is determined by the defined parity.
      self.high_level_pair_eval = (
          lambda col1, col2: lambda x: np.nan
          if (np.isnan(x[col1]) and np.isnan(x[col2]))
          else (
              True if (x[col1] is True and x[col2] is True) else False
          )
      )
  
      self.high_level_single_eval = (
          lambda col: lambda x: np.nan
          if np.isnan(x[col])
          else (True if x[col] is True else False)
      )
  
      # the fair_measures_depend define the bias metrics that serve as input to the fairness evaluation and respective
      # fairness measure. basically these are the fairness measures supported by the current version of aequitas.
  
      if not fair_measures_depend:
          self.fair_measures_depend = {
              "Statistical Parity": "ppr_disparity",
              "Impact Parity": "pprev_disparity",
              "FDR Parity": "fdr_disparity",
              "FPR Parity": "fpr_disparity",
              "FOR Parity": "for_disparity",
              "FNR Parity": "fnr_disparity",
              "TPR Parity": "tpr_disparity",
              "TNR Parity": "tnr_disparity",
              "NPV Parity": "npv_disparity",
              "Precision Parity": "precision_disparity",
          }
      else:
          self.fair_measures_depend = fair_measures_depend
  
      # the self.fair_measures represents the list of fairness_measures to be calculated by default
      self.fair_measures_supported = self.fair_measures_depend.keys()
  
      if not type_parity_depend:
          self.type_parity_depend = {
              "TypeI Parity": ["FDR Parity", "FPR Parity"],
              "TypeII Parity": ["FOR Parity", "FNR Parity"],
              "Equalized Odds": ["FPR Parity", "TPR Parity"],
          }
      else:
          self.type_parity_depend = type_parity_depend
  
      # high level fairness_depend define which input fairness measures are used to calculate the high level ones
      if not high_level_fairness_depend:
          self.high_level_fairness_depend = {
              "Unsupervised Fairness": [
                  "Statistical Parity",
                  "Impact Parity",
              ],
              "Supervised Fairness": ["TypeI Parity", "TypeII Parity"],
          }
      else:
          self.high_level_fairness_depend = high_level_fairness_depend
  
file_path: aequitas/src/aequitas/fairness.py
imports: import logging
  import numpy
  import pandas
label_desc: Use image node_id 1 to create a new Fairness object from inherited base classes: object with example: obj = Fairness(fair_eval, tau, fair_measures_depend, type_parity_depend, high_level_fairness_depend)