aif360.algorithms.postprocessing.CalibratedEqOddsPostprocessing¶
-
class
aif360.algorithms.postprocessing.CalibratedEqOddsPostprocessing(unprivileged_groups, privileged_groups, cost_constraint='weighted', seed=None)[source]¶ Calibrated equalized odds postprocessing 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 [7].
References
[7] G. Pleiss, M. Raghavan, F. Wu, J. Kleinberg, and K. Q. Weinberger, “On Fairness and Calibration,” Conference on Neural Information Processing Systems, 2017 Adapted from: https://github.com/gpleiss/equalized_odds_and_calibration/blob/master/calib_eq_odds.py
Parameters: Methods
fitCompute parameters for equalizing generalized odds using true and predicted scores, while preserving calibration. fit_predictfit and predict methods sequentially. fit_transformTrain a model on the input and transform the dataset accordingly. predictPerturb the predicted scores to obtain new labels that satisfy equalized odds constraints, while preserving calibration. transformReturn a new dataset generated by running this Transformer on the input. -
__init__(unprivileged_groups, privileged_groups, cost_constraint='weighted', seed=None)[source]¶ Parameters:
-
fit(dataset_true, dataset_pred)[source]¶ Compute parameters for equalizing generalized odds using true and predicted scores, while preserving calibration.
Parameters: - dataset_true (BinaryLabelDataset) – Dataset containing true
labels. - dataset_pred (BinaryLabelDataset) – Dataset containing predicted
scores.
Returns: CalibratedEqOddsPostprocessing – Returns self.
- dataset_true (BinaryLabelDataset) – Dataset containing true
-
fit_predict(dataset_true, dataset_pred, threshold=0.5)[source]¶ fit and predict methods sequentially.
-
predict(dataset, threshold=0.5)[source]¶ Perturb the predicted scores to obtain new labels that satisfy equalized odds constraints, while preserving calibration.
Parameters: - dataset (BinaryLabelDataset) – Dataset containing
scoresthat needs to be transformed. - threshold (float) – Threshold for converting
scorestolabels. Values greater than or equal to this threshold are predicted to be thefavorable_label. Default is 0.5.
Returns: dataset (BinaryLabelDataset) – transformed dataset.
- dataset (BinaryLabelDataset) – Dataset containing
-