Detecting Anomalous Event Sequences with Temporal Point Processes

Oleksandr Shchur, Ali Caner Türkmen, Tim Januschowski, Jan Gasthaus, Stephan Günnemann

Abstract

Automatically detecting anomalies in event data can provide substantial value in domains such as healthcare, DevOps, and information security. In this paper, we frame the problem of detecting anomalous continuous-time event sequences as out-of-distribution (OoD) detection for temporal point processes (TPPs). First, we show how this problem can be approached using goodness-of-fit (GoF) tests. We then demonstrate the limitations of popular GoF statistics for TPPs and propose a new test that addresses these shortcomings. The proposed method can be combined with various TPP models, such as neural TPPs, and is easy to implement. In our experiments, we show that the proposed statistic excels at both traditional GoF testing, as well as at detecting anomalies in simulated and real-world data.

Introduction

Continuous-time event sequences—such as server logs, financial transactions, or physiological signals—are ubiquitous in modern data analysis. Detecting "weird" or anomalous patterns in these sequences is critical for system monitoring and security. Shchur et al. (NeurIPS 2021) address this challenge by framing anomaly detection as an out-of-distribution (OoD) detection problem for Temporal Point Processes (TPPs).

Goodness-of-Fit and the "N" Blind Spot

A common approach to unsupervised anomaly detection is using Goodness-of-Fit (GoF) tests. The goal is to determine if a given sequence $X$ is likely to have been generated by a reference model $H_0$. This is typically achieved by calculating a test statistic $s(X)$ and its corresponding p-value, which represents the probability of observing a value at least as extreme as $s(X)$ under the null hypothesis.

Illustration of p-value calculation for a test statistic.

However, traditional GoF tests like the Kolmogorov-Smirnov (KS) test suffer from a significant limitation in the context of TPPs: they are often "count-invariant." Because they are designed to check if events are distributed uniformly over an interval, they may fail to detect anomalies characterized by a shift in the number of events ($N$). For instance, if a server's log frequency drops significantly but the remaining events are still uniformly distributed, a KS test might incorrectly classify the sequence as normal. This "N blind spot" makes standard tests unreliable for detecting volume-based anomalies.

The Sum-of-Squared-Spacings (3S) Statistic

To overcome this, the authors propose the Sum-of-Squared-Spacings (3S) statistic. The method involves three primary steps:

  1. Model Fitting: Train a TPP model (e.g., a neural TPP) on "normal" data to learn the underlying patterns.
  2. Time Rescaling: Transform the irregular event sequence into a Standard Poisson Process (SPP) using the model's compensator function. If the data is normal, the transformed events should look like a process with a constant rate of 1.
  3. Statistic Calculation: Compute the 3S statistic: $$\psi(Z) = \frac{1}{V} \sum_{i=1}^{N+1} (v_i - v_{i-1})^2$$ where $v_i$ are the transformed arrival times and $V$ is the total duration.

By normalizing with the total duration $V$ instead of the event count $N$, the 3S statistic becomes highly sensitive to $N$. Large gaps between events lead to squared terms that significantly increase the statistic's value, signaling an anomaly.

Comparison of 3S and KS statistics sensitivity to event count N.

Experimental Evaluation

The authors evaluated 3S across synthetic benchmarks, simulated DevOps data, and real-world datasets like LOGS (microservices) and STEAD (seismic data).

  • Consistency: 3S proved to be a robust "all-rounder," performing well across various synthetic scenarios (clustering, stopping processes) where other statistics failed.
  • DevOps & Real-World Performance: On the LOGS dataset, 3S achieved near-perfect detection for packet corruption and delays (95.5%–99.6% ROC AUC), significantly outperforming standard log-likelihood methods which struggled with corruption.
  • Typicality vs. Likelihood: Unlike likelihood-based methods, 3S measures "typicality." It can identify sequences that are "too perfect" or "too sparse" relative to the training distribution, whereas high likelihood doesn't always guarantee a sequence is normal.

Conclusion

The 3S statistic provides a simple yet powerful tool for anomaly detection in TPPs. By addressing the count-invariance of traditional GoF tests, it offers superior sensitivity to both timing and volume irregularities. While the current method assumes I.I.D. training sequences, future work may adapt 3S for real-time streaming data and sequences with long-term seasonal trends.

Summary updated

BibTeX
@inproceedings{shchur2021detecting,
  author = {Oleksandr Shchur and Ali Caner Türkmen and Tim Januschowski and Jan Gasthaus and Stephan Günnemann},
  title = {{Detecting Anomalous Event Sequences with Temporal Point Processes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=MTMyxzrIKsM},
}

Loading related content...

Figure