Explainable Time Series Anomaly Detection using Masked Latent Generative Modeling
Daesoo Lee, Sara Malacarne, Erlend Aune
TL;DR
The paper tackles the challenge of accurate time series anomaly detection while demanding high explainability. It introduces TimeVQVAE‑AD, which repurposes TimeVQVAE’s masked generative prior learned in a time–frequency latent space to compute anomaly scores as $a = -\log p_\theta(\text{s}|\text{s}_M)$ over sliding latent windows controlled by $\alpha$, enabling frequency‑band specific diagnostics and counterfactual sampling. The approach combines LF–HF latent space merging with a dimensionality‑preserving encoder to maintain temporal and spectral semantics, and it provides explainable sampling to visualize likely normal realizations of anomalous segments. On the UCR‑TSA archive, TimeVQVAE‑AD outperforms existing methods in top‑1/top‑k accuracy and delivers rich explanations through frequency‑resolved anomaly scores and counterfactual samples, with code and visualizations freely available for transparency and reproducibility.
Abstract
We present a novel time series anomaly detection method that achieves excellent detection accuracy while offering a superior level of explainability. Our proposed method, TimeVQVAE-AD, leverages masked generative modeling adapted from the cutting-edge time series generation method known as TimeVQVAE. The prior model is trained on the discrete latent space of a time-frequency domain. Notably, the dimensional semantics of the time-frequency domain are preserved in the latent space, enabling us to compute anomaly scores across different frequency bands, which provides a better insight into the detected anomalies. Additionally, the generative nature of the prior model allows for sampling likely normal states for detected anomalies, enhancing the explainability of the detected anomalies through counterfactuals. Our experimental evaluation on the UCR Time Series Anomaly archive demonstrates that TimeVQVAE-AD significantly surpasses the existing methods in terms of detection accuracy and explainability. We provide our implementation on GitHub: https://github.com/ML4ITS/TimeVQVAE-AnomalyDetection.
