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.

Equalized odds holds when the true-positive rate (TPR) and false-positive rate (FPR) are equal across groups. Needs ground-truth labels, so it audits a system's errors, not just its decision rates.

Usage

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

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

Arguments

y_true

Vector of realised ground-truth outcomes.

y_pred

Vector of system decisions.

group

Vector of protected-attribute values.

privileged

The reference group (inferred if NULL).

favorable

The value treated as the positive class (default 1).

Value

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

A named list: value (largest absolute TPR/FPR gap), tpr_gaps, fpr_gaps, rates, privileged, violation, warnings, interpretation.

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
#> B 
#> 1 
truth <- c(1, 0, 1, 0, 1, 0, 1, 0)
pred <- c(1, 0, 1, 0, 1, 1, 0, 1)
race <- c(rep("A", 4), rep("B", 4))
res <- morie_fairness_equalized_odds(truth, pred, race, privileged = "A")
res$violation # TRUE
#> [1] TRUE