GraphSubDetector: Time Series Subsequence Anomaly Detection via Density-Aware Adaptive Graph Neural Network

Weiqi Chen, Zhiqiang Zhou, Qingsong Wen, Liang SunarXiv 2024

Abstract

Time series subsequence anomaly detection is a critical task across various domains, from health monitoring to AIOps. It remains challenging due to the need to learn complex temporal dynamics, the diversity of anomalous patterns, and the difficulty of determining appropriate subsequence lengths. We present GraphSubDetector, a novel approach that adaptively learns subsequence lengths through a multi-scale selection mechanism and utilizes a density-aware adaptive graph neural network (DAGNN). By performing message passing between subsequences, the model generates robust representations that effectively distinguish subtle anomalies from normal variance. Experimental results on multiple benchmarks demonstrate that GraphSubDetector achieves superior performance compared to state-of-the-art algorithms.

Introduction

Traditional time series anomaly detection often focuses on point-wise outliers—single observations that deviate from the norm. However, real-world anomalies frequently manifest as subsequences: patterns that may appear normal in isolation but are anomalous when viewed in context. Detecting these requires addressing three primary hurdles: capturing temporal dependencies, identifying unknown anomaly lengths, and filtering out inherent noise in normal data.

Figure 2: Subsequence anomalies often require specific temporal contexts to be identified. An anomaly might appear normal in a short window but becomes evident within a weekly context.

As illustrated above, a window that is too short may fail to capture the "big picture" necessary to identify a deviation, while a window that is too long might dilute the anomaly within normal data. GraphSubDetector addresses this by automating the selection of the optimal subsequence length.

Methodology

GraphSubDetector integrates multi-scale feature encoding with a graph-based representation learning framework to isolate anomalies.

Figure 3: The GraphSubDetector architecture, showing the pipeline from time series splitting to multi-scale encoding, graph construction, and final anomaly detection.

Multi-Scale Feature Encoder & Length Selection

Rather than requiring a fixed window length, the model employs a Temporal Convolutional Network (TCN) to generate representations across multiple scales ($2^0, 2^1, \dots, 2^P$). A learnable length selection mechanism assigns weights to these scales, effectively "voting" on the subsequence length that best characterizes the underlying patterns.

Density-Aware Adaptive GNN (DAGNN)

The framework treats subsequences as nodes in a graph, initially constructed using a $k$-Nearest Neighbor ($k$-NN) approach based on similarity. The core innovation is the Density-Aware Adaptive GNN, which performs message passing to reduce the variance of normal data. By adaptively learning an adjacency matrix that incorporates local density, the model ensures that normal patterns (located in high-density regions) are smoothed and clustered together in the latent space, while low-density anomalies remain isolated and easier to detect.

Training via Anomaly Injection

To overcome the scarcity of labeled data, the model is trained using self-supervised anomaly injection. Normal series are transformed using six specific operations—including warping, noise injection, and flips—to teach the model to distinguish between expected variance and true anomalies.

Experimental Results

GraphSubDetector was evaluated against eight diverse datasets, including UCR-Aug, NASA engine data (SED), and ECG heartbeat records.

  • Accuracy: On the UCR-Aug benchmark, GraphSubDetector achieved a Recall@1 of 0.755, outperforming Matrix Profile (0.709) and NCAD (0.722).
  • Robustness: In ECG monitoring, it reached an AUC of 0.923, significantly higher than classical methods like IForest (0.843).
  • Efficiency: The use of a sparse $k$-NN prior allows the model to scale linearly. It processed a 34.3k length time series in approximately 23 seconds, nearly 3x faster than NCAD.

Conclusion

GraphSubDetector provides a robust solution for subsequence anomaly detection by combining adaptive length selection with density-aware graph learning. By treating subsequences as nodes in a graph, the model effectively leverages collective information to suppress noise and highlight complex anomalous patterns. Future work will explore extending this adaptive logic to handle cross-channel dependencies in high-dimensional multivariate data.

Summary updated

BibTeX
@misc{chen2024graphsubdetector,
  author = {Weiqi Chen and Zhiqiang Zhou and Qingsong Wen and Liang Sun},
  title = {{GraphSubDetector: Time Series Subsequence Anomaly Detection via Density-Aware Adaptive Graph Neural Network}},
  year = {2024},
  eprint = {2411.17218},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.17218},
}
Figure