class_docstr: Reject option based classification (ROC) post-processor.
  
  Reject option classification is a post-processing technique that gives
  favorable outcomes to unprivileged groups and unfavorable outcomes to
  privileged groups in a confidence band around the decision boundary with the
  highest uncertainty [#kamiran12]_.
  
  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`, :class:`RejectOptionClassifierCV`
  
  References:
      .. [#kamiran12] `F. Kamiran, A. Karim, and X. Zhang, "Decision Theory
         for Discrimination-Aware Classification," IEEE International
         Conference on Data Mining, 2012.
         <https://ieeexplore.ieee.org/abstract/document/6413831>`_
  
  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.
      priv_group_ (scalar): The label of the privileged group.
  
  Examples:
      RejectOptionClassifier can be easily paired with GridSearchCV to
      find the best threshold and margin with respect to a fairness measure:
  
      >>> from sklearn.model_selection import GridSearchCV
      >>> roc = RejectOptionClassifier()
      >>> param = [{'threshold': [t],
                    'margin': np.arange(0.05, min(t, 1-t)+0.025, 0.05)}
      ...          for t in np.arange(0.05, 1., 0.05)]
      >>> stat_par = make_scorer(statistical_parity_difference)
      >>> scoring = {'bal_acc': 'balanced_accuracy', 'stat_par': stat_par}
      >>> def refit(cv_res):
      ...     return np.ma.array(cv_res['mean_test_bal_acc'],
      ...             mask=cv_res['mean_test_stat_par'] < -0.1).argmax()
      ...
      >>> grid = GridSearchCV(roc, param, scoring=scoring, refit=refit)
  
      Or, alternatively, this can be done in one step with
      RejectOptionClassifierCV:
  
      >>> grid = RejectOptionClassifierCV(scoring='statistical_parity')
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).
      threshold (scalar): Classification threshold. Probability estimates
          greater than this value are considered positive. Must be between
          0 and 1.
      margin (scalar): Half width of the critical region. Estimates within
          the critical region are "rejected" and assigned according to
          their group. Must be between 0 and min(threshold, 1-threshold).
      metric ('statistical_parity', 'average_odds', 'equal_opportunity',
          or callable):
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",")",".","threshold","(","scalar",")",":","Classification","threshold",".","Probability","estimates","greater","than","this","value","are","considered","positive",".","Must","be","between","0","and","1.","margin","(","scalar",")",":","Half","width","of","the","critical","region",".","Estimates","within","the","critical","region","are","``","rejected","''","and","assigned","according","to","their","group",".","Must","be","between","0","and","min","(","threshold",",","1-threshold",")",".","metric","(","'statistical_parity","'",",","'average_odds","'",",","'equal_opportunity","'",",","or","callable",")",":"]
code: def __init__(self, prot_attr=None, threshold=0.5, margin=0.1):
      """
      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).
          threshold (scalar): Classification threshold. Probability estimates
              greater than this value are considered positive. Must be between
              0 and 1.
          margin (scalar): Half width of the critical region. Estimates within
              the critical region are "rejected" and assigned according to
              their group. Must be between 0 and min(threshold, 1-threshold).
          metric ('statistical_parity', 'average_odds', 'equal_opportunity',
              or callable):
      """
      self.prot_attr = prot_attr
      self.threshold = threshold
      self.margin = margin
  
imports: import warnings
  import numpy
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.model_selection import GridSearchCV
  from sklearn.utils.validation import check_is_fitted
  from aif360.sklearn.metrics import statistical_parity_difference
  from aif360.sklearn.metrics import average_odds_error
  from aif360.sklearn.metrics import equal_opportunity_difference
  from aif360.sklearn.metrics import disparate_impact_ratio
  from aif360.sklearn.metrics import make_scorer
  from aif360.sklearn.utils import check_groups
label_desc: Use image node_id 1 to create a new RejectOptionClassifier object from inherited base classes: BaseEstimator, ClassifierMixin with example: obj = RejectOptionClassifier(prot_attr, threshold, margin)