TIME-LAPSE: Learning to say “I don't know” through spatio-temporal uncertainty scoring

1 INTRODUCTION . Modern machine learning ( ML ) has seen tremendous success in various tasks across multiple domains ( Bojarski et al. , 2016 ; Hinton , 2018 ; Kreinovich & Kosheleva , 2020 ; van den Oord et al. , 2016 ) , surpassing human performance in many benchmarks ( Esteva et al. , 2017 ; Yala et al. , 2019 ; Krizhevsky et al. , 2012 ) . However , deep learning models have been known to fail silently and catastrophically with highly confident predictions ( Nguyen et al. , 2015 ; Goodfellow et al. , 2015 ; Guo et al. , 2017 ) . Such models assume a closed world scenario , i.e. , they assume that variability encountered when deployed in the real-world would be similar to the variability present in their training data . In practice , they encounter an open world where incoming samples can come from shifted distributions or completely new distributions ( Liu et al. , 2020 ) . This behaviour can have severe consequences in mission-critical domains such as healthcare and autonomous driving , where errors can be costly , resulting in injury or even death ( Amodei et al. , 2016 ) . Most widely cited models do not come with an uncertainty scoring mechanism to say “ I don ’ t know ” or to abstain from prediction ( Kompa et al. , 2021 ) . As deployed ML models are used to inform real-world decisions , it is important that they have the ability to understand when they ought to be “ unsure ” . A good uncertainty scoring framework must assign higher uncertainty estimates when the network is faced with distributional shifts or new semantic content , i.e. , out-of-distribution ( OOD ) data but must be certain ( low uncertainty ) and generalize well on learnt distributions yet unseen data ( in-distribution or InD data ) . The task of identifying when incoming inputs are drawn far from the training distribution is called out-of-distribution ( OOD ) detection . At its core , it is a binary classification problem , evaluated using measures such as area under the receiver operating curve ( AUROC ) , area under the precision recall curve ( AUPR ) and false positive rate at 80 % true positive rate ( FPR80 ) . Current OOD evaluation schemes hold different datasets to be OOD sources , without considering if the distinctions are semantic in nature ( Ahmed & Courville , 2020 ) leading to methods that are insensitive to semantic overlap and biased to dataset statistics . Closely related is the task of dataset shift detection ( MorenoTorres et al. , 2012 ) , crucial for deployed systems . Dataset shift can occur due to sample selection bias , non-stationary environments , missing values , new concepts evolving over time , etc . Most ML systems do not evaluate their ability to detect such shifts , presenting a huge gap between models performing well on test sets and models capable of being deployed in the wild . In this paper , we propose TIME-LAPSE , a predictive uncertainty quantification framework using latent space embeddings over time , evaluated through downstream tasks of OOD detection and dataset shift detection . A key insight in our approach is that most real-world scenarios ( such as electroencephalogram ( EEG ) seizure analysis , healthcare decision making , autonomous driving , etc . ) involve consecutive inputs to the model that are likely to be correlated over time . For example , an obstacle detector deployed in a self-driving car will see images correlated over time . A seizure detector installed in a neurology clinic will process hours of time-correlated EEG signals . Even low-risk image classification models deployed in search engines over the cloud will see correlated inputs over time when grouped by user ID or location . Thus , sequentially occurring samples share meaningful semantic correlations . In TIME-LAPSE ( Fig . 1 ) , we compute spatial uncertainty scores based on the following hypotheses : an encoder with enough inductive bias likely ( a ) maps OOD inputs “ far '' from other InD samples in the latent space under the Mahalanobis distance metric ( Lee et al. , 2018 ) and ( b ) produces dissimilarities between their representations under the cosine similarity metric ( Jones & Furnas , 1987 ) . We compute temporal uncertainty scores by exploiting correlations between lower dimensional representations of consecutive samples over time when examined as a sequence . A sequence of InD inputs will show more correlation than a sequence with both InD and OOD inputs or a sequence with just OOD inputs . Recent works limit themselves to OOD detection tasks with evaluations purely on highly curated image benchmarks , but do not extend their tests to more diverse and realistic scenarios required for practical applications ( Ren et al. , 2019 ; Ahmed & Courville , 2020 ) . Such OOD image benchmarks consider different datasets to be OOD sources , neglecting any semantic overlap between their OOD test sets and InD train sets , leading to narrow model capabilities ( Yang et al. , 2021 ) . We show that TIME-LAPSE is more driven by semantic content compared to other techniques , i.e . it is more robust to dataset statistics . Moreover , current evaluation schemes do not consider different dataset drift settings that could occur in the real-world . We put forth an additional sequential evaluation framework to evaluate methods under realistic conditions of data drifts and show that TIME-LAPSE outperforms other methods significantly . We demonstrate the efficacy of our proposed method by comparing against multiple baselines over different domains ( vision , audio and clinical EEGs ) . We achieve state-of-the-art ( SOTA ) on both audio and EEG datasets while improving performance on semantically corrected image benchmarks . To the best of our knowledge , we are the first to use temporal sequences of latent space embeddings for uncertainty quantification . We are also the first to use deep-learning based uncertainty scoring techniques for EEG analyses . To summarize , our key contributions are : • We propose TIME-LAPSE , an uncertainty scoring framework that uses samples ’ similarity in the latent space and their temporal similarity amongst sequential inputs to determine their predictive uncertainty . • We show that scores from TIME-LAPSE are driven by semantic content and are more robust to dataset statistics whereas popular baselines , benchmarked on standard image datasets , are susceptible to dataset statistics and overlook semantic overlap for OOD detection . • We benchmark TIME-LAPSE on diverse domains : audio speech classification , seizure detection using clinical EEGs and image classification . TIME-LAPSE achieves state-of-the-art ( SOTA ) in audio tasks , the EEG domain and semantically corrected image benchmarks . • We propose a sequential evaluation framework for dataset shift detection to evaluate methods under realistic conditions of data drifts and show that TIME-LAPSE outperforms other methods . We hope this evaluation scheme will be adopted for routinely characterizing ML system performance in the wild . 2 RELATED WORK . Uncertainty estimation is a rich field with a long history . Classical techniques include density estimation ( Breunig et al. , 2000 ) , one-class SVMs ( Schölkopf et al. , 1999 ) , tree-isolation forests ( Liu et al. , 2008 ) , etc for one-dimensional data such as time-series However , such techniques scale badly with input dimensionality ( Rabanser et al. , 2019 ) . Calibration is a frequentist notion of uncertainty , measured by proper scoring rules like log-loss or Brier scoring ( Guo et al. , 2017 ; DeGroot & Fienberg , 1983 ; Dawid , 1982 ) . Uncertainty estimation for deep neural networks ( NNs ) ( Lakshminarayanan et al. , 2017 ) typically use a Bayesian formalism to learn distributions over model weights ( Blundell et al. , 2015 ; Malinin & Gales , 2018 ; Chen et al. , 2019 ; Graves , 2011 ; Neal , 1996 ; Welling & Teh , 2011 ) . However , most Bayesian methods are difficult to train and computationally expensive . Gal & Ghahramani ( 2016 ) use Monte-Carlo dropout at test-time with an approximate Bayesian interpretation to derive uncertainty estimates.It is also computationally expensive , requiring k forward passes for each instance during inference . Quality of uncertainty estimates are commonly evaluated using OOD detection . Moreno-Torres et al . ( 2012 ) give a complete overview of closely related topics of distributional shift detection including covariate shift , label shift and concept drift ( Gama et al. , 2014 ) . Several works consider semi-supervised techniques for OOD such as outlier exposure methods ( Hendrycks et al. , 2019a ; Ruff et al. , 2020 ) , while many assume the supervised setting where the target OOD distribution is known and propose alternative training strategies and auxillary OOD tasks ( DeVries & Taylor , 2018 ; Hendrycks et al. , 2019b ; Mohseni et al. , 2020 ; Shalev et al. , 2018 ) in a multi-task setting . In this paper , we consider the more general setting of unsupervised OOD detection where no OOD examples are labelled as such and the encoder has access to only InD training labels . Other methods use representations from NNs to infer OOD inputs . Hendrycks & Gimpel ( 2017 ) use maximum softmax probabilites ( MSP ) to detect OOD data . Liang et al . ( 2018 ) improve this by introducing a temperature parameter to the softmax equation . Lee et al . ( 2018 ) fit class-conditional Gaussians to intermediate activations and use the Mahalanobis distance to identify OOD samples . Recently , some works use self-supervision to get better representations to improve OOD detection ( Tack et al. , 2020 ; Winkens et al. , 2020 ; Sehwag et al. , 2021 ) . Several methods directly use input likelihoods as the OOD detection score . However , studies have shown that generative techniques may be overconfident on complex inputs ( Nalisnick et al. , 2019 ) . Modified likelihood scores have been proposed since then ( Serrà et al. , 2020 ; Xiao et al. , 2020 ; Choi et al. , 2019 ) including energy-based models ( Liu et al. , 2020 ; Du & Mordatch , 2019 ; Grathwohl et al. , 2020 ) and likelihood ratios ( Ren et al. , 2019 ) . Reconstruction-based OOD methods use reconstruction loss as the uncertainty score and primarily use auto-encoders ( Zong et al. , 2018 ; Pidhorskyi et al. , 2018 ) or GANs ( Schlegl et al. , 2017 ; Deecke et al. , 2019 ; Perera et al. , 2019 ) . Our temporal uncertainty scores builds upon and shares similarity to change point detection methods in time-series data ( Aminikhanghahi & Cook , 2017 ; Kifer et al. , 2004 ) along with signal processing techniques such as Particle and Kalman filtering ( van der Merwe et al. , 2001 ; Kalman , 1960 ) . 3 TIME-LAPSE : OUR UNCERTAINTY SCORING FRAMEWORK . We propose TIME-LAPSE , an uncertainty scoring framework using latent-space embeddings over time . We consider a multi-class classification setting here , though our framework can be extended to other scenarios such as regression , segmentation , etc . 3.1 PROBLEM SETUP . Let X represent our high-dimensional input space , X ⊆ Rn . Let Y = { 0 , 1 , 2 , ... , C − 1 } denote the label space where C is the number of classes . In standard multi-class classification , we learn a classifier f : X 7→ Y using a dataset Dtrain ( assumed to be sampled from an underlying distribution p∗ ) such that f ( x ) = p ( Y = yi|x ) , where x ∈ X and yi ∈ Y ∀ i . The final prediction for an unseen input x is given by ŷ = arg maxyi p ( yi|x ) . Given a sequence of unseen inputs , xt ( where t denotes time ) to a classifier during inference , our goal is to output a score s ( xt ) and a selective function g ( xt ) with threshold th ∀ xt such that ( g , s ) ( xt ) : = { ŷ = arg maxyi p ( yi|xt ) , if s ( xt ) ≤ th ABSTAIN or FLAG AS OOD , else We call the score s ( xt ) the associated uncertainty score of input sample xt

Summary: The paper proposes a spatio-temporal approach for unsupervised out-of-distribution detection. In particular, it suggests a 'hierarchical' evaluation method based on computation of existing distance/similarity scores on hidden embeddings of high-dimensional data succeeded by a temporal component, that is also based on existing work, that treats chunks of  scores, computed by the first step, of input data as a stream. The suggested pipeline achieves state-of-the-art results on datasets coming from different domains ( image, audio, clinical data). More importantly, it demonstrates the importance of semantic context when deciding whether a sample is ood exhibiting better performance than existing baselines when semantic overlap should be taken into consideration.