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: Predict class labels for the given scores.
  
  Args:
      X (pandas.DataFrame): Probability estimates of the targets as
          returned by a ``predict_proba()`` call or equivalent. Note: must
          include protected attributes in the index.
  
  Returns:
      numpy.ndarray: Predicted class label per sample.
docstr_tok: ["Predict","class","labels","for","the","given","scores",".","Args",":","X","(","pandas.DataFrame",")",":","Probability","estimates","of","the","targets","as","returned","by","a","``","predict_proba","(",")","``","call","or","equivalent",".","Note",":","must","include","protected","attributes","in","the","index",".","Returns",":","numpy.ndarray",":","Predicted","class","label","per","sample","."]
code: def predict(self, X):
      """Predict class labels for the given scores.
  
      Args:
          X (pandas.DataFrame): Probability estimates of the targets as
              returned by a ``predict_proba()`` call or equivalent. Note: must
              include protected attributes in the index.
  
      Returns:
          numpy.ndarray: Predicted class label per sample.
      """
      scores = self.predict_proba(X)
      pos_idx = np.nonzero(self.classes_ == self.pos_label_)[0][0]
      y_pred = (scores[:, pos_idx] > self.threshold).astype(int)
      return self.classes_[y_pred if pos_idx == 1 else 1 - y_pred]
  
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 5 for calling the RejectOptionClassifier obj's underlying member method code with example usage: obj.predict(X) and returns: self