holisticai.bias.metrics.statistical_parity_auc#
- holisticai.bias.metrics.statistical_parity_auc(group_a, group_b, y_pred)[source]#
Statistical parity (AUC)
This function computes the area under the statistical parity versus threshold curve.
Interpretation
A value of 0 is desired. Values below 0.075 are considered acceptable.
Parameters
- group_aarray-like
Group membership vector (binary)
- group_barray-like
Group membership vector (binary)
- y_predarray-like
Predictions vector (regression)
Returns
- float
statistical parity (AUC)
Examples
>>> import numpy as np >>> from holisticai.bias.metrics import statistical_parity_auc >>> group_a = np.array([1] * 50 + [0] * 50) >>> group_b = np.array([0] * 50 + [1] * 50) >>> y_pred = np.concatenate((np.linspace(-1, 1, 50), np.linspace(-1, 1, 50) ** 3)) >>> statistical_parity_auc(group_a, group_b, y_pred) 0.12106666666666668