class_docstr: Calibrated equalized odds post-processor.
  
  Calibrated equalized odds is a post-processing technique that optimizes over
  calibrated classifier score outputs to find probabilities with which to
  change output labels with an equalized odds objective [#pleiss17]_.
  
  Note:
      A :class:`~sklearn.pipeline.Pipeline` expects a single estimation step
      but this class requires an estimator's predictions as input. See
      :class:`PostProcessingMeta` for a workaround.
  
  See also:
      :class:`PostProcessingMeta`
  
  References:
      .. [#pleiss17] `G. Pleiss, M. Raghavan, F. Wu, J. Kleinberg, and
         K. Q. Weinberger, "On Fairness and Calibration," Conference on Neural
         Information Processing Systems, 2017.
         <http://papers.nips.cc/paper/7151-on-fairness-and-calibration.pdf>`_
  
  Adapted from:
  https://github.com/gpleiss/equalized_odds_and_calibration/blob/master/calib_eq_odds.py
  
  Attributes:
      prot_attr_ (str or list(str)): Protected attribute(s) used for post-
          processing.
      groups_ (array, shape (2,)): A list of group labels known to the
          classifier. Note: this algorithm require a binary division of the
          data.
      classes_ (array, shape (num_classes,)): A list of class labels known to
          the classifier. Note: this algorithm treats all non-positive
          outcomes as negative (binary classification only).
      pos_label_ (scalar): The label of the positive class.
      mix_rates_ (array, shape (2,)): The interpolation parameters -- the
          probability of randomly returning the group's base rate. The group
          for which the cost function is higher is set to 0.
class_docstr_tok: ["Calibrated","equalized","odds","post-processor",".","Calibrated","equalized","odds","is","a","post-processing","technique","that","optimizes","over","calibrated","classifier","score","outputs","to","find","probabilities","with","which","to","change","output","labels","with","an","equalized","odds","objective","[","#","pleiss17","]","_",".","Note",":","A",":","class",":","`","~sklearn.pipeline.Pipeline","`","expects","a","single","estimation","step","but","this","class","requires","an","estimator","'s","predictions","as","input",".","See",":","class",":","`","PostProcessingMeta","`","for","a","workaround",".","See","also",":",":","class",":","`","PostProcessingMeta","`","References",":","..","[","#","pleiss17","]","`","G.","Pleiss",",","M.","Raghavan",",","F.","Wu",",","J.","Kleinberg",",","and","K.","Q.","Weinberger",",","``","On","Fairness","and","Calibration",",","''","Conference","on","Neural","Information","Processing","Systems",",","2017",".","<","http",":","\/\/papers.nips.cc\/paper\/7151-on-fairness-and-calibration.pdf",">","`","_","Adapted","from",":","https",":","\/\/github.com\/gpleiss\/equalized_odds_and_calibration\/blob\/master\/calib_eq_odds.py","Attributes",":","prot_attr_","(","str","or","list","(","str",")",")",":","Protected","attribute","(","s",")","used","for","post-","processing",".","groups_","(","array",",","shape","(","2",",",")",")",":","A","list","of","group","labels","known","to","the","classifier",".","Note",":","this","algorithm","require","a","binary","division","of","the","data",".","classes_","(","array",",","shape","(","num_classes",",",")",")",":","A","list","of","class","labels","known","to","the","classifier",".","Note",":","this","algorithm","treats","all","non-positive","outcomes","as","negative","(","binary","classification","only",")",".","pos_label_","(","scalar",")",":","The","label","of","the","positive","class",".","mix_rates_","(","array",",","shape","(","2",",",")",")",":","The","interpolation","parameters","--","the","probability","of","randomly","returning","the","group","'s","base","rate",".","The","group","for","which","the","cost","function","is","higher","is","set","to","0","."]
docstr: Args:
      prot_attr (single label or list-like, optional): Protected
          attribute(s) to use in the post-processing. If more than one
          attribute, all combinations of values (intersections) are
          considered. Default is ``None`` meaning all protected attributes
          from the dataset are used. Note: This algorithm requires there
          be exactly 2 groups (privileged and unprivileged).
      cost_constraint ('fpr', 'fnr', or 'weighted'): Which equal-cost
          constraint to satisfy: generalized false positive rate ('fpr'),
          generalized false negative rate ('fnr'), or a weighted
          combination of both ('weighted').
      random_state (int or numpy.RandomState, optional): Seed of pseudo-
          random number generator for sampling from the mix rates.
docstr_tok: ["Args",":","prot_attr","(","single","label","or","list-like",",","optional",")",":","Protected","attribute","(","s",")","to","use","in","the","post-processing",".","If","more","than","one","attribute",",","all","combinations","of","values","(","intersections",")","are","considered",".","Default","is","``","None","``","meaning","all","protected","attributes","from","the","dataset","are","used",".","Note",":","This","algorithm","requires","there","be","exactly","2","groups","(","privileged","and","unprivileged",")",".","cost_constraint","(","'fpr","'",",","'fnr","'",",","or","'weighted","'",")",":","Which","equal-cost","constraint","to","satisfy",":","generalized","false","positive","rate","(","'fpr","'",")",",","generalized","false","negative","rate","(","'fnr","'",")",",","or","a","weighted","combination","of","both","(","'weighted","'",")",".","random_state","(","int","or","numpy.RandomState",",","optional",")",":","Seed","of","pseudo-","random","number","generator","for","sampling","from","the","mix","rates","."]
code: def __init__(
      self,
      prot_attr=None,
      cost_constraint="weighted",
      random_state=None,
  ):
      """
      Args:
          prot_attr (single label or list-like, optional): Protected
              attribute(s) to use in the post-processing. If more than one
              attribute, all combinations of values (intersections) are
              considered. Default is ``None`` meaning all protected attributes
              from the dataset are used. Note: This algorithm requires there
              be exactly 2 groups (privileged and unprivileged).
          cost_constraint ('fpr', 'fnr', or 'weighted'): Which equal-cost
              constraint to satisfy: generalized false positive rate ('fpr'),
              generalized false negative rate ('fnr'), or a weighted
              combination of both ('weighted').
          random_state (int or numpy.RandomState, optional): Seed of pseudo-
              random number generator for sampling from the mix rates.
      """
      self.prot_attr = prot_attr
      self.cost_constraint = cost_constraint
      self.random_state = random_state
  
file_path: AIF360/aif360/sklearn/postprocessing/calibrated_equalized_odds.py
imports: import numpy
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
  from aif360.sklearn.metrics import difference, base_rate
  from aif360.sklearn.metrics import generalized_fnr, generalized_fpr
  from aif360.sklearn.utils import check_inputs, check_groups
label_desc: Use image node_id 1 to create a new CalibratedEqualizedOdds object from inherited base classes: BaseEstimator, ClassifierMixin with example: obj = CalibratedEqualizedOdds(prot_attr, cost_constraint, random_state)