holisticai.bias.metrics.false_negative_rate_diff#

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

False negative Rate difference

This function computes the difference in false negative rates for 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_b, and positive values indicating bias against group_a.

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

False Negative Rate difference

Notes

\(fnr_a - fnr_b\)

Examples

>>> import numpy as np
>>> from holisticai.bias.metrics import fnr_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])
>>> fnr_diff(group_a, group_b, y_pred, y_true)
-0.3333333333333333