Novelty detection using ensembles with regularized disagreement

Despite their excellent performance on in-distribution ( ID ) data , deep neural networks often confidently predict on out-of-distribution ( OOD ) samples that come from novel classes instead of flagging them for expert evaluation . Even though conventional OOD detection algorithms can distinguish far OOD samples , current methods that can identify near OOD samples require training with labeled data that is very similar to these near OOD samples . In turn , we develop a new ensemble-based procedure for semi-supervised novelty detection ( SSND ) that only utilizes a mixture of unlabeled ID and OOD samples to achieve good detection performance on near OOD data . It crucially relies on regularization to promote diversity on the OOD data while preserving agreement on ID data . Extensive comparisons of our approach to state-of-the-art SSND methods on standard image data sets ( SVHN/CIFAR-10/CIFAR-100 ) and medical image data sets reveal significant gains with negligible increase in computational cost 1 . 1 INTRODUCTION . Despite achieving great in-distribution ( ID ) performance , deep neural networks ( DNN ) often have trouble dealing with samples in the test set that are out-of-distribution ( OOD ) , i.e . test inputs that are unlike the data seen during training . For example , DNNs often make incorrect predictions with high confidence when new unseen classes emerge over time ( e.g . undiscovered bacteria Ren et al . ( 2019 ) , new diseases Katsamenis et al . ( 2020 ) ) , or when data suffers from distribution shift ( e.g . corruptions Lu et al . ( 2019 ) , environmental changes Kumar et al . ( 2020 ) ) . If the labels of these OOD samples follow the same conditional probability distribution as the training set Shimodaira ( 2000 ) , it is most desirable to output calibrated uncertainty estimates in addition to a single predicted value , as in Neal ( 1996 ) ; Gal & Ghahramani ( 2016 ) ; Malinin & Gales ( 2018 ) ; Lakshminarayanan et al . ( 2017 ) . In contrast , when this assumption does not hold and some inputs might come from previously unseen classes , we would like to detect such novel samples and bring them to the attention of experts . More specifically , in novelty detection , we want to detect inputs x that satisfy PX ( x ) < α for a small threshold α , where PX is the marginal training ( ID ) distribution . Previous works that have tackled this problem are known as open-set recognition and OOD detection methods . In what follows , we use the terms novelty detection ( ND ) and OOD detection interchangeably . Related problems such as aforementioned uncertainty estimation or one-class ( OC ) classification have slightly different objectives but also include methods that are applicable to novelty detection . 1Our code is publicly available at https : //bit.ly/3a7aQyN Numerous novelty detection methods are successful for simple benchmarks where the OOD samples are far from the training samples ( such as SVHN vs CIFAR10 ) . As Winkens et al . ( 2020 ) and a number of concurrent works ( Tack et al. , 2020 ; Fort et al. , 2021 ) recently noted , these methods however have subpar performance on near OOD data , for instance when OOD samples are drawn from unseen classes from the same data set ( e.g . CIFAR100 vs CIFAR10 ) . A recent method that is reported to have high near OOD detection performance involves tuning large models pretrained on ImageNet21k ( Fort et al. , 2021 ) and , hence , arguably relies on using during training OOD data that contains classes that are close to the unseen CIFAR classes during test time . However , in many scientific applications that use , for instance , medical or satellite images , such large data sets for pretraining are not available . In particular , truly novel classes will be inherently dissimilar from any previously available data while still sharing some of the same characteristics . Instead , a more realistic scenario assumes access to a small batch of unlabeled test data that includes ID and OOD samples without knowing which are the outliers . We can use this set during training to ultimately perform well on future samples ( i.e . semi-supervised novelty detection ( SSND ) ( Blanchard et al. , 2010 ) ) or to detect outliers from that particular test batch itself ( reminiscent of transductive OOD detection ( Scott & Blanchard , 2008 ) ) . Even though using unlabeled data has the potential to improve detection performance as argued in Scott & Blanchard ( 2009 ) , existing SSND methods for deep neural networks ( Kiryo et al. , 2017 ; Yu & Aizawa , 2019 ; Guo et al. , 2020 ; Zhang et al. , 2020b ) do not leverage the unlabeled set well enough to improve near OOD detection performance , as shown in Figure 1 . This includes previous methods that try to obtain a diverse ensemble and use it for novelty detection , such as MCD ( Yu & Aizawa , 2019 ) . In this paper , we introduce Ensembles with Regularized Disagreement ( ERD ) , an ensemble method for SSND that successfully takes advantage of the unlabeled data to achieve the right amount of disagreement between the model predictions . The models in our ensemble are trained to not only fit the training data but also the artificially labeled samples from the unlabeled set , while aiming to achieve good validation accuracy . In particular , • we argue why regularizing disagreement is crucial for OOD detection with ensemble methods . • we give a justification , backed by theoretical arguments , as to why training with early stopping and with artificial labels assigned to the unlabeled set achieves the right amount of disagreement . • we test our method on many near OOD tasks , including medical data , demonstrating significant gains with a negligible increase in computation cost compared to vanilla ensembles . 2 RELATED WORK AND A TAXONOMY OF OOD DETECTION METHODS . In this section we give an overview of approaches that are related to ours and categorize them with respect to 1 ) data availability and 2 ) the final objective . Further , we list a few representative approaches in Table 1 and refer the reader to surveys such as Bulusu et al . ( 2020 ) for a thorough literature overview . 2.1 TAXONOMY ACCORDING TO DATA AVAILABILITY . In this section we present methods that are ordered by a decreasing necessary amount of labeled OOD data or data similar to OOD data at test time . Supervised and augmented unsupervised ND . We call methods that use labeled OOD samples from the test distribution for calibration or hyperparameter tuning supervised ND ( SND ) ( Yu & Aizawa , 2019 ; Lee et al. , 2018 ; Liang et al. , 2018 ; Ruff et al. , 2020 ) . Alternatively , some works use during training either real , known outliers Hendrycks et al . ( 2019 ) ; Malinin & Gales ( 2018 ) or OOD-like synthetically generated data to simulate the test OOD distribution , in what we call the augmented unsupervised ND ( A-UND ) . However , the performance of these methods relies on proxy OOD data that is similar to test OOD . Concurrent works also propose to use models large-scale models that are pretrained on datasets that contain classes similar to the novel classes ( Fort et al. , 2021 ; Reiss & Hoshen , 2021 ) , referred to as pretrained unsupervised ND . Semi-supervised novelty detection ( SSND , ours ) . This setting is the one we study in this work.2 We assume that , apart from class-labeled training data , we also have access to a small batch of unlabeled data drawn from the test distribution . It consists of ID and OOD data without explicitly knowing which samples are ID and OOD . SSND methods attempt to detect OOD samples from a new batch drawn from the same test distribution ( Blanchard et al. , 2010 ; Mũnoz-Marı́ et al. , 2010 ; du Plessis et al. , 2014 ; Liu et al. , 2018 ) . This is similar to the goal of approaches that use unlabeled data for learning with augmented classes ( U-LAC ) ( Da et al. , 2014 ; Guo et al. , 2020 ; Zhang et al. , 2020b ) . The SSND setting is related to transductive novelty detection ( Scott & Blanchard , 2008 ; Guo et al. , 2020 ) , where the test set coincides with the unlabeled set used for training . Unsupervised novelty detection ( UND ) . In this less restrictive setting , only ID data is available during training ( Lakshminarayanan et al. , 2017 ; Sastry & Oore , 2019 ; Nalisnick et al. , 2019 ; Choi et al. , 2018 ) , which generally leads to a poorer performance . Even though Scott & Blanchard ( 2009 ) prove for shallow models that unlabeled data available in SSND should significantly improve detection , it remains unclear how well deep neural networks can leverage the unlabeled data set effectively . 2.2 TAXONOMY ACCORDING TO OVERALL OBJECTIVE . We now discuss the different objectives of methods in the literature that can be used to detect OOD samples and explicitly list those that do not explicitly mention this keyword . Learning the ID marginal PX . Since we define OOD samples as all x for which PX ( x ) < α , if we had access to the marginal training distribution PX , we would have perfect OOD detection for any x 6∈ XID . Generative models ( Choi et al. , 2018 ; Akçay et al. , 2018 ; Nalisnick et al. , 2019 ) , however , struggle to learn the density from finite samples when the data is high-dimensional . Alternatively , one-class classification ( Mũnoz-Marı́ et al. , 2010 ; Ruff et al. , 2020 ; Sohn et al. , 2021 ) and PU learning approaches ( du Plessis et al. , 2014 ; Kiryo et al. , 2017 ) try to directly learn a discriminator between ID and OOD data , but tend to produce indistinguishable representations for inliers and outliers when the ID distribution consists of many diverse classes . Learning PX using label information . ( ours ) When the ID training set has class labels , one can take advantage of that additional information to distinguish points in the support of PX from OOD data , for instance , by using the intermediate representations of trained neural networks ( Lee et al. , 2018 ; Sastry & Oore , 2019 ) . Often the task is to also simultaneously predict well on ID data , known in the literature as the problem open-set recognition ( Zhang et al. , 2020a ; Geng et al. , 2021 ) . Learning uncertainty estimates for PY |X . Uncertainty estimates optimized for minimal calibration error can naturally be used for OOD samples . Many uncertainty quantification methods are based on a Bayesian framework ( Gal & Ghahramani , 2016 ; Malinin & Gales , 2018 ; Graves , 2011 ; Blundell et al. , 2015 ) or calibration improvement ( Liang et al. , 2018 ; Hafner et al. , 2019 ) – neither of them however perform as well as other OOD methods mentioned above ( Ovadia et al. , 2019 ) . 3 PROPOSED METHOD . In this section we introduce our proposed algorithm , ERD , and provide a principled justification for the key ingredients that lead to the improved performance of our method . 2We use the same definition of SSND as the survey by Bulusu et al . ( 2020 ) , whereas some works use the term to refer to SND ( Gornitz et al. , 2013 ; Daniel et al. , 2019 ; Ruff et al. , 2020 ) or UND ( Song et al. , 2017 ; Akçay et al. , 2018 ) according to our taxonomy .

Summary: The authors introduce a semi-supervised ensemble approach to novelty detection. The main idea consists in generating base classifiers that disagree on the out-of-distribution data (ODD). An early-stop criterion is used to achieve the wanted level of disagreement among the component of the ensemble.  The main assumption is the availability, for training, of clean labeled in-distribution (ID) data, and of unlabeled data which include both ID data and out-of-distribution (OOD) data. The unlabeled data follows the same distribution of the data the ensemble is tested on.  Each base classifier is first trained on the labeled in-distribution (ID) data. For a given base classifier, the unlabeled data is randomly assigned to one of the labels (a different label is chosen for each base classifier), and the classifier is tuned on the resulting labeled data. The tuning is stopped when the optimal tradeoff between high validation accuracy (on inliers) and low training error are achieved. This regularization process is aimed at avoiding fitting the incorrect assigned labels in the unsupervised portion of the training data and to achieve disagreement among the base classifiers on the OOD data.