Algorithmic Fairness

Author

Christoph Kern

1 Fairness in Machine Learning?

Source: https://fairmlclass.github.io/ (Moritz Hardt)

2 Automated Decision-Making (ADM)

“[h]umans delegate machines to prepare decision-making or even to implement decisions” (Algorithmwatch 2019)

  • ADM systems combine social & technological parts
    1. A decision-making model
    2. Algorithms that make this model applicable in the form of software code
    3. Data sets that are entered into this software, e.g. for the purpose of model training
    4. The whole of the political and economic ecosystems that ADM systems are embedded in
    • Development: Public or commercial
    • Use: With or without human deciders

3 Databases on ADM systems

4 COMPAS I

Correctional Offender Management Profiling for Alternative Sanctions (COMPAS)

  • Risk assessment software for rating a defendant’s risk of future crime (recidivism)
  • Commercial software developed by Northpointe, not publicly disclosed
  • Can be used for targeting treatment programs, bail determinations, and in the course of sentencing decisions

→ Test of accuracy and racial bias by ProPublica (Angwin et al. 2016)

5 COMPAS II

Source: https://www.documentcloud.org/documents/2702103-Sample-Risk-Assessment-COMPAS-CORE.html

6 COMPAS III

Source: Corbett-Davies et al. (2017), Fig. 1, Distribution of risk scores for Broward County1

7 COMPAS IV

COMPAS Fairness Metrics (Rodolfa, Saleiro, and Ghani 2020)
Metric Caucasian African American
False Positive Rate (FPR) 23% 45%
False Negative Rate (FNR) 48% 28%
False Discovery Rate (FDR) 41% 37%
  • ProPublica focused on FPR and FNR
  • Northpointe’s response2 put forward FDR
  • Is the model “simultaneously fair and unfair”?

8 COMPAS V: Error rates

Source: modified from James et al. (2013), Ch. 4.4.3, Table 4.6, p. 148

\[ \text{FPR} = \frac{\text{False Positives (FP)}}{\text{False Positives (FP)} + \text{True Negatives (TN)}} \]

\[ \text{FNR} = \frac{\text{False Negatives (FN)}}{\text{False Negatives (FN)} + \text{True Positives (TP)}} \]

\[ \text{FDR} = \frac{\text{False Positives (FP)}}{\text{False Positives (FP)} + \text{True Positives (TP)}} \]

  • Interpreting the rates3

9 Algorithmic Profiling of Job Seekers

\(\rightarrow\) (Achterhold et al. 2025), (Kern et al. 2024), (Bach et al. 2023)

10 Fair ML I

Fairness and Automated Decision-Making

  • ML increasingly used for guiding high-stakes decisions
  • Automated decision-making increases effectiveness and consistency?
    • Hope to protect against human subjectivity
  • Various forms of (data) biases can be fed into the system
    • Models trained on biased data learn to reproduce biases!

“In the context of decision-making, fairness is the absence of any prejudice or favoritism toward an individual or a group based on their inherent or acquired characteristics.” (Mehrabi et al. 2021)

11 Fair ML II

Definitions of discrimination in legal domains (Barocas and Selbst 2016)

  • Disparate Treatment
    • Intentionally treating an individual differently based on his/her membership in a protected class
  • Disparate Impact
    • Negatively affecting members of a protected class more than others even if by a seemingly neutral policy

12 Fair ML III

Protected Attributes in Anti-Discrimination Legislation

Source: Simson, Fabris, and Kern (2024)

13 Bias in Data I

  • Historical Bias
    • “Historical bias is the already existing bias and socio-technical issues in the world and can seep into from the data generation process even given a perfect sampling and feature selection” (Mehrabi et al. 2021, 8)
    • Explainable discrimination: Group membership correlates with other (accepted) attributes
    • Unexplainable discrimination: Bias after accounting for explainable differences

14 Discrimination

Effect of ethnic name on probability of invitation for job interview (Zschirnt and Ruedin 2016)

15 Bias in Data II

  • Measurement Bias
    • “Measurement, or reporting, bias arises from how we choose, utilize, and measure particular features” (Mehrabi et al. 2021, 5)
    • Imperfect proxy variables that introduce historical biases
    • Differential measurement accuracy between groups

16 Measurement

Racial differences in a range of biological measures of disease severity, conditional on algorithm risk score (Obermeyer et al. 2019)

17 Bias in Data III

  • Representation Bias
    • “Representation bias arises from how we sample from a population dur- ing data collection process” (Mehrabi et al. 2021, 5)
    • Lacking diversity in training data
  • Evaluation Bias
    • “Evaluation bias occurs during model iteration and evaluation” (Mehrabi et al. 2021, 8)
    • Inappropriate test/ evaluation data
  • Population Bias/ Sampling Bias
    • Mismatch between available training data and target population
  • Temporal Bias
    • Differences in populations and behaviors over time
  • Many more…

18 Representation

Source: Shankar et al. (2017), Fig. 3, Distribution of the geographically identifiable images in the Open Images data set, by country4

19 Fairness Notions: Equality of Treatment

  • Fairness through Unawareness
    • “An algorithm is fair as long as any protected attributes are not explicitly used in the decision-making process”
  • Blindness is ineffective! (Dwork et al. 2012)
    • Redundant Encoding: ML models can easily pick up correlates of protected attributes5
    • Reduced Utility: Cannot model different mechanisms across groups6

20 Fairness Notions: Equality of Outcomes

  • Demographic/ Statistical Parity7
    • People in both protected and unprotected groups should have equal probability of being assigned to a positive outcome
  • Can be exploited by biased adversaries! (Dwork et al. 2012)
    • Self-fulfilling prophecy: Biased actors may assign positive outcomes to unqualified individuals in the protected group, reinforcing harmful stereotypes.
    • Reverse tokenism: Biased actors may deny positive outcomes to qualified individuals in the unprotected group, using this as a pretext to justify discriminatory practices.
  • Conditional Statistical Parity
    • Demographic parity holds given a set of legitimate factors8

21 Fairness Notions: Equality of Errors

  • Given a model, evaluation data and groups defined by protected attributes, how can we “define” fairness?
Prediction
0 1
Truth 0 TN FP N’
1 FN TP P’
N P

22 Group Fairness

  • Joint distribution of
    • Sensitive attribute \(A\)
    • Target variable \(Y\)
    • Classifier \(\hat{Y}\) or score \(S\)

Categorizing group fairness notions (Barocas, Hardt, and Narayanan 2023)

Independence9 Separation10 Sufficiency11
\(\hat{Y} \perp A\) \(\hat{Y} \perp A \mid Y\) \(Y \perp A \mid \hat{Y}\)

23 Group Fairness I

Given groups \(g\) defined by protected attributes…

  • Predictive Parity
    • Equalize \(FDR_g = \frac{FP_g}{FP_g + TP_g}\)12
  • Equal \(FOR\)
    • Equalize \(FOR_g = \frac{FN_g}{FN_g + TN_g}\)
  • Sufficiency13
    • Equalize \(FDR_g\) and \(FOR_g\)

\(\rightarrow\) \(\sim\)Perspective of decision-maker14

Prediction
0 1
Truth 0 TN FP N’
1 FN TP P’
N P

24 Group Fairness II

Given groups \(g\) defined by protected attributes…

  • Predictive Equality15
    • Equalize \(FPR_g = \frac{FP_g}{FP_g + TN_g}\)
  • Equal Opportunity16
    • Equalize \(FNR_g = \frac{FN_g}{FN_g + TP_g}\)
  • Equalized Odds17
    • Equalize \(FNR_g\) and \(FPR_g\)

\(\rightarrow\) \(\sim\)Perspective of affected individual18

Prediction
0 1
Truth 0 TN FP N’
1 FN TP P’
N P

25 Group Fairness III

Given groups \(g\) defined by protected attributes…

  • Overall Accuracy Equality19
    • Equalize accuracy: \(\frac{TP_g+TN_g}{TP_g+FP_g+TN_g+FN_g}\)
  • Treatment Equality20
    • Equalize \(\frac{FP_g}{FN_g}\)
Prediction
0 1
Truth 0 TN FP N’
1 FN TP P’
N P

26 Fairness Trade-offs: Impossibility of Fairness

  • “When the base rates differ by protected group and when there is not separation, one cannot have both conditional use accuracy equality and equality in the false negative and false positive rates” (Berk et al. 2021, 20)
    • Equality of \(FDR\), \(FOR\) and \(FNR\), \(FPR\) across groups hardly possible in practice
    • Trade-off between Sufficiency and Equalized Odds

27 Choosing Fairness Metrics I

Source: https://www.datasciencepublicpolicy.org/our-work/tools-guides/aequitas/

28 Choosing Fairness Metrics II

Source: Makhlouf, Zhioua, and Palamidessi (2021)

29 Limitations of Group Fairness

  1. Group-based fairness notions can be odds with each other and with overall utility
  2. Which groups should be considered?
    • Focus on a fixed and limited set of protected groups?
  3. What about intersections of attributes?
    • Group-based fairness notions can be tricked
    • Protecting two groups separately can (still) concentrate positive outcomes in subgroups

30 Beyond Group Fairness

  1. Group Fairness: Treat different groups equally
    • Weak fairness guarantees
  2. Individual Fairness: Give similar predictions to similar individuals
  3. Multi-group Fairness: Extend group fairness to large collections of subgroups

31 Fairness Through Awareness

(Dwork et al. 2012)

For a set of individuals \(V\) and a set of outcomes \(A\), a mapping \(M: V \rightarrow \delta(A)\) from individuals to probability distributions over outcomes satisfies the \((D, d)\)-Lipschitz property if for every (pair of individuals) \(x, y \in V\), we have

\[ D(Mx, My) \leq d(x, y) \]

  • Distance between distributions of outputs \(D\)
  • Distance metric between individuals \(d\)
  • Difference in outputs should be at most distance in attributes

32 Counterfactual Fairness

(Kusner et al. 2017)

Assume a casual model, with a set of latent background variables \(U\). Predictor \(\hat{Y}\) is counterfactually fair if under any context \(X=x\) and \(A=a\) \[ P(\hat{Y}_{A \leftarrow a}(U) = y \mid X = x, A = a) = P(\hat{Y}_{A \leftarrow a^\prime}(U) = y \mid X = x, A = a) \] for all \(y\) and for any value \(a^\prime\) attainable by \(A\).

  • Probability of the outcome is the same in both the actual world (\(A \leftarrow a\)) and the counterfactual world (\(A \leftarrow a^\prime\)) in which protected attribute had been the opposing class
  • Given a causal graph, a predictor \(\hat{Y}\) is counterfactually fair if it is a function of non-descendants of the sensitive variable \(A\)

33 Multi-Calibration

(Hébert-Johnson et al. 2018)

Require calibrated predictions for all computationally-identifiable subpopulations:

A predictor \(x\) is \(\alpha\)-multicalibrated with respect to a family of sets \(C\) if it is \(\alpha\)-calibrated with respect to every \(S \in C\).

  • Subpopulations in \(C\) can be overlapping, with complex relationships
  • Protect any group that can be efficiently identified, not only defined by sensitive properties
  • Implementation: Iteratively update an initial predictor on subsets that violate calibration

34 Multi-Accuracy

(Kim, Ghorbani, and Zou 2019)

For a collection of nonnegative functions \(\mathcal{H} \subseteq \{h: \mathcal{X} \rightarrow \mathbb{R}^+\}\), a predictor \(\tilde{\rho}: \mathcal{X} \rightarrow [0,1]\) is \((\mathcal{H}, \alpha)\)- if for all \(h \in \mathcal{H}\)

\[ \Bigl| \textbf{E} \left[h(X) \cdot (Y - \tilde{\rho}(X))\right] \Bigr| \leq \alpha \].

  • In practice, \(\mathcal{H}\) is a class of functions
  • E.g., width-4 conjunctions
  • \(\rightarrow\) Multi-Accuracy requires unbiasedness for all subpopulations defined by intersections of four attributes

35 Multi-Calibration Boosting

Given:

  • A set of initial predictions
  • Validation data \(D\)
  • An auditor to search for functions \(h\)
    • find largest residuals
    • e.g. tree, ridge regression

Repeat:

  • Search over \(h \in \mathcal{H}\)
  • If \[ |\textbf{E}_{x\sim D}[h(x) \cdot (y(x)-\tilde{\rho}(x))]| > \varepsilon \]
    • update as \(\tilde{\rho}(x) \leftarrow \tilde{\rho}(x) - \eta \cdot h(x)\)

36 Multi-Calibration Boosting for R

R package mcboost (Pfisterer et al. 2021)

MCBoost pipeline

37 Resources

38 Lab R: MCBoost - Application Example

library(tidyverse)
library(PracTools)
library(ranger)
library(neuralnet)
library(formattable)
library(mlr3)
library(mlr3learners)
library(mlr3fairness)
library(mcboost)

38.1 Data and Setup

This lab session presents two typical use cases of MCBoost with data from a health survey. The goal is to post-process two initial prediction models for multi-accuracy using different flavors of MCBoost, and to eventually compare the naive and post-processed predictors overall and for subpopulations.

We use data derived from the National Health Interview Survey (NHIS 2003), which includes demographic and health-related variables for 21,588 individuals. This data can directly be included from the PracTools package.

data(nhis.large)
#?nhis.large

In the following, our outcome of interest is whether an individual is covered by any type of health insurance (notcov, 1 = not covered, 0 = covered). We additionally prepare two sets of variables:

  • Predictor variables (age, parents in household, education, income, employment status, physical or other limitations)
  • Subpopulation variables (sex, hispanic ethnicity, race)

The second set of variables will not be used for training the initial prediction models, but will be our focus when it comes to evaluating prediction performance for subgroups.

Before we training an initial model, we preprocess the data.`

categorical <- c("age.grp", "parents", "educ", "inc.grp", "doing.lw",
  "limited", "sex", "hisp", "race")

nhis <- nhis.large %>%
  mutate_at(categorical, as.factor) %>%
  mutate_at(categorical, fct_explicit_na) %>%
  drop_na(notcov) %>%
  select(all_of(categorical), notcov, svywt, ID)

nhis$notcov <- factor(ifelse(nhis$notcov == 1, "notcov", "cov"))

nhis_enc <- data.frame(model.matrix(notcov ~ ., data = nhis)[,-1])
nhis_enc$notcov <- nhis$notcov
nhis_enc$sex <- nhis$sex
nhis_enc$hisp <- nhis$hisp
nhis_enc$race <- nhis$race
nhis_enc$inv_wt <- (1 / nhis$svywt)

The pre-processed NHIS data will be split into three datasets:

  • A training set train for training the initial prediction models (55 % of data)
  • An auditing set post for post-processing the initial models with MCBoost (20 %)
  • A test set testfor model evaluation (25 %)

To increase the difficulty of the prediction task, we sample from the NHIS data such that the prevalence of demographic subgroups in the test data differs from their prevalence in the training and auditing data. This is achieved by employing weighted sampling from NHIS (variable inv_wt from above).

set.seed(2953)

test <- nhis_enc %>% slice_sample(prop = 0.25, weight_by = inv_wt)

nontest_g <- nhis_enc %>% anti_join(test, by = "ID")

train_g <- nontest_g %>% slice_sample(prop = 0.75)

post <- nontest_g %>% anti_join(train_g, by = "ID") %>% select(-ID, -svywt, -inv_wt, -c(sex:race))

train <- train_g %>% select(-ID, -svywt, -inv_wt, -c(sex:race), -c(sex2:race3))

As a result, non-hispanic white individuals (hisp2) are overrepresented and hispanic individuals are underrepresented in both the training and auditing set, compared to their prevalence in the test set.

train_g %>% summarise_at(vars(sex2:race3), mean)
       sex2     hisp2     hisp3     hisp4     race2      race3
1 0.5118551 0.6252296 0.1416764 0.0399065 0.1477709 0.04449825
# hispanic individuals
1 - sum(train_g %>% summarise_at(vars(hisp2:hisp4), mean))
[1] 0.1931875
post %>% summarise_at(vars(sex2:race3), mean)
       sex2     hisp2     hisp3      hisp4     race2      race3
1 0.5224142 0.6278487 0.1402454 0.03806662 0.1460055 0.04282494
# hispanic individuals
1 - sum(post %>% summarise_at(vars(hisp2:hisp4), mean))
[1] 0.1938392
test %>% summarise_at(vars(sex2:race3), mean)
      sex2     hisp2     hisp3      hisp4     race2      race3
1 0.520759 0.4711629 0.1410859 0.03700921 0.1487883 0.04414804
# hispanic individuals
1 - sum(test %>% summarise_at(vars(hisp2:hisp4), mean))
[1] 0.3507421

38.2 Fairness Metrics

We train a random forest with the default settings of the ranger package as the initial predictor.

rf <- ranger(notcov ~ ., data = train)

Predict on test set and select fairness metrics. See https://mlr3fairness.mlr-org.com/articles/measures-vignette.html for an overview.

rf_pred <- as.factor(predict(rf, test)$prediction)
metrics <- msrs(c("fairness.cv", "fairness.acc", "fairness.fnr", "fairness.fpr", "fairness.eod"))

Compute metrics on the test set.

compute_metrics(
  data = test, 
  target = "notcov",
  prediction = rf_pred,
  protected_attribute = "sex2",
  metrics = metrics
)
            fairness.pp            fairness.acc            fairness.fnr 
            0.005876512             0.005261072             0.007187131 
           fairness.fpr fairness.equalized_odds 
            0.006566903             0.006877017 

38.3 Improve Subgroup Calibration

Next, we post-process the random forest with MCBoost.

rf <- ranger(notcov ~ ., data = train, probability = TRUE)

38.3.1 MCBoost Auditing

We first prepare a function to pass the predictions to MCBoost for post-processing.

init_rf = function(data) {
  predict(rf, data)$prediction[, 2]
}

To showcase different use cases of MCBoost, we prepare two post-processing data sets based on the auditing set. The first set includes only the predictor variables that were used by the initial models, whereas the second set will allow post-processing based on our demographic subgroups of interest (sex, hispanic ethnicity, race).

d1 <- select(post, -c(notcov, sex2:race3))
d2 <- select(post, -notcov)
l <- 1 - one_hot(post$notcov)

We use two custom auditors for MCBoost, i.e., ridge and lasso regression with different penalties on model complexity.

ridge = LearnerAuditorFitter$new(lrn("regr.glmnet", 
                                     alpha = 0, 
                                     lambda = 2 / nrow(post)))

lasso = LearnerAuditorFitter$new(lrn("regr.glmnet", 
                                     alpha = 1, 
                                     lambda = 40 / nrow(post)))

The ridge regression will only be given access to the initial predictor variables when post-processing the random forest predictions. In contrast, we allow the lasso regression to audit the initial predictions both with the initial predictors and the subpopulations (sex, hispanic ethnicity, race). In summary, we have:

  • rf: Initial random forest
  • rf_mc_ridge: Random forest, post-processed with ridge regression and the initial set of predictor variables
  • rf_mc_lasso: Random forest, post-processed with lasso regression and the extended set of predictors
rf_mc_ridge = MCBoost$new(init_predictor = init_rf,
                          auditor_fitter = ridge,
                          multiplicative = TRUE,
                          partition = TRUE,
                          max_iter = 20)
rf_mc_ridge$multicalibrate(d1, l)

rf_mc_lasso = MCBoost$new(init_predictor = init_rf,
                          auditor_fitter = lasso,
                          multiplicative = TRUE,
                          partition = TRUE,
                          max_iter = 20)
rf_mc_lasso$multicalibrate(d2, l)

38.3.2 Model Evaluation

We compute predicted probabilities and class predictions using the initial and post-processed models.

test$rf <- predict(rf, test)$prediction[, 2]
test$rf_mc_ridge <- rf_mc_ridge$predict_probs(test)
test$rf_mc_lasso <- rf_mc_lasso$predict_probs(test)

test$c_rf <- round(test$rf)
test$c_rf_mc_ridge <- round(test$rf_mc_ridge)
test$c_rf_mc_lasso <- round(test$rf_mc_lasso)
test$label <- 1 - one_hot(test$notcov)

Here we compare the overall accuracy of the initial and post-processed models.

mean(test$c_rf == test$label)
mean(test$c_rf_mc_ridge == test$label)
mean(test$c_rf_mc_lasso == test$label)

However, we might be concerned with calibration in subpopulations. In the following we focus on subgroups defined by 2-way conjunctions of sex, hispanic ethnicity, and race.

test <- test %>%
  group_by(sex, hisp) %>%
  mutate(sex_hisp = cur_group_id()) %>%
  group_by(sex, race) %>%
  mutate(sex_race = cur_group_id()) %>%
  group_by(hisp, race) %>%
  mutate(hisp_race = cur_group_id()) %>%
  ungroup()

grouping_vars <- c("sex", "hisp", "race", "sex_hisp", 
                   "sex_race", "hisp_race")

eval <- map(grouping_vars, group_by_at, .tbl = test) %>%
  map(summarise,
      'bias_rf' = abs(mean(rf) - mean(label))*100,
      'bias_rf_mc_ridge' = abs(mean(rf_mc_ridge) - mean(label))*100,
      'bias_rf_mc_lasso' = abs(mean(rf_mc_lasso) - mean(label))*100,
      'size' = n()) %>%
  bind_rows()

This evaluation focuses on the difference between the average predicted risk of healthcare non-coverage and the observed proportion of non-coverage in the test data for subgroups. Considering the MCBoost-Ridge (rf_mc_ridge) and MCBoost-Lasso (rf_mc_lasso) results, post-processing with MCBoost reduces bias for many subpopulations.

eval %>%
  arrange(desc(size)) %>%
  select(size, bias_rf:bias_rf_mc_lasso) %>%
  round(., digits = 3) %>%
  formattable(., lapply(1:nrow(eval), function(row) {
  area(row, col = 2:4) ~ color_tile("lightgreen", "transparent")
    }))

38.4 Improve Subgroup Accuracy

We train an initial model for predicting healthcare coverage with the training set. Here, we use a neural network with one hidden layer, rather naively with little tweaking.

nnet <- neuralnet(notcov ~ .,
  hidden = 5,
  linear.output = FALSE,
  err.fct = 'ce',
  threshold = 0.5,
  lifesign = 'full',
  data = train
)

38.4.1 MCBoost Auditing

We prepare a function that allows us to pass the predictions of the model to MCBoost for post-processing.

init_nnet = function(data) {
  predict(nnet, data)[, 2]
}

We initialize two custom auditors for MCBoost: Ridge regression with a small penalty on model complexity, and a SubpopAuditorFitter with a fixed set of subpopulations.

ridge = LearnerAuditorFitter$new(lrn("regr.glmnet", 
                                     alpha = 0, 
                                     lambda = 2 / nrow(post)))

pops = SubpopAuditorFitter$new(list("sex2", "hisp2", "hisp3", 
                                    "hisp4", "race2", "race3"))

The ridge regression will only be given access to the initial predictor variables when post-processing the neural net predictions with the auditing data. In contrast, we guide the subpop-fitter to audit the initial predictions explicitly on the outlined subpopulations (sex, hispanic ethnicity, race). In summary, we have:

  • nnet: Initial neural net
  • nnet_mc_ridge: Neural net, post-processed with ridge regression and the initial set of predictor variables
  • nnet_mc_subpop: Neural net, post-processed with a fixed set of subpopulations
nnet_mc_ridge = MCBoost$new(init_predictor = init_nnet,
                            auditor_fitter = ridge,
                            multiplicative = TRUE,
                            partition = TRUE,
                            max_iter = 15)
nnet_mc_ridge$multicalibrate(d1, l)

nnet_mc_subpop = MCBoost$new(init_predictor = init_nnet,
                             auditor_fitter = pops,
                             partition = TRUE,
                             max_iter = 15)
nnet_mc_subpop$multicalibrate(d2, l)

38.4.2 Model Evaluation

Next, we use the initial and post-processed models to predict the outcome in the test data. We compute predicted probabilities and class predictions.

test$nnet <- predict(nnet, newdata = test)[, 2]
test$nnet_mc_ridge <- nnet_mc_ridge$predict_probs(test)
test$nnet_mc_subpop <- nnet_mc_subpop$predict_probs(test)

test$c_nnet <- round(test$nnet)
test$c_nnet_mc_ridge <- round(test$nnet_mc_ridge)
test$c_nnet_mc_subpop <- round(test$nnet_mc_subpop)
test$label <- 1 - one_hot(test$notcov)

Here we compare the overall accuracy of the initial and post-processed models. Overall, we observe little differences in performance.

mean(test$c_nnet == test$label)
mean(test$c_nnet_mc_ridge == test$label)
mean(test$c_nnet_mc_subpop == test$label)

However, we might be concerned with model performance for smaller subpopulations. In the following, we focus on subgroups defined by 2-way conjunctions of sex, hispanic ethnicity, and race.

test <- test %>%
  group_by(sex, hisp) %>%
  mutate(sex_hisp = cur_group_id()) %>%
  group_by(sex, race) %>%
  mutate(sex_race = cur_group_id()) %>%
  group_by(hisp, race) %>%
  mutate(hisp_race = cur_group_id()) %>%
  ungroup()

grouping_vars <- c("sex", "hisp", "race", "sex_hisp", 
                   "sex_race", "hisp_race")

eval <- map(grouping_vars, group_by_at, .tbl = test) %>%
  map(summarise,
      'accuracy_nnet' = mean(c_nnet == label),
      'accuracy_nnet_mc_ridge' = mean(c_nnet_mc_ridge == label),
      'accuracy_nnet_mc_subpop' = mean(c_nnet_mc_subpop == label),
      'size' = n()) %>%
  bind_rows()

We evaluate classification accuracy on these subpopulations, and order the results according to the size of the selected subgroups (size). Subgroup accuracy varies between methods, with MCBoost-Ridge (nnet_mc_ridge) and MCBoost-Subpop (nnet_mc_subpop) stabilizing subgroup performance when compared to the initial model, respectively.

eval %>%
  arrange(desc(size)) %>%
  select(size, accuracy_nnet:accuracy_nnet_mc_subpop) %>%
  round(., digits = 3) %>%
  formattable(., lapply(1:nrow(eval), function(row) {
  area(row, col = 2:4) ~ color_tile("transparent", "lightgreen")
    }))

39 References

Achterhold, Eva, Monika Mühlböck, Nadia Steiber, and Christoph Kern. 2025. “Fairness in Algorithmic Profiling: The AMAS Case.” Minds and Machines 35 (1): 9.
Angwin, Julia, Jeff Larson, Lauren Kirchner, and Surya Mattu. 2016. “Machine Bias.” https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing.
Bach, Ruben L., Christoph Kern, Hannah Mautner, and Frauke Kreuter. 2023. “The Impact of Modeling Decisions in Statistical Profiling.” Data & Policy 5: e32. https://doi.org/10.1017/dap.2023.29.
Barocas, Solon, Moritz Hardt, and Arvind Narayanan. 2023. Fairness and Machine Learning: Limitations and Opportunities. MIT press.
Barocas, Solon, and Andrew D Selbst. 2016. “Big Data’s Disparate Impact.” Calif. L. Rev. 104: 671.
Berk, Richard, Hoda Heidari, Shahin Jabbari, Michael Kearns, and Aaron Roth. 2021. “Fairness in Criminal Justice Risk Assessments: The State of the Art.” Sociol. Methods Res. 50 (1): 3–44.
Corbett-Davies, Sam, Emma Pierson, Avi Feller, Sharad Goel, and Aziz Huq. 2017. “Algorithmic Decision Making and the Cost of Fairness.” In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 797–806. KDD ’17. New York, NY, USA: Association for Computing Machinery. https://doi.org/10.1145/3097983.3098095.
Dwork, Cynthia, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard Zemel. 2012. “Fairness Through Awareness.” In Proceedings of the 3rd Innovations in Theoretical Computer Science Conference, 214–26. ITCS ’12. New York, NY, USA: Association for Computing Machinery.
Hébert-Johnson, Ursula, Michael Kim, Omer Reingold, and Guy Rothblum. 2018. “Multicalibration: Calibration for the (Computationally-Identifiable) Masses.” In International Conference on Machine Learning, 1939–48. PMLR.
James, Gareth, Daniela Witten, Trevor Hastie, and Robert Tibshirani. 2013. An Introduction to Statistical Learning: With Applications in R. Springer Texts in Statistics. Springer.
Kern, Christoph, Ruben Bach, Hannah Mautner, and Frauke Kreuter. 2024. “When Small Decisions Have Big Impact: Fairness Implications of Algorithmic Profiling Schemes.” ACM J. Responsib. Comput. https://doi.org/10.1145/3689485.
Kim, Michael P, Amirata Ghorbani, and James Zou. 2019. “Multiaccuracy: Black-Box Post-Processing for Fairness in Classification.” In Proceedings of the 2019 AAAI/ACM Conference on AI, Ethics, and Society, 247–54.
Kusner, Matt J, Joshua Loftus, Chris Russell, and Ricardo Silva. 2017. “Counterfactual Fairness.” Adv. Neural Inf. Process. Syst. 30.
Makhlouf, Karima, Sami Zhioua, and Catuscia Palamidessi. 2021. “On the Applicability of Machine Learning Fairness Notions.” SIGKDD Explor. Newsl. 23 (1): 14–23. https://doi.org/10.1145/3468507.3468511.
Mehrabi, Ninareh, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. 2021. “A Survey on Bias and Fairness in Machine Learning.” ACM Comput. Surv. 54 (6): 1–35.
Obermeyer, Ziad, Brian Powers, Christine Vogeli, and Sendhil Mullainathan. 2019. “Dissecting Racial Bias in an Algorithm Used to Manage the Health of Populations.” Science 366 (6464): 447–53.
Pfisterer, Florian, Christoph Kern, Susanne Dandl, Matthew Sun, Michael P Kim, and Bernd Bischl. 2021. “Mcboost: Multi-Calibration Boosting for r.” Journal of Open Source Software 6 (64): 3453.
Rodolfa, Kit T, Pedro Saleiro, and Rayid Ghani. 2020. “Bias and Fairness.” In Big Data and Social Science, 281–312. Chapman; Hall/CRC.
Shankar, Shreya, Yoni Halpern, Eric Breck, James Atwood, Jimbo Wilson, and D Sculley. 2017. “No Classification Without Representation: Assessing Geodiversity Issues in Open Data Sets for the Developing World.” arXiv Preprint arXiv:1711.08536.
Simson, Jan, Alessandro Fabris, and Christoph Kern. 2024. “Lazy Data Practices Harm Fairness Research.” In Proceedings of the 2024 ACM Conference on Fairness, Accountability, and Transparency, 642–59. FAccT ’24. New York, NY, USA: Association for Computing Machinery. https://doi.org/10.1145/3630106.3658931.
Zschirnt, Eva, and Didier Ruedin. 2016. “Ethnic Discrimination in Hiring Decisions: A Meta-Analysis of Correspondence Tests 1990–2015.” Journal of Ethnic and Migration Studies 42 (7): 1115–34.

Footnotes

  1. “The reason for these disparities is that white and black defendants in Broward County have different distributions of risk, \(p_{Y|X}\), as shown in Figure 1. In particular, a greater fraction of black defendants have relatively high risk scores, in part because black defendants are more likely to have prior arrests, which is a strong indicator of reoffending. Importantly, while an algorithm designer can choose different decision rules based on these risk scores, the algorithm cannot alter the risk scores themselves, which reflect underlying features of the population of Broward County.” (Corbett-Davies et al. 2017, 803)↩︎

  2. https://go.volarisgroup.com/rs/430-MBX-989/images/ProPublica_Commentary_Final_070616.pdf↩︎

  3. The False Positive Rate measures the proportion of negative instances incorrectly classified as positive. Interpretation: For COMPAS, this reflects how often individuals who do not reoffend are incorrectly predicted to reoffend. The False Negative Rate measures the proportion of positive instances incorrectly classified as negative. Interpretation: This reflects how often individuals who will reoffend are incorrectly predicted not to reoffend. The False Discovery Rate measures the proportion of positive predictions that are incorrect (false positives). Interpretation: This reflects how often predictions of reoffending turn out to be wrong.↩︎

  4. Distribution of the geographically identifiable images in the Open Images data set, by country. Almost a third of the data in our sample was US-based, and 60% of the data was from the six most represented countries across North America and Europe.↩︎

  5. e.g., even if you remove race from the data, variables like zip code, education level, or income might still act as proxies for race.↩︎

  6. e.g., if a healthcare model ignores sex as a feature, it might fail to account for the different ways diseases manifest across men and women. This can result in a one-size-fits-all model that is less effective for all groups and fails to capture the true causal mechanisms driving the outcomes.↩︎

  7. e.g., if a hiring algorithm produces an acceptance rate of 30% for both women (protected group) and men (unprotected group), the system satisfies demographic parity.↩︎

  8. e.g., a hiring algorithm should ensure equal acceptance rates across genders, conditional on job-relevant qualifications like years of experience or certifications.↩︎

  9. The predictions or scores should not depend on or vary with the group membership (e.g., race, gender, etc.).↩︎

  10. This means that if we already know the true label (e.g., whether someone is actually creditworthy), the predictions or scores should not vary with group membership \(A\).↩︎

  11. This means that if we already know the prediction, the actual true label \(Y\) should not depend on group membership \(A\).↩︎

  12. FDR = false discovery rate; Predictive parity ensures that the proportion of false positives among all predicted positives is the same for all groups.↩︎

  13. Sufficiency ensures that the model’s predictions are equally reliable across all groups, whether considering positively predicted outcomes (via \(FDR_g\)) or negatively predicted outcomes (via \(FOR_g\)).↩︎

  14. These metrics (predictive parity, \(FOR_{g}\), and sufficiency) focus on the reliability of the model’s predictions—ensuring that decisions based on those predictions are fair for different groups. This aligns with the interests of decision-makers, who need confidence that the model does not disproportionately harm or benefit certain groups in its predictions.↩︎

  15. Predictive equality ensures that individuals in different groups have the same chance of being falsely labeled as “positive” when they shouldn’t be. This is particularly important when a false positive leads to unnecessary burden or harm (e.g., being flagged as a potential fraudster or being falsely diagnosed with a disease).↩︎

  16. Equal opportunity ensures that individuals in different groups have the same chance of being correctly identified for a positive outcome. This is especially critical when a false negative denies someone access to beneficial outcomes (e.g., not getting a loan when qualified or missing a scholarship opportunity).↩︎

  17. Equalized odds is a more stringent fairness criterion because it balances fairness for individuals in different groups for both types of errors.↩︎

  18. This focus on errors aligns with the experiences of individuals who interact with the system, making these metrics particularly relevant from the perspective of fairness for the affected.↩︎

  19. Overall accuracy equality ensures that the model performs with the same overall level of correctness for each group. For example, if a model has a 90% accuracy for one group, it should also have 90% accuracy for all other groups.↩︎

  20. Treatment equality ensures that the ratio of false positives to false negatives is equal across groups. This means that one group is not unfairly burdened by more false positives while another group suffers more from false negatives.↩︎