TOWARDS EXPLAINING DISTRIBUTION SHIFT

Abstract

A distribution shift can have fundamental consequences such as signaling a change in the operating environment or significantly reducing the accuracy of downstream models. Thus, understanding distribution shifts is critical for examining and hopefully mitigating the effect of such a shift. Most prior work has focused on merely detecting if a shift has occurred and assumes any detected shift can be understood and handled appropriately by a human operator. We hope to aid in these manual mitigation tasks by explaining the distribution shift using interpretable transportation maps from the original distribution to the shifted one. We derive our interpretable mappings from a relaxation of the optimal transport problem, where the candidate mappings are restricted to a set of interpretable mappings. We then use quintessential examples of distribution shift in simulated and real-world cases to showcase how our explanatory mappings provide a better balance between detail and interpretability than the de facto standard mean shift explanation by both visual inspection and our PercentExplained metric.

1. INTRODUCTION

Most real-world environments are constantly changing, and in many situations, understanding how a specific operating environment has changed is crucial to making decisions respective to such a change. Such a change might be a new data distribution seen in deployment which causes a machine learning model to begin to fail. Another example is a decrease in monthly sales data which could be due to a temporary supply chain issue in distributing a product or could mark a shift in consumer preferences. When these changes are encountered, the burden is often placed on a human operator to investigate the shift and determine the appropriate reaction, if any, that needs to be taken. In this work, our goal is to aid these operators in providing an explanation of such a change. This ubiquitous phenomenon of having a difference between related distributions is known as distribution shift. Much prior work focuses on detecting distribution shifts; however, there is little prior work that looks into understanding a detected distribution shift. As it is usually solely up to an operator investigating a flagged distribution shift to decide what to do next, understanding the shift is critical for the operator to more efficiently mitigate any harmful effects of the distribution shift. Without a defined approach to this task, the current de facto standard in analyzing a shift is looking at how the mean of the original, source, distribution shifted to the new, target, distribution. However, this simple explanation can miss crucial shift information due to being a coarse summary (e.g., Fig. 2 ). Further, in high-dimensional regimes, a shift in means could be uninterpretable due to its high dimensionality. Instead, if after flagging that a shift has occurred, we could automatically provide more detailed information about the shift but still remain at a level that is interpretable, we could reduce the manual load on the operator to understand the shift, and, ultimately, to take action if necessary. Therefore, we propose a novel framework for explaining distribution shifts, such as showing how features have changed or how groups within the distributions have shifted. Since a distribution shift can be seen as a movement from a source distribution x ∼ P src to a target distribution y ∼ P tgt , we define a distribution shift explanation as a transport map T (x) which maps a point in our source distribution onto a point in our target distribution. For example, under this framework, the typical distribution shift explanation via mean shift can be written as T (x) = x + (µ y -µ x ). Intuitively, these transport maps can be thought of as a functional approximation of how the source distribution could have moved in a distribution space to become our target distribution. However, without making assumptions on the type of shift, there exist many possible mappings that explain the shift (see subsection A.2 for examples). Thus, we leverage prior optimal transport work to define an Figure 1 : An overall look at our approach to explaining distribution shifts, where given a source P src and shifted P tgt 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 Section 6. 𝑃𝒙→# 𝑃𝒙→$ 𝑃𝒙→% 𝑃𝒙→& 𝑃𝒙→' 𝑃𝒙 𝑃 # 𝑃$ 𝑃% !! !" !# !$ !% !&→!!&→" !&→# !&→$ !&→% ! & !! !" !# !$ !% Original Counterfactual ideal distribution shift explanation and develop practical algorithms for finding and validating such maps. We summarize our contributions as follows: • In Section 3, we define interpretable transport maps by constraining a relaxed form of the optimal transport problem to only search over a set of interpretable mappings and suggest possible interpretable sets. • In Section 4, we develop practical methods for finding such interpretable mappings which allow us to adjust the interpretability of an explanation to fit the needs of a situation. • In Section 5, we show empirical results on real-world tabular datasets demonstrating how our explanations and our PercentExplained metric can aid an operator in understanding how a distribution has shifted. • In Section 6, we use latent transport mappings and Image-to-Image translation methods to extend this approach to explain image-based shifts such as investigating how the staining of histopathological images varies across a hospital network.

2. RELATED WORKS

The characterization of the problem of distribution shift has been extensively studied (Quiñonero-Candela et al., 2009; Storkey, 2009; Moreno-Torres et al., 2012) via breaking down a joint distribution P (x, y) of features x and outputs y, into conditional factorizations such as P (y|x)P (x) or P (x|y)P (y). For covariate shift (Sugiyama et al., 2007) the P (x) marginal differs from source to target, but the output conditional P (y|x) the same, while label shift (also known as prior probability shift) (Zhang et al., 2013; Lipton et al., 2018) is when the P (y) marginals differ from source to target, but the full-feature conditional P (x|y) remains the same. In this work, we refer to general problem distribution shift, i.e. a shift in the joint distribution (with no distinction between y and x), and leave applications of explaining specific sub-genres of distribution shift to future work. As far as we are aware, this is the first work specifically tackling explaining distribution shifts; however, there are distinct works that can be applied to explain distribution shifts 2020) uses a classifier-guided VAE to generate class counterfactuals on tabular data). We explore this distributional counterfactual explanation approach in subsection 6.2. A sister field is that of detecting distribution shifts. This is commonly done using methods such as statistical hypothesis testing of the input features (Nelson, 2003; Rabanser et al., 2018; Quiñonero-Candela et al., 2009) , training a domain classifier to test between source and non-source domain samples Lipton et al. (2018 ), etc. In (Kulinski et al., 2020; Budhathoki et al., 2021) , the authors



women, -men, +man, +people, -like] which aligns 7.3% of non-toxic to toxic comments OT -!→-"./#0 = [OT 1!→1" ./' ] + [+trump, +just, +don't, +black, -male] which accounts for 11.61% of the shift 𝜇-!→-" = [+trump, -women, …...... , -bishops, -000, +hell, -day, -government, + race, -role, +sick]

Pawelczyk et al. (2020)  and apply them for "distributional counterfactuals" which would show what a sample from P tgt would have looked like if it instead came from P src (e.g.,Pawelczyk  et al. (

