fairlearn.metrics.selection_rate#
- fairlearn.metrics.selection_rate(y_true, y_pred, *, pos_label=1, sample_weight=None)[source]#
Calculate the fraction of predicted labels matching the ‘good’ outcome.
The argument pos_label specifies the ‘good’ outcome. For consistency with other metric functions, the
y_trueargument is required, but ignored.Read more in the User Guide.
Added in version 0.3.0.
- Parameters:
y_true (array_like) – The true labels (ignored)
y_pred (array_like) – The predicted labels
pos_label (
Any) – The label to treat as the ‘good’ outcomesample_weight (array_like) – Optional array of sample weights
- Return type:
- Returns:
The selection rate
- Raises:
ValueError – If y_pred is empty.
Gallery examples#
Basics & Model Specification of AdversarialFairness
Basics & Model Specification of AdversarialFairness