holisticai.bias.mitigation.WassersteinBarycenter#
- class holisticai.bias.mitigation.WassersteinBarycenter(*args, **kargs)[source]#
Fair Regression with Wasserstein Barycenters learning a real-valued function that satisfies the Demographic Parity constraint [1] . The strategy founds the optimal fair predictor computing the Wasserstein barycenter of the distributions induced by the standard regression function on the sensitive groups.
Examples
>>> from holisticai.bias.mitigation import WassersteinBarycenter >>> mitigator = WassersteinBarycenter() >>> 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 parameters for calibrated equalized odds.
Description
Compute parameters for calibrated equalized odds algorithm.
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