holisticai.bias.metrics.max_statistical_parity#

holisticai.bias.metrics.max_statistical_parity(group_a, group_b, y_pred)[source]#

Max absolute statistical parity

This function computes the maximum over all thresholds of the absolute statistical parity between group_a and group_b.

Interpretation

A value of 0 is desired. Values below 0.1 in absolute value 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

max absolute statistical parity

Examples

>>> import numpy as np
>>> from holisticai.bias.metrics import max_statistical_parity
>>> 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))
>>> max_statistical_parity(group_a, group_b, y_pred)
0.20000000000000007