Towards Explaining Distribution Shifts

Sean Kulinski, David I. Inouye

TL;DR

Detecting that your data distribution has shifted is only half the battle; understanding why it shifted is what leads to actionable insights. This paper introduces a framework that uses interpretable "transportation maps"—mathematical functions that describe how to move points from an old distribution to a new one—to provide human-readable explanations for complex shifts in tabular, text, and image data.

What Problem Does This Paper Address?

In real-world machine learning, "distribution shift" is a constant threat. A model trained on last year's sales data might fail this year because consumer preferences changed, or a medical imaging model might struggle when deployed at a new hospital with different scanning equipment.

While there are many tools to detect these shifts, there are very few to explain them. Currently, practitioners often rely on simple "mean shifts" (comparing the average values of features), which are too coarse to capture complex changes, or "black-box" domain classifiers that tell you a shift exists but not what it looks like. This paper aims to bridge that gap by providing detailed, yet interpretable, explanations that help human operators decide how to mitigate the shift.

Methods

The authors frame distribution shift explanation as an Optimal Transport (OT) problem. Essentially, they look for a map $T$ that transforms the source distribution $P_{src}$ into the target distribution $P_{tgt}$ with minimal "effort" (cost).

To make these maps useful for humans, they introduce two main types of Intrinsically Interpretable Transport Sets:

  1. $k$-Sparse Transport: This restricts the explanation to only the $k$ most important features. For example, in a dataset with 100 variables, it might show that changing just 3 specific sensors explains 80% of the shift.
  2. $k$-Cluster Transport: This is designed for heterogeneous data where different groups shift in different ways. It identifies $k$ clusters and provides a separate shift vector for each.

For high-dimensional data like images where raw features (pixels) aren't interpretable, they use Distributional Counterfactuals. By leveraging Image-to-Image (I2I) translation models, they show what a specific sample from the source domain would look like if it had belonged to the target domain.

Finally, they introduce the PercentExplained (PE) metric. Similar to $R^2$ in statistics, PE quantifies how much of the total distribution shift is captured by a simplified, interpretable map, allowing users to trade off between simplicity and accuracy.

Figure 1: An overall look at our approach to explaining distribution shifts, where given a source Psrc and shifted Ptgt dataset pair, a user can choose to explain the distribution shift using k-sparse maps (which are best suited for high dimensional or feature-wise complex data), k-cluster maps (for tracking how heterogeneous groups change across the shift), or distribution translation maps (for data which has uninterpretable raw features such as images). For details on the results seen in the three boxes, please see experiments in section 5 and Appendix C.

Datasets

The authors evaluated their methods on a variety of real-world benchmarks:

  • Adult Income Dataset: Tabular census data used to explain shifts between male and female populations.
  • CivilComments (WILDS): A text dataset used to explain the shift in unigram (word) frequencies between toxic and non-toxic comments.
  • Camelyon17 (WILDS): Histopathology images from five different hospitals, used to explain shifts caused by varying staining characteristics.
  • CelebA: A large-scale face attribute dataset used to test the limits of image-based counterfactuals.

Key Insights and Ideas

  • Mean shifts are deceptive: A simple average can hide significant sub-group dynamics. In the Adult Income dataset, while a mean shift shows income drops for women generally, the $k$-cluster approach reveals that the disparity is most extreme for middle-aged adults with bachelor's degrees.
  • Interpretability is a Hyperparameter: By adjusting $k$, an operator can start with a very simple "big picture" explanation and gradually add complexity until the PercentExplained metric reaches a satisfactory level.
  • OT as a "Simplicity" Prior: Using Optimal Transport ensures that the explanation represents the "shortest path" between distributions, which aligns with Occam’s Razor—the simplest explanation that fits the data is often the best.

Key Results

  • Tabular Insight: On the Adult Income dataset, the $k$-cluster method (with $k=4$) identified specific demographic groups where income disparities were most prevalent, providing much narrower and more actionable insights than standard feature importance tools.
Figure 2: Using k-cluster transport (bottom) to explain the shift from the male population to the female population of the Adult Income dataset allows us to capture how heterogeneous groups within the dataset moved. For example, while all three methods show that income is indeed the largest difference between M and F for this dataset (insight 1), only the k-cluster-based explanation reveals insight 2, that the income disparity is most prevalent between middle-aged males and females with a bachelor’s degree (edu=12) seen in C4.
  • Text Analysis: In the CivilComments dataset, $k$-sparse OT explanations were significantly more efficient than simple mean shifts. For example, identifying just 10 key words could explain over 16% of the shift between female and male comment distributions, whereas a standard mean shift would require thousands of words to reach the same level of alignment.
Table showing how k-sparse OT identifies specific words that drive the shift in toxicity across different demographics.
  • Image Clarity: For the Camelyon17 hospital shift, distributional counterfactuals clearly visualized that the primary difference was hospital-specific staining colors. This is far more actionable than standard saliency maps, which merely highlighted that "something" was different across the entire image.
Counterfactual images showing how samples from one hospital would look if they were processed at another, highlighting staining differences.

Limitations and Future Work

  • Latent Space Dependency: For images, the method relies on finding a "semantically meaningful" latent space. If the latent space isn't well-disentangled, the resulting transport maps may still be hard to interpret.
  • Computational Scaling: Empirical OT scales quadratically with the number of samples, making it difficult to apply to massive datasets without using approximations like the Sinkhorn algorithm.
  • Content vs. Style: The authors noted that current image translation models (like StarGAN) struggle with large "content" shifts (e.g., changing a person with bangs to being bald) compared to "style" shifts (e.g., changing hair color). Future work could involve more robust image-to-image translation techniques to handle these structural changes.

Summary updated

BibTeX
@inproceedings{kulinski2023towards,
  author = {Sean Kulinski and David I. Inouye},
  title = {{Towards Explaining Distribution Shifts}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=Tig5ELxc0M},
}
Figure