holisticai.bias.mitigation.PluginEstimationAndCalibration#

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

Plugin Estimation and Calibration postprocessing [1] optimizes over calibrated regressor outputs via a smooth optimization. The rates of convergence of the proposed estimator were derived in terms of the risk and fairness constraint.

Parameters

Lint

The number of thresholds to estimate.

betafloat

The regularization parameter

Examples

>>> from holisticai.bias.mitigation import PluginEstimationAndCalibration
>>> mitigator = PluginEstimationAndCalibration()
>>> mitigator.fit_transform(y_pred, group_a, group_b)
>>> test_data_transformed = mitigator.transform(y_pred, group_a, group_b)

References

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

Compute a fair regression function by minimizing the squared error subject to a fairness constraint.

Description

Compute a fair predictor by estimating a regression function by standard methods and then estimate the thresholds to solve the minimization problem.

Parameters

y_predarray-like

Predicted vector (num_examples, ).

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

Self

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

Fit and transform

Description

Fit and transform

Parameters

y_predarray-like

Predicted vector (num_examples,).

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

dict

A dictionary with new predictions

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

Apply transform function to predictions and likelihoods

Description

Use a fitted probability to change the output label and invert the likelihood

Parameters

y_predarray-like

Predicted vector (nb_examples,)

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

thresholdfloat

float value to discriminate between 0 and 1

Returns

dict

A dictionary with new predictions