Statistical Evaluation of Anomaly Detectors for Sequences

Statistical Evaluation of Anomaly Detectors for Sequences

Statistical Evaluation of Anomaly Detectors for Sequences Erik Scharwächter Emmanuel Müller [email protected] [email protected] University of Bonn, Germany University of Bonn, Germany ABSTRACT input sequence ¹xt ºt Although precision and recall are standard performance measures for anomaly detection, their statistical properties in sequential de- tection settings are poorly understood. In this work, we formalize anomaly score ¹zt ºt a notion of precision and recall with temporal tolerance for point- based anomaly detection in sequential data. These measures are based on time-tolerant confusion matrices that may be used to ground-truth anomalies ¹et ºt compute time-tolerant variants of many other standard measures. However, care has to be taken to preserve interpretability. We per- form a statistical simulation study to demonstrate that precision and recall may overestimate the performance of a detector, when computed with temporal tolerance. To alleviate this problem, we Figure 1: The running example for earthquake detection. show how to obtain null distributions for the two measures to assess the statistical significance of reported results. KEYWORDS work is closely related to recent advances in the statistical associa- tion between event series and time series [4, 9, 14, 15, 20], and uses anomaly detection, precision, recall, confusion matrix, simulations results from event coincidence analysis (ECA) [7, 12, 16]. Source ACM Reference Format: codes are available at https://github.com/diozaka/anomaly-eval. Erik Scharwächter and Emmanuel Müller. 2020. Statistical Evaluation of Anomaly Detectors for Sequences. In MileTS ’20: 6th KDD Workshop on Min- 1.1 Anomaly detection problem ing and Learning from Time Series, August 24th, 2020, San Diego, Claifornia, We are given an input sequence ¹xt ºt=1; :::;T over an arbitrary input USA. ACM, New York, NY, USA, 5 pages. https://doi.org/10.1145/nnnnnnn. domain. Furthermore, we are given an anomaly scoring function nnnnnnn z to compute a numeric sequence of anomaly scores ¹zt ºt=1; :::;T from the input sequence. If the observation at time step t is likely 1 INTRODUCTION an anomaly, the anomaly score zt should be high; if the observation Anomaly detection in sequential data is a highly active research at time step t appears normal, zt should be low. An anomaly is topic [3, 10, 13, 17, 18, 23]. Precision and recall are two measures predicted at time step t if the anomaly score is larger than some routinely used to evaluate the performance of anomaly detectors, predefined threshold, zt ≥ τ . The exact notion of what constitutes both for iid data and for sequential data. An important character- an anomaly is highly domain-specific and should be reflected in istic of sequential data is that the decisions of a detector can be the choice of the anomaly scoring function. Anomaly detectors of imprecise [1, 2] without impairing its practical utility: if an anomaly this type are widely used across many disciplines. For example, at time step t is detected at time step t + 1, this is still a useful result. Wiedermann et al. [21] use the clustering coefficient as an anomaly Recently, Tatbul et al. [19] pointed out that the classical precision score for dynamic networks to detect El Niño events in climate and recall measures, when applied to sequential detection problems, data, and Earle et al. [8] use an energy transient score [22] to detect 1 may misrepresent the performance of the detector. They introduced earthquakes from Twitter time series. arXiv:2008.05788v1 [cs.LG] 13 Aug 2020 novel precision and recall measures for range-based anomaly detec- We use the problem of earthquake detection on Twitter as the tion. However, the problem persists even for point-based anomalies, running example in this work. Figure 1 (top row) shows the daily vol- where the ground-truth anomaly label is a single time step. In this ume of tweets that were posted in Germany between 2010 and 2017 work, we study in detail time-tolerant notions of precision and and contain the word “earthquake,” translated to various languages. recall for point-based anomaly detection in sequential data, with a The plot also shows all severe earthquakes that occurred globally special focus on the statistical properties of these measures. Our in the same time period (bottom row). We obtained the Twitter data using the ForSight platform from Crimson Hexagon/Brandwatch2, Permission to make digital or hard copies of part or all of this work for personal or and the earthquake data from the International Disaster Database classroom use is granted without fee provided that copies are not made or distributed EM-DAT, provided by the Centre for Research on the Epidemiology for profit or commercial advantage and that copies bear this notice and the full citation of Disasters3. Our goal is to evaluate whether an anomaly detector on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s). on the Twitter time series has the potential to detect earthquakes MileTS ’20, August 24th, 2020, San Diego, California, USA © 2020 Copyright held by the owner/author(s). 1https://www.twitter.com/ ACM ISBN 978-x-xxxx-xxxx-x/YY/MM. 2https://www.brandwatch.com/ https://doi.org/10.1145/nnnnnnn.nnnnnnn 3https://www.emdat.be/ MileTS ’20, August 24th, 2020, San Diego, California, USA Erik Scharwächter and Emmanuel Müller R δ 1 1 recall δ with temporal tolerance as: δ = 0 δ = 1 Í Ít+δ 0.8 0.8 δ = I 0 et 0 > 0 · I¹zt ≥ τ º δ 2 t t =t−δ P δ δ = 4 P = R 0.6 0.6 δ Í (2) t I¹zt ≥ τ º recall 0.4 δ = 0 0.4 t+δ precision Í ·I Í I¹ 0 ≥ º δ = 1 t et t 0=t−δ zt τ > 0 0.2 δ = 2 δ = 4 0.2 Rδ = Í : (3) t et 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 threshold (quantile) threshold (quantile) If δ = 0, the tolerant measures are equivalent to the standard measures. If δ > 0, the definition of a true positive in the numerator changes. In fact, there are now two different types of true positives: Figure 2: Precision and recall by threshold and tolerance δ. In the case of precision, a true positive is a predicted anomaly at time step t with an actual anomaly within the range »t − δ; t + δ¼. In the case of recall, a true positive is an actual anomaly at time step t with a predicted anomaly within the range »t − δ; t + δ¼. globally. For this purpose, we stick to Earle et al. [8] and use the Figure 2 shows the impact of various choices for the temporal energy transient score as the anomaly score (middle row), i.e., we tolerance δ on the measured values for precision and recall. De- set zt = STAt /(LTAt + 1º, where STA is the short-term average of pending on the choice of the threshold and the temporal tolerance, the input sequence over the past 3 days, while LTA is the long-term the reported values for precision and recall vary drastically. The average over the past 14 days. The energy transient score reacts to adoption of temporal tolerance in the evaluation is undoubtedly drastic changes in the level of the time series. valid in many applications. However, the example shows that the use of moderate temporal tolerances may already lead to overstated 1.2 Evaluation measures performance measures that do not necessarily reflect the actual utility of the results. In Section 3, we perform a simulation study to While the anomaly score encodes the feature of interest that the further investigate this issue. anomaly detector should react to, the detection threshold τ controls the precision and recall of the anomaly detector. Let ¹et ºt=1; ::;T be 2.2 Confusion matrices a ground-truth sequence of actual anomalies, with value e = 1 if t The extension of precision and recall to time-tolerant measures via there is an actual anomaly at time step t, and e = 0 if there is no t relaxed notions of true positives is intuitive, but has some subtleties anomaly. In our example, actual anomalies correspond to reported not discussed before. In fact, these two measures are computed earthquakes. We define precision P and recall R as 0 0 from two distinct confusion matrices, where temporal tolerance is Í Í allowed either in the ground-truth time steps or in the predicted t et · I¹zt ≥ τ º t et · I¹zt ≥ τ º P0 = Í and R0 = Í : (1) time steps. The general structure of a confusion matrix is: t I¹zt ≥ τ º t et The function I¹cº evaluates to 1 if and only if the condition c is AA AnA true. The numerator is the number of true positives, while the PA TPFP Í denominator is either the number of predicted anomalies or the Í number of actual anomalies. The relationship between the threshold PnA FN TN and precision and recall for the earthquake detection problem is ÍÍ T visualized in Figure 2. The values for P0 and R0 from Equation 1 correspond to the lines labeled δ = 0 in the plots. The results are not particularly good: we can obtain acceptable recall values at It contains the numbers of observations that fall into the four cat- low thresholds, but the cost is an unacceptably low precision. We egories true positives (TP), false positives (FP), false negatives (FN ) observe that recall is a monotonically decreasing function of the and true negatives (TN ), along with marginal sums.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us