Skip to contents

Equalized odds holds when both the true-positive rate and the false-positive rate are equal across groups. Needs ground truth, so it audits a system's errors rather than its decision rates - a system can satisfy demographic parity yet make many more false positives against one group.

Usage

morie_fairness_equalized_odds(
  y_true,
  y_pred,
  group,
  privileged = NULL,
  favorable = 1
)

Arguments

y_true

Realised ground-truth outcome per individual.

y_pred

The system's decision per individual.

group

Protected-attribute vector aligned with y_pred.

privileged

Reference group. If NULL, the highest-rate group is inferred and a warning is emitted.

favorable

Value of y_pred that counts as favourable (default 1).

Value

A morie_fairness_result; headline value is the largest absolute TPR-or-FPR gap.

Examples

truth <- c(1,0,1,0,1,0,1,0)
pred  <- c(1,0,1,0,1,1,0,1)
race  <- c("A","A","A","A","B","B","B","B")
morie_fairness_equalized_odds(truth, pred, race, privileged="A")$value
#> [1] 1