Exploring Covariate and Concept Shift for Out-of-Distribution Detection and Calibration
Motivation
There are two dominant distribution shift types: covariate shift and concept shift. The former usually refers to change in style, e.g., clean to noised and natural images to cartoon, and the latter refers to change in semantics, e.g., a dog to a cat. However, existing works do not distinguish between different types of OOD datasets and no method is effective against both shifts simultaneously due to the lack of a systematic categorization. This section provides a categorization of OOD data and proposes two score functions for each distribution shift.
Categorization of Out-of-Distribution (OOD) Data
The following image demonstrates a categorization of OOD data in terms of distribution shift. The in-distribution data is CIFAR10 and OOD datasets are CIFAR10C, CIFAR100, and SVHN. CIFAR100 represents concept shift because CIFAR100 has a non-overlapping label space but similar style with CIFAR10. The corrupted CIFAR10C dataset represents covariate shift because it has the same labels but a different style compared to CIFAR10. SVHN represents both covariate and concept shift due to its non-overlapping label space and very different style.
Figure 1: Illustration of near and far Out-of-Distribution data. Top left: CIFAR10 dataset (training). Top right: CIFAR100 dataset. Lower left: Corrupted CIFAR10. Lower right: SVHN dataset.
Linear SoftMax Models
We are particularly interested in linear-softmax models. This type of model typically consists of a feature extractor, a linear layer, and a softmax activation layer as shown in Fig. 2. The output of the linear layer is called logits, which is the inner product between the feature and a linear classifier as shown in Eq.1.
Equation 1: Linear layer as inner product
Figure 2: Diagram of a typical Linear SoftMax Models
Score Functions From KL Divergence
Following the categorization, we derive two score functions for each type of distribution shift. Conditioning on the input, a score function outputs a scalar indicating the severity of distribution shift of the input. We start our derivation based on the KL-divergence between a uniform distribution U and a predictive distribution P. By starting from KL-divergence, we hinge the subsequent derivation of score functions on a physical meaningful uncertainty measure, i.e., how far the predicted distribution is from a uniform distribution.
Specifically, we bound the KL divergence by a quantity script u as shown in Eq.2.
Equation 2: KL divergence bounds
The script u is our combined score function which decomposes into two a covariate score function g(x) and a concept score function h(y,x) as shown in Eq.3.
Equation 3: Decomposition of the combined score functions. g(x) is a function of feature norms and h(y,x) is a function of feature angles.
Conceptually, these two scores disentangle covariate shift and concept shift. However, in practice, both shifts almost always happen at the same time in the image domain, i.e., covariate shifted data (noised data) often result in concept shift, i.e., increasing ambiguity in class assignment. Therefore, both scores can increase and decrease simultaneously. The importance of separating them conceptually is to provide a clean perspective to study robust out-of-distribution detection methods that will work well on different situations under a mixed of shifts.
Conclusion
In this section, we covered a possible categorization of out-of-distribution data by distribution shifts. Specifically, OOD datasets can generally be categorized by how much they differ from the training dataset in terms of covariate shift and concept shift. We illustrated the categorization with an example of the CIRAF10 dataset. As mentioned on the introduction page, we first approached the problem of distribution shifts from the representation level. Specifically, we derived two score functions for each distribution shift arising from expanding a meaningful uncertainty measure: the KL divergence between a uniform distribution and the predictive distribution. The score functions shed light on the mechanism via which distribution shifts affect a learned featured space, i.e., norms and angles, and provide a disentangled way to measure the severity of distribution shifts. Knowing the functional forms of score functions for each distribution shift, we can set out to improve a model's sensitivity to them by improving the sensitivity of components in each score function, i.e., norms and angles, in the next section.