holisticai.bias.metrics.false_positive_rate_diff#

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

False positive rate difference

This function computes the difference in false positive rates between group_a and group_b.

Interpretation

A value of 0 is desired. This metric ranges between -1 and 1, with negative values indicating bias against group_a, and positive values indicating bias against group_b.

Parameters

group_aarray-like

Group membership vector (binary)

group_barray-like

Group membership vector (binary)

y_predarray-like

Predictions vector (binary)

y_truearray-like

Target vector (binary)

Returns

float

FPR_diff

Notes

\(fpr_a - fpr_b\)

Examples

>>> import numpy as np
>>> from holisticai.bias.metrics import false_positive_diff
>>> group_a = np.array([1, 1, 1, 1, 0, 0, 0, 0, 0, 0])
>>> group_b = np.array([0, 0, 0, 0, 1, 1, 1, 1, 1, 1])
>>> y_pred = np.array([1, 1, 0, 0, 1, 1, 0, 1, 1, 1])
>>> y_true = np.array([1, 1, 0, 0, 1, 0, 1, 0, 0, 1])
>>> false_positive_diff(group_a, group_b, y_pred, y_true)
-1.0