Counterfactual Normalization: Proactively Addressing Dataset Shift Using Causal Mechanisms

Adarsh Subbaswamy, Suchi SariaUAI 2018 · OpenReview

Abstract

Machine learning models often fail when deployed in environments different from their training data due to "dataset shift" caused by spurious associations. We present Counterfactual Normalization (CFN), a proactive framework that leverages causal graphs to identify and normalize variables prone to these shifts. By introducing latent counterfactual variables, CFN builds models that generalize across domains without requiring target-domain data during training.

Introduction

Standard machine learning assumes that training and test data are independent and identically distributed (i.i.d.). However, in real-world applications—particularly in medicine—this assumption rarely holds. "Dataset shift" occurs when a model picks up on spurious associations: correlations that exist in the training data due to specific institutional policies or selection biases but vanish or flip in a new environment.

For example, a model might learn that low blood pressure (BP) is a strong predictor of meningitis because the training hospital frequently prescribes narcotics (which lower BP) to meningitis patients. If a second hospital has a stricter narcotic policy, the first hospital's model will fail. While most current solutions are reactive, requiring data from the target environment to adjust the model, this paper proposes a proactive approach using causal knowledge.

Identification of Vulnerable Variables

The first step in the CFN framework is identifying "vulnerable" variables using a Directed Acyclic Graph (DAG) of the causal mechanisms. Vulnerable variables are features that are not causally related to the target (e.g., meningitis) but are statistically associated with it through unstable mechanisms such as a shared child (selection bias) or a common cause.

Causal structures illustrating sources of dataset shift: (a) stable causal relationship, (b) selection bias, and (c) common cause confounding.

The Counterfactual Normalization Framework

CFN addresses shift by "normalizing" these vulnerable variables through a three-step process:

  1. Node-Splitting: The authors perform "graph surgery" on the DAG, separating an observed variable into its latent counterfactual component and the external influences (such as treatments or hospital policies) that cause the shift.
  2. Estimation: These latent counterfactual variables are estimated using Structural Equation Models (SEMs). Instead of training a model on the observed, "noisy" feature (e.g., treated blood pressure), the model is trained on the "normalized" counterfactual feature (e.g., what the blood pressure would have been without medication).
  3. Information Preservation: Unlike simply removing vulnerable variables—which often reduces model accuracy—CFN acts as a filter, preserving the useful signal within a feature while stripping away the domain-specific noise.
The CFN framework: (a) original causal graph, (b) node-splitting to isolate the counterfactual component Y(a), and (c) splitting for multiple interventions.

Experimental Results

The paper evaluates CFN on both synthetic and real-world datasets:

  • Simulated Hospital Transfer: In a synthetic medical screening task, the CFN model achieved an AUROC of 0.96 on the target domain, significantly outperforming the baseline model (0.87) which relied on vulnerable features.
  • Real-World Sepsis Classification: Using Electronic Health Record (EHR) data from 27,633 patients, the authors artificially introduced selection bias into the training set. CFN maintained high performance (0.94 AUROC) when tested on unbiased data, demonstrating its ability to ignore the specific biases it was trained on.

Discussion and Conclusion

A key insight of this work is that using latent counterfactual variables can reduce geometric complexity, making classes (e.g., Sepsis vs. No Sepsis) easier for the model to separate by removing variance from external treatments. However, the method's primary limitation is its reliance on a correctly specified causal graph, which may be difficult to obtain in complex domains. Future work includes exploring the intuitiveness of counterfactual features for human experts and relaxing structural assumptions in the estimation process. CFN represents a significant step toward building robust machine learning systems that rely on the "logic of the system" rather than just statistical patterns.

Summary updated

BibTeX
@inproceedings{subbaswamy2018counterfactual,
  author = {Adarsh Subbaswamy and Suchi Saria},
  title = {{Counterfactual Normalization: Proactively Addressing Dataset Shift Using Causal Mechanisms}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2018},
  url = {https://openreview.net/forum?id=L5G2NCrxfp},
}
Figure