fairlearn.metrics.equal_opportunity_ratio#

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

Calculate the equal opportunity ratio.

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

Read more in the User Guide.

Return type:

float

Parameters:
y_truearray-like

Ground truth (correct) labels.

y_predarray-like

Predicted labels h(X) returned by the classifier.

sensitive_featuresarray-like

The sensitive features over which equal opportunity should be assessed

methodstring {‘between_groups’, ‘to_overall’}, default between_groups

How to compute the differences. See fairlearn.metrics.MetricFrame.ratio() for details.

sample_weightarray-like

The sample weights

Returns:
float

The equal opportunity ratio