aif360.algorithms.postprocessing
.RejectOptionClassification¶
-
class
aif360.algorithms.postprocessing.
RejectOptionClassification
(unprivileged_groups, privileged_groups, low_class_thresh=0.01, high_class_thresh=0.99, num_class_thresh=100, num_ROC_margin=50, metric_name='Statistical parity difference', metric_ub=0.05, metric_lb=-0.05)[source]¶ Reject option classification is a postprocessing technique that gives favorable outcomes to unpriviliged groups and unfavorable outcomes to priviliged groups in a confidence band around the decision boundary with the highest uncertainty [10].
References
[10] F. Kamiran, A. Karim, and X. Zhang, “Decision Theory for Discrimination-Aware Classification,” IEEE International Conference on Data Mining, 2012. Parameters: - unprivileged_groups (dict or list(dict)) – Representation for unprivileged group.
- privileged_groups (dict or list(dict)) – Representation for privileged group.
- low_class_thresh (float) – Smallest classification threshold to use in the optimization. Should be between 0. and 1.
- high_class_thresh (float) – Highest classification threshold to use in the optimization. Should be between 0. and 1.
- num_class_thresh (int) – Number of classification thresholds between low_class_thresh and high_class_thresh for the optimization search. Should be > 0.
- num_ROC_margin (int) – Number of relevant ROC margins to be used in the optimization search. Should be > 0.
- metric_name (str) – Name of the metric to use for the optimization. Allowed options are “Statistical parity difference”, “Average odds difference”, “Equal opportunity difference”.
- metric_ub (float) – Upper bound of constraint on the metric value
- metric_lb (float) – Lower bound of constraint on the metric value
Methods
fit
Estimates the optimal classification threshold and margin for reject option classification that optimizes the metric provided. fit_predict
fit and predict methods sequentially. fit_transform
Train a model on the input and transform the dataset accordingly. predict
Obtain fair predictions using the ROC method. transform
Return a new dataset generated by running this Transformer on the input. -
__init__
(unprivileged_groups, privileged_groups, low_class_thresh=0.01, high_class_thresh=0.99, num_class_thresh=100, num_ROC_margin=50, metric_name='Statistical parity difference', metric_ub=0.05, metric_lb=-0.05)[source]¶ Parameters: - unprivileged_groups (dict or list(dict)) – Representation for unprivileged group.
- privileged_groups (dict or list(dict)) – Representation for privileged group.
- low_class_thresh (float) – Smallest classification threshold to use in the optimization. Should be between 0. and 1.
- high_class_thresh (float) – Highest classification threshold to use in the optimization. Should be between 0. and 1.
- num_class_thresh (int) – Number of classification thresholds between low_class_thresh and high_class_thresh for the optimization search. Should be > 0.
- num_ROC_margin (int) – Number of relevant ROC margins to be used in the optimization search. Should be > 0.
- metric_name (str) – Name of the metric to use for the optimization. Allowed options are “Statistical parity difference”, “Average odds difference”, “Equal opportunity difference”.
- metric_ub (float) – Upper bound of constraint on the metric value
- metric_lb (float) – Lower bound of constraint on the metric value
-
fit
(dataset_true, dataset_pred)[source]¶ Estimates the optimal classification threshold and margin for reject option classification that optimizes the metric provided.
Note
The
fit
function is a no-op for this algorithm.Parameters: - dataset_true (BinaryLabelDataset) – Dataset containing the true
labels
. - dataset_pred (BinaryLabelDataset) – Dataset containing the predicted
scores
.
Returns: RejectOptionClassification – Returns self.
- dataset_true (BinaryLabelDataset) – Dataset containing the true
-
predict
(dataset)[source]¶ Obtain fair predictions using the ROC method.
Parameters: dataset (BinaryLabelDataset) – Dataset containing scores that will be used to compute predicted labels. Returns: dataset_pred (BinaryLabelDataset) – Output dataset with potentially fair predictions obtain using the ROC method.