fairlearn.metrics.equalized_odds_difference#
- fairlearn.metrics.equalized_odds_difference(y_true, y_pred, *, sensitive_features, method='between_groups', sample_weight=None)[source]#
Calculate the equalized odds difference.
The greater of two metrics: true_positive_rate_difference and false_positive_rate_difference. The former is the difference between the largest and smallest of \(P[h(X)=1 | A=a, Y=1]\), across all values \(a\) of the sensitive feature(s). The latter is defined similarly, but for \(P[h(X)=1 | A=a, Y=0]\). The equalized odds difference of 0 means that all groups have the same true positive, true negative, false positive, and false negative rates.
Read more in the User Guide.
- Parameters:
y_true (array-like) – Ground truth (correct) labels.
y_pred (array-like) – Predicted labels \(h(X)\) returned by the classifier.
sensitive_features – The sensitive features over which demographic parity should be assessed
method (str) – How to compute the differences. See
fairlearn.metrics.MetricFrame.difference()
for details.sample_weight (array-like) – The sample weights
- Returns:
The equalized odds difference
- Return type: