Natural Attribute-based Shift Detection

1 INTRODUCTION . Deep learning has significantly improved the performance in various domains such as computer vision , natural language processing , and healthcare ( Bojarski et al. , 2016 ; Mikolov et al. , 2013 ; Esteva et al. , 2016 ) . However , it has been reported that the deep classifiers make unreliable predictions on samples drawn from a different distribution than the training distribution ( Amodei et al. , 2016 ; Hendrycks & Gimpel , 2017 ; Nguyen et al. , 2015 ) . Detection of unreliable predictions is important to build a robust model but it is relatively hard when the test distribution is gradually shifting due to a natural attribute since it is difficult to determine whether the classifier fails when the shift is not significant . These shifts occur in the real-world as a result of a change in specific attribute . For example , a clinical text-based diagnosis classifier trained in 2021 will gradually encounter increasingly shifted samples as time flows , since writing styles change and new terms are introduced in time . Detection of such samples is a vital task especially in safety-critical systems , such as autonomous vehicle control or medical diagnosis , where wrong predictions can lead to dire consequences . To this end , we take a step forward by proposing a new task of detecting samples shifted by a natural attribute ( e.g. , age , time ) that can easily be observed in the real-world setting . We refer to such shifts as Natural Attribute-based Shifts ( NAtS ) , and the task of detecting them as NAtS detection . Detection of NAtS is both different from , and also more challenging than out-of-distribution ( OOD ) detection ( Hendrycks & Gimpel , 2017 ; Liang et al. , 2018 ; Lee et al. , 2018 ; Chandramouli & Sageev , 2020 ) , which typically evaluates the detection methods with a clearly distinguished in-distribution ( ID ) samples and OOD samples ( e.g. , CIFAR10 as ID and SVHN as OOD , which have disjoint labels ) . In contrast , we aim to detect samples from a natural attribute-based shift within the same label space . Since NAtS samples share more features with the ID than the typical OOD samples do , identifying the former is expected to be more challenging than the latter . Although OOD detection has some relevance to NAtS detection , comprehensive evaluation of the existing OOD detection methods on the natural attribute-based shift is an unexplored territory . Therefore , in this paper , we perform an extensive evaluation of representative OOD methods on NAtS samples . Depending on the task environment , NAtS detection can be pursued in parallel to domain generalization ( Seo et al. , 2020 ; Gulrajani & Lopez-Paz , 2020 ; Carlucci et al. , 2019 ) , which aims to overcome domain shifts ( e.g. , image classifier adapting to sketches , photos , art paintings , etc. ) . For example , an X-ray-based diagnosis model should detect images of unusual brightness so that the X-ray ma- chine can be properly configured , and the diagnosis model can perform in the optimal setting . In other cases , domain generalization can be preferred , such as when we expect the classifier to be deployed in a less controlled environment ( e.g. , online image classifier ) for non-safety critical tasks . In this paper , we formalize NAtS detection to enhance the reliability of real-world decision systems . Since there exists no standard dataset for this task , we create a new benchmark dataset in the vision , text , and medical domain by adjusting the natural attributes ( e.g. , age , time , and brightness ) of the ID dataset . Then we conduct an extensive evaluation of representative confidence- and distance-based OOD methods on our datasets and observe that none of the methods perform consistently across all NAtS datasets . After a careful analysis on where NAtS samples reside in the feature space and its impact on the distance- and confidence-based OOD detection performance , we identify the root cause of the inconsistent performance . Following this observation , we define three general NAtS categories based on two criteria : the distance between NAtS samples and the decision boundary , the distance between NAtS samples , and the ID data . Finally , we conduct an additional experiment to demonstrate that a simple modification to the negative log-likelihood training objective can dramatically help the Mahalanobis detector ( Lee et al. , 2018 ) , a distance-based OOD detection method , generalize to all NAtS categories . We also compare our results with various baselines and show that our proposed modification outperforms the baselines and is effective across the three NAtS datasets . In summary , the contributions of this paper are as follows : • We define a new task , Natural Attribute-based Shift detection ( NAtS detection ) , which aims to detect the samples from a distribution shifted by some natural attribute . We create a new benchmark dataset and provide them to encourage further research on evaluating NAtS detection . • To the best of our knowledge , this is the first work to conduct a comprehensive evaluation of the OOD detection methods on shifts based on natural attributes , and discover that none of the OOD methods perform consistently across all NAtS scenarios . • We provide novel analysis based on the location of shifted samples in the feature space and the performance of existing OOD detection methods . Based on the analysis , we split NAtS samples into three categories . • We demonstrate that a simple yet effective modification to the training objective for deep classifiers enables consistent OOD detection performances for all NAtS categories . 2 NATURAL ATTRIBUTE-BASED SHIFT DETECTION . We now formalize a new task , NAtS detection , which aims to enhance the reliability of real-world decision systems by detecting samples from NAtS . We address this task in the classification problems . Let DI = { X , Y } denote the in-distribution data , which is composed of N training samples with inputs X = { x1 , ... , xN } and labels Y = { y1 , ... , yN } . Specifically , xi ∈ Rd represents a d-dimensional input vector , and yi ∈ K represents its corresponding label where K = { 1 , ... , K } is a set of class labels . The discriminative model fθ : X → Y learns with ID dataset DI to assign label yi for each xi . In the NAtS detection setting , we assume that an in-distribution sample consists of attributes , and some of the attributes can be shifted in the test time due to natural causes such as time , age , or brightness . When a particular attribute A ( e.g. , age ) , which has a value of a ( e.g. , 16 ) , is shifted by the degree of δ , the shifted distribution can be denoted as DA=a+δS = { X ′ , Y ′ } . X ′ = { x′1 , ... , x′M } and Y ′ = { y′1 , ... , y′M } represents the M shifted samples and labels respectively . Importantly , in the NAtS setting , although the test distribution is changed from the ID , the label space is preserved as K , which is the set of class labels in DI . In the test time , the model fθ might encounter the sample x′ from a shifted data DA=a+δS , and it should be able to identify that the attribute-shifted sample is not from the ID . 3 NATS DATASET DESCRIPTION . In this section , we describe three benchmark datasets which have a controllable attribute for simulating realistic distribution shifts . Since there exists no standard dataset for NAtS detection , we create new benchmark datasets using existing datasets by adjusting natural attributes in order to reflect real-world scenarios . We carefully select datasets from vision , language , and medical domains containing natural attributes ( e.g. , year , age , and brightness ) , which allows us to naturally split the samples . By grouping samples based on these attributes , we can induce natural attribute-based distribution shifts as described below . Image . We use the UTKFace dataset ( Zhang et al. , 2017 ) which consists of over 20 , 000 face images with annotations of age , gender , and ethnicity . As shown in Figure 1 , we can visually observe that the facial images vary with age . Therefore , we set the 1 , 282 facial images of 26 years old age as DI . For creating the NAtS dataset , we vary the age of UTKFace dataset . To obtain an equal number of samples in the NAtS dataset , the age groups that has less than 200 images are merged into one group until it has 200 samples . Finally , 15 groups DageS are produced for the NAtS datasets , varying the ages from 25 to 1 ( i.e. , Dage=25S , D age=24 S , . . . , D age=1 S ) . Text . We use the Amazon Review dataset ( He & McAuley , 2016 ; McAuley et al. , 2015 ) which contains product reviews from Amazon . We consider the product category ” book ” and group its reviews based on the year to reflect the distributional shift across time . We obtain 9 groups with each group containing reviews from the year between 2005 and 2014 . Then , the group with 24 , 000 reviews posted in 2005 is set as DI , and the groups with reviews after 2005 as DyearS ( i.e. , Dyear=2006S , D year=2007 S , . . . , D year=2014 S ) . Each D year S group contains 1500 positive reviews and 1500 negative reviews . We observed that as we move ahead in time , the average length of a review gets shorter and it uses more adjectives than previous years . Due to the space constraint , we provide a detailed analysis of the dataset in the Section B of the Appendix . Medical . We use the RSNA Bone Age dataset ( Halabi et al. , 2019 ) , a real-world dataset that contains left-hand X-ray images of the patient , along with their gender and age ( 0 to 20 years ) . We consider patients in the age group of 10 to 12 years for our dataset . To reflect diverse X-ray imaging set-ups in the hospital , we varied the brightness factor between 0 and 4.5 and form 16 different dataset DbrightnessS ( i.e. , D brightness=0.0 S , D brightness=0.2 S , . . . , D brightness=4.5 S ) , and each group contains Xray images of 200 males and 200 females . Figure 1 presents X-ray images with different levels of brightness with realistic and continuous distribution shifts . In-distribution data DI is composed of 3 , 000 images of brightness factor 1.0 ( unmodified images ) . 4 CAN OOD DETECTION METHODS ALSO DETECT NATS ? . In this section , we briefly discuss about OOD detection methods and conduct an extensive evaluation of OOD detection methods on our proposed benchmark datasets . 4.1 OOD DETECTION METHODS . In this work , we use three widely-used post-hoc and modality-agnostic OOD detection methods . We use maximum of softmax probability ( MSP ) ( Hendrycks & Gimpel , 2017 ) and ODIN ( Liang et al. , 2018 ) as confidence-based OOD detection baselines , and Mahalanobis detector ( Lee et al. , 2018 ) as distance-based OOD detection baseline . Note that ODIN and Mahalanobis detector assume the availability of OOD validation dataset to tune their hyperparameters . However , for all our experiments , we use variants of the above methods that do not access the OOD validation dataset as Hsu et al . ( 2020 ) . The exact equations and details of how each OOD detection method assigns an OOD score to a given sample is provided in Section A of the Appendix .

Summary: The authors propose a new task named NAS (natural attribute-based shift), which is a sub-task of OOD (out of distribution). Three datasets are designed from existing datasets for the NAS experiment. By visualizing the distribution of category features produced by the model under different datasets using PCA, the authors find three categories for NAS distribution. Total three OOD methods are tested on NAS datasets and show an inconsistency in their performance. Finally, the authors propose to use distance loss and entropy loss to retrain the models to improve the distance-based OOD methods.