Counterfactual Reasoning for Fair Clinical Risk Prediction

Stephen R. Pfohl, Tony Duan, Daisy Yi Ding, Nigam H. Shah

Abstract

The use of machine learning systems to support decision making in healthcare raises questions as to what extent these systems may introduce or exacerbate disparities in care for historically underserved populations. This work introduces a framework for individual-level fairness in clinical risk prediction using counterfactual reasoning, ensuring that predictions remain consistent for a patient even if their sensitive attributes were different.

Introduction: The Challenge of Bias in EHR Data

Machine learning models in healthcare are frequently trained on observational data from Electronic Health Records (EHRs). However, these records are not neutral; they reflect historical biases, systemic inequalities, and variations in care delivery across demographic groups. A model trained on such data risks reinforcing these disparities—for instance, by under-predicting the risk of a long hospital stay for a minority group simply because they were underserved in the past.

While "group fairness" metrics (e.g., ensuring equal average error rates across genders) are common, they do not guarantee fairness at the individual level. A model might be fair on average but still treat specific individuals unfairly. This research addresses this gap by applying counterfactual reasoning: asking "What would the model have predicted for this specific patient if their sensitive attributes (like race or gender) were different, but their underlying health status remained the same?"

Methodology: Counterfactual Fairness and Causal Modeling

The authors propose a novel fairness criterion: individual equalized counterfactual odds. This extends the concept of equalized odds to the individual level, requiring that a prediction for a patient and their "counterfactual twin" (the same patient with a modified sensitive attribute) be identical, provided the factual and counterfactual outcomes are the same.

To implement this, the framework utilizes a causal graph to model the relationships between variables, distinguishing between sensitive attributes, observed clinical features, and unobserved confounders.

Causal graph representing the relationships between sensitive attributes (A), observed features (X), unobserved confounders (U), and outcomes (Y).

The methodology involves three core components:

  1. Causal Effect VAE (CE-VAE): Since counterfactuals are unobservable, a Variational Autoencoder (VAE) is used to learn latent factors (U) of a patient's health. This allows for the generation of synthetic "counterfactual twins" to audit how predictions change when sensitive attributes are toggled.
  2. Counterfactual Logit Pairing (CLP): During training, a penalty term is added to the loss function. This penalty "punishes" the model if its predictions for a real patient and their counterfactual twin diverge, forcing the model to ignore sensitive attributes as causal drivers.
  3. Causal Inference: By leveraging the structure shown in the causal graph, the authors attempt to separate legitimate clinical features from the illegitimate influence of sensitive attributes (A).

Experimental Setup

The study utilized data from the Stanford Medicine Research Data Repository (STRIDE), comprising 129,633 unique inpatient admissions between 2010 and 2018. The models were evaluated on two primary tasks:

  • Prolonged Length of Stay (LOS): Predicting stays of 7+ days.
  • Inpatient Mortality: Predicting death during the hospital stay.

The feature set included a massive sparse binary vector of 368,117 features (diagnoses, procedures, medications, etc.). Sensitive attributes included race/ethnicity, gender, and age.

Results and Discussion

Mitigating Bias

Baseline models without fairness constraints exhibited significant bias. For example, Black patients were consistently assigned lower predicted probabilities for long hospital stays compared to their counterfactual twins, even when outcomes were identical. By increasing the strength of the Counterfactual Logit Pairing, the researchers successfully minimized these prediction gaps.

The Performance Trade-off

Achieving individual fairness involves a trade-off. For the LOS task, the baseline AUC-ROC was 0.851. Applying strong fairness constraints reduced this slightly to 0.843. This suggests that significant gains in individual fairness are possible with only minor impacts on clinical utility. The trade-offs were more pronounced in mortality prediction, likely due to the lower prevalence of the outcome.

Conclusion and Future Work

This work demonstrates a practical path toward auditing and mitigating individual-level bias in medical AI. However, several challenges remain. Counterfactual reasoning relies on an assumed causal graph that is often untestable. Furthermore, the quality of the fairness audit depends on the VAE's ability to accurately model high-dimensional EHR data. Future research should explore how these methods generalize across different health systems and address potential biases in the outcome labels themselves.

Summary updated

BibTeX
@inproceedings{pfohl2019counterfactual,
  author = {Stephen R. Pfohl and Tony Duan and Daisy Yi Ding and Nigam H. Shah},
  title = {{Counterfactual Reasoning for Fair Clinical Risk Prediction}},
  booktitle = {MLHC},
  year = {2019},
  url = {https://openreview.net/forum?id=qmgO_hYNLuF},
}
Figure