Towards Explaining Distribution Shifts

Sean Kulinski, David I. Inouye

In real-world machine learning deployments, data distributions are rarely static. A model trained on last year's sales might fail today because consumer preferences have changed, or a medical imaging model might struggle because a new hospital uses a different staining technique.

While the machine learning community has developed numerous statistical tests to detect when a shift has occurred (the "if"), we lack cohesive methods to understand the nature of these shifts (the "how"). Currently, practitioners often rely on comparing simple means, which is too coarse for high-dimensional data and misses complex interactions. This paper addresses the gap between automated detection and manual mitigation by providing a framework of "interpretable transportation maps" that help human operators visualize and quantify the specific mechanics of a distribution shift.

Methodology: Interpretable Transport

The authors frame distribution shift as a problem of Optimal Transport (OT)—finding the most efficient way to move mass from a source distribution ($P_{src}$) to a target distribution ($P_{tgt}$). Because standard OT maps are often too complex for humans to understand, the authors propose Interpretable Transport (TIT) by adding specific constraints to the mapping process.

Overview of the Interpretable Transport framework

Depending on whether the features or samples are inherently interpretable, the framework branches into different explanatory strategies:

  • $k$-Sparse Transport: This restricts the explanation to only the $k$ most important features. For example, in a dataset with 100 features, it might reveal that a vast majority of the shift is explained by changes in just three specific variables.
  • $k$-Cluster Transport: This assumes the population is heterogeneous. It identifies $k$ subgroups and explains the shift as a distinct vector for each group (e.g., "Younger users moved toward Feature A, while older users moved toward Feature B"). Crucially, the authors found that joint clustering using OT to pair samples first is essential to ensure subgroups in the source correspond to subgroups in the target.
  • Distributional Counterfactuals: For high-dimensional data like images where raw pixels aren't interpretable, the authors use Image-to-Image (I2I) translation. They generate "counterfactual" pairs to show what an image from the source distribution would look like if it belonged to the target distribution.

To quantify the quality of these explanations, the authors introduce the PercentExplained (PE) metric. Analogous to $R^2$ in regression, PE tells the operator what percentage of the total distributional difference is captured by their simplified, interpretable map. By treating $k$ as a hyperparameter, an operator can start with a simple explanation and gradually increase complexity until the PE metric reaches a satisfactory level.

Key Insights and Real-World Results

The framework was evaluated across tabular, text, and image datasets, revealing insights that baseline methods missed.

Revealing Hidden Disparities in Tabular Data

Using the Adult Income Dataset (Census data), the authors analyzed shifts in income and education between demographic groups. While a simple mean shift baseline showed a general decrease in income for women compared to men, the $k$-cluster transport revealed a much more nuanced reality.

Comparing baseline explanations to k-cluster transport on the Adult Income dataset

As shown above, the $k$-cluster explanation ($k=4$) isolated specific subgroups. It revealed that the income disparity was not uniformly distributed; rather, it was most extreme specifically for middle-aged adults with bachelor's degrees (Cluster 4).

Contextual Shifts in Text

On the CivilComments dataset (analyzing shifts between toxic and non-toxic comments), the $k$-sparse OT method explained significantly more of the shift (16.8% with 10 words) compared to a standard mean-shift baseline (2.8%). The interpretable transport map could account for how words like "don't" or "just" change contextually between the two distributions, providing a clearer picture of linguistic toxicity.

Actionable Insights in Medical Imaging

For the Camelyon17 histopathology dataset, raw pixel differences are uninterpretable. Using distributional counterfactuals, the authors visually demonstrated that the primary shift between different hospitals was a consistent difference in staining intensity. This provided an actionable insight, suggesting that simple color augmentation could serve as a fix for downstream models.

Limitations and Future Work

While the proposed framework offers a significant step forward in model explainability, the authors note a few limitations:

  • Computational Scaling: The method relies on empirical OT solutions which scale quadratically with the number of samples. Applying this to millions of data points currently requires subsampling.
  • Latent Space Dependency: For image counterfactuals, the quality of the explanation depends entirely on the quality of the underlying latent space (e.g., VAE or GAN). If the latent space is not semantically meaningful, the transport maps will be uninterpretable.
  • Correlation vs. Causality: These transport maps show how the data moved, but they do not inherently explain the causal mechanism behind the shift. Integrating causal discovery into this transport framework remains an exciting path for future research.

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