Abstract:Time series anomaly detection is a key technology relied upon in applications such as network service, data security, and system monitoring. In order to address the limitations of effectiveness, rationality and stability in anomaly detection results caused by the fuzziness of time series context, complexity of data distribution, and the uncertainty of anomaly detection models in practical scenarios, this paper proposes a new anomaly detection method (AdcGAN), based on contextual generative adversarial network. Firstly, AdcGAN extracts conditional context for generating time series data by processing historical data. Secondly, AdcGAN constructs a context generative adversarial network following conditional generative adversarial network strategy to achieve conditional distribution prediction of the data at any moment. Meanwhile, AdcGAN uses Dropout to approximate model uncertainty and replacing point estimates with probability distribution as prediction result. Then, anomalies are measured based on the differences in observations (represented by the expected deviations) and the uncertainty of the model (represented by prediction variances). Finally, an automatic method for setting anomaly thresholds based on statistical information of the time series data is proposed to reduce the number of manually adjusted parameters. Our experimental results on 47 real-time series data of the NAB dataset compared with baselines show that, compared to similar benchmark algorithms, the proposed AdcGAN method can effectively detect anomalies in time series data. It outperforms other benchmark methods in most evaluation metrics and achieves better stability.