Deep Hypothesis Tests Detect Clinically Relevant Subgroup Shifts in Medical Images

Lisa M. Koch, Christian M. Schürch, Christian F. Baumgartner, Arthur Gretton, Philipp BerensarXiv 2023

Abstract

Distribution shifts remain a fundamental problem for the safe application of machine learning systems. If undetected, they may impact the real-world performance of such systems or will at least render original performance claims invalid. In this paper, we focus on the detection of subgroup shifts, a type of distribution shift that can occur when subgroups have a different prevalence during validation compared to the deployment setting. For example, algorithms developed on data from various acquisition settings may be predominantly applied in hospitals with lower quality data acquisition, leading to an inadvertent performance drop. We formulate subgroup shift detection in the framework of statistical hypothesis testing and show that recent state-of-the-art statistical tests can be effectively applied to subgroup shift detection on medical imaging data. We provide synthetic experiments as well as extensive evaluation on clinically meaningful subgroup shifts on histopathology as well as retinal fundus images. We conclude that classifier-based subgroup shift detection tests could be a particularly useful tool for post-market surveillance of deployed ML systems.

Introduction

When a medical machine learning (ML) model is validated, it is typically tested on a curated dataset. However, once deployed in the real world, the "mix" of data often changes—a phenomenon known as subgroup shift. For instance, a model trained on high-quality images from university hospitals might struggle when deployed in a rural clinic with older equipment.

Crucially, these "lower-quality" images are not necessarily out-of-distribution (OOD) outliers; the model has encountered them before, just not at such high frequencies. Standard OOD detection often fails here because individual images appear "normal" to the model, even if the overall population shift significantly degrades accuracy. This paper addresses the urgent need for post-market surveillance tools that can alert clinicians when a model is no longer operating within its validated performance specifications.

Methodology

The authors evaluate three "deep" statistical hypothesis tests to detect these shifts by comparing a "Source" distribution (validation data) against a "Target" distribution (deployment data).

Overview of the subgroup shift detection framework and its role in post-market surveillance.
  1. Classifier-Based Two-Sample Tests (C2ST): A "domain classifier" is trained to distinguish whether an image belongs to the Source or Target set. If the classifier performs better than a random guess, a distribution shift is detected.
  2. Deep Kernel Tests (MMDD): This method uses a neural network to extract features and calculates the Maximum Mean Discrepancy (MMD) to find the feature space where the two distributions differ most.
  3. Multiple Univariate Kolmogorov-Smirnov Tests (MUKS): This approach monitors the softmax predictions of the actual medical AI model to check for significant shifts in the distribution of predicted classes.

Experimental Setup

The framework was tested across three levels of complexity:

  • Modified MNIST: A synthetic dataset where specific digits were occluded to simulate corrupted subgroups.
  • Camelyon17: A histopathology dataset of lymph node biopsies from five different hospitals, simulating "hospital shift."
  • EyePACS: A large-scale dataset of retinal fundus images used to analyze shifts in sex, ethnicity, image quality, and comorbidities.
Sample histopathology patches from the Camelyon17 dataset, illustrating variability across different hospitals.

Results and Discussion

The "Hidden" Danger of Subgroup Shifts

Subgroup shifts are insidious because they do not trigger standard data alarms. In the EyePACS dataset, a shift toward patients with comorbidities caused accuracy to drop from 0.87 to 0.84—a clinically significant margin—yet the images remained within the model's expected range.

C2ST as the Optimal Detector

Despite its conceptual simplicity, C2ST consistently outperformed more complex kernel methods. It demonstrated high sensitivity to subtle shifts and required minimal data (often just 100 to 200 images) to reach perfect detection power. Furthermore, C2ST remained effective even when the training data for the detector was reduced to just 1% of the original dataset.

Practical Implications

A major advantage of C2ST and MMDD is that they do not require ground-truth labels from the deployment site. They operate solely on raw images, making them highly practical for real-time monitoring where clinical labels (like biopsy results) might take weeks to obtain.

Conclusion

While these tests act as a vital "smoke alarm" for AI safety, they do not automatically correct the model. Once a shift is detected, a human-led algorithmic audit remains necessary to understand the cause. Future work will explore unsupervised methods to explain detected shifts, potentially highlighting the specific image features that triggered the alarm. These findings suggest that classifier-based tests are a robust and practical solution for the post-market surveillance of medical AI systems.

Summary updated

BibTeX
@misc{koch2023deep,
  author = {Lisa M. Koch and Christian M. Schürch and Christian F. Baumgartner and Arthur Gretton and Philipp Berens},
  title = {{Deep Hypothesis Tests Detect Clinically Relevant Subgroup Shifts in Medical Images}},
  year = {2023},
  eprint = {2303.04862},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.04862},
}
Figure