fairlearn.metrics.equal_opportunity_difference#

fairlearn.metrics.equal_opportunity_difference(y_true, y_pred, *, sensitive_features, method='between_groups', sample_weight=None)[source]#

Calculate the equal opportunity difference.

The equal opportunity difference is defined as the difference between the largest and the smallest group-level true positive rates, \(P[h(X)=1 | A=a, Y=1]\), across all values \(a\) of the sensitive feature(s). The equal opportunity difference of 0 means that all groups have the same true positive rate.

Read more in the User Guide.

Added in version 0.11.0.

Parameters:
Return type:

float

Returns:

The equal opportunity difference