holisticai.bias.mitigation.RejectOptionClassification#

class holisticai.bias.mitigation.RejectOptionClassification(*args, **kargs)[source]#

Reject option classification gives favorable outcomes (y=1) to unpriviliged groups and unfavorable outcomes (y=0) to priviliged groups in a confidence band around the decision boundary with the highest uncertainty.

Parameters

low_class_threshfloat

Smallest classification threshold to use in the optimization. Should be between 0. and 1.

low_class_threshfloat

Smallest classification threshold to use in the optimization. Should be between 0. and 1.

high_class_threshfloat

Highest classification threshold to use in the optimization. Should be between 0. and 1.

num_class_threshint

Number of classification thresholds between low_class_thresh and high_class_thresh for the optimization search. Should be > 0.

num_ROC_marginint

Number of relevant ROC margins to be used in the optimization search. Should be > 0.

metric_namestr

Name of the metric to use for the optimization. Allowed options are: “Statistical parity difference”, “Average odds difference”, “Equal opportunity difference”.

metric_ubfloat

Upper bound of constraint on the metric value

metric_lbfloat

Lower bound of constraint on the metric value

verboseint

If >0, will show progress percentage.

Examples

>>> from holisticai.bias.mitigation import RejectOptionClassification
>>> mitigator = RejectOptionClassification(**params)
>>> mitigator.fit(y, y_proba, group_a, group_b)
>>> test_data_transformed = mitigator.predict(y_pred, y_proba, group_a, group_b)

References

fit(y: ndarray, y_proba: ndarray, group_a: ndarray, group_b: ndarray)[source]#

Compute parameters for reject option classification strategy.

Description

Evaluate the likelihood with different thresholds. Select the threshold and ROC margin with the best fair metric value and highest balanced accuracy.

Parameters

yarray-like

Target vector (nb_examples,)

y_probamatrix-like

Predicted probability matrix (num_examples, num_classes). The probability estimates must sum to 1 across the possible classes and each matrix value must be in the interval [0,1].

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

Self

transform(y_pred: ndarray, y_proba: ndarray, group_a: ndarray, group_b: ndarray)[source]#

Obtain fair predictions using the ROC method.

Description

Predict the output using the fitted threshold and ROC margin.

Parameters

y_predarray-like

Predicted vector (nb_examples,)

y_probamatrix-like

Predicted probability matrix (num_examples, num_classes). The probability estimates must sum to 1 across the possible classes and each matrix value must be in the interval [0,1].

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

dict

A dictionary of new predictions