holisticai.bias.metrics.four_fifths#
- holisticai.bias.metrics.four_fifths(group_a, group_b, y_pred)[source]#
Four Fifths
This function computes the four fifths rule (ratio of success rates) between group_a and group_b. We return the minimum of the ratio taken both ways.
Interpretation
A value of 1 is desired. Values below 1 are unfair. The range (0.8,1) is considered acceptable.
Parameters
- group_aarray-like
Group membership vector (binary)
- group_barray-like
Group membership vector (binary)
- y_predarray-like
Predictions vector (binary)
Returns
- float
Four Fifths
Examples
>>> import numpy as np >>> from holisticai.bias.metrics import four_fifths >>> 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, 1, 0, 1, 1, 0, 0, 0, 0]) >>> four_fifths(group_a, group_b, y_pred) 0.4444444444444444