holisticai.bias.mitigation.EqualizedOdds#

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

Equalized odds postprocessing use linear programming to find the probability with which change favorable labels (y=1) to unfavorable labels (y=0) in the output estimator to optimize equalized odds.

Parameters

solverstr

Algorithm name used to solve the standard form problem. Solver supported must depend of your scipy poackage version. for scipy 1.9.0 the solvers available are: [“highs”, “highs-ds”, “highs-ipm”, “interior-point”, “revised simplex”, “simplex”]

seedint

Random seed for repeatability.

Examples

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

References

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

Compute parameters for equalizing odds.

Description

Build parameters for the objetive function and call the solver to find the algorithm parameters.

Parameters

yarray-like

Target vector (nb_examlpes,)

y_predarray-like

Predicted vector (nb_examlpes,)

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

Self

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

Apply transform function to predictions and likelihoods

Description

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

Parameters

y_predarray-like

Predicted vector (nb_examlpes,)

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

Returns

dict

A dictionary with two keys, y_pred and y_score, which refers to the predicted labels and their probabilities, respectively.