Manuscript Offprint
arXiv:2611.01661A Hybrid Anomaly Detection Method for Multivariate Time Series
Abstract
Multivariate time series are ubiquitous in monitoring smart systems such as power plants, smart houses, and servers. These systems use multiple sensors to collect the system's status over time. Those sensors represent the status of the whole system as one entity. Anomaly detection in such smart systems is of critical importance to prevent system failure and maintain functionality. But anomaly detection in such multivariate time series data is very challenging since this type of data includes both temporal and spatial information. Capturing both of these pieces of information is important to detect anomalies. In this paper, we propose a hybrid deep learning-based anomaly detection method, which captures both temporal and spatial information. We propose to take advantage of the feature extraction capabilities of 2d convolutional network in a variational autoencoder, alongside a prediction-based deep neural network of 2d convolutional networks and a gated recurrent unit network to capture both spatial and temporal information. Experiments on public data against state-of-the-art show the potential of our method.
Keywords: Anomaly detection, Multivariate Time Series, Convolutional Neural Networks, Variational Autoencoder, Recurrent neural networks
1- Introduction
Complex systems like power plants, modern factories, smart houses, spacecrafts, server machines, robot-assisted systems, engines, etc are monitored via smart meters (sensors). These smart meters generate vast amounts of multivariate time series data, which are complex and difficult to analyse [1]. The operators of such systems need to know whether an abnormal state occurred or not. These abnormal states indicate a fault that can be very harmful, especially for critical systems like power plants and spacecrafts [2]. Previously, such monitoring used to be done by experts who supervise the system. However, the complexity of modern IT systems and the large number of sensors to monitor the system have rendered expert-based supervision useless and call for automated approaches to detect such anomalies [3]. This problem of detecting abnormal states in historical data collected by multiple sensors is called anomaly detection in multivariate time series (MTS). The problem is an active research line [4].
This problem has complex challenges. First, MTS datasets are usually highly imbalanced, i.e., the percentage of anomalies is so low that it makes it difficult to train a model that is not biased toward normal points. Second, in the real application, usually there is no label for the data, which raises the need for unsupervised methods to deal with the problem [5]. The third challenge is the dimensions of the MTS data. In such data, the features correlate with each other and correlate over time. It is very important to consider these relationships to capture the true system status. This relation between each feature and its lagged values (auto-correlation/temporal correlation), and the inter-relation of features over time (spatiotemporal correlation), is an important piece of information and should be captured. Most of the works in the literature fail to capture all types of correlation for MTS anomaly detection explicitly. The other challenge is the stochastic nature of time series data, which further complicates anomaly detection for MTS data.
The high complexity of MTS data and the weakness of traditional methods due to the curse of dimensionality necessitate the need for deep learning-based methods for the problem. Deep-learning-based methods are categorised as prediction-based and reconstruction-based. Hundman et al [2] proposed a prediction-based method that uses Long-Short Term Memory (LSTM). LSTM proved successful in predicting time series data. Their method uses prediction error to detect anomalies. They apply their method to MTS collected by satellite devices. Tariq et al [6] propose to use a convolutional LSTM integrated with probabilistic Principle Component Analysis (PCA) as a prediction-based method.
Ikeda et al [7] developed a variational auto-encoder (VAE) for the problem. They use a multi-layer perceptron (MLP) as the building blocks of the VAE. The encoder uses a multivariate Gaussian with a diagonal covariance. The VAE is trained on normal data, and then they use reconstruction error to detect anomalies. Another line of work based on reconstruction is inspired by Generative Adversarial Networks (GAN). GAN is designed to train generative AI models by adversarial training. It proved successful in image processing to generate realistic images [8]. Li et al [1] propose a GAN-based anomaly detection for MTS data called MAD-GAN. They use LSTM for both the generator and discriminator components of the GAN. The generator builds fake MTS and passes them to the discriminator to detect fake (generated MTS) from real MTS. Although effective, GAN suffers from mode collapse and non-convergence issues [9]. Audibert et al [3] propose Unsupervised Anomaly Detection (USAD) to address these issues in GAN-based methods. They developed an Auto-Encoder (AE) architecture that consists of one encoder component and two decoder components ( and ). In the first stage, the encoder and two decoders are trained to reconstruct the normal data. In the second stage, in an adversarial learning manner, learns to distinguish between real data and reconstructed data by , and is trained to fool at the discrimination task. They use MLP for building blocks, and the latent space of their AE is not stochastic.
Zhang et al [10] propose a Multi-Scale Convolutional Recurrent Encoder-Decoder (MSCRED). It first constructs signature matrices for each time step. Then, a convolutional encoder captures spatial correlation, and an attention-based convolutional LSTM captures temporal correlations. Finally, a convolutional decoder is used to reconstruct the MTS. Su et al [11] propose OmniAnomaly, a VAE-based method that uses a Gated Recurrent Unit (GRU) network for building blocks of the VAE. Their method aims to capture both the temporal and stochastic nature of MTS. They use stochastic variables alongside the planar Normalizing Flows technique to learn the non-Gaussian posterior distribution of the latent space in VAE.
Previous works fail to consider all types of correlation in MTS. In this paper, we propose HEADMTS (Hybrid Ensemble Anomaly Detection Multivariate Time Series), which is a hybrid of prediction-based and reconstruction-based methods. It includes two main components. The main building blocks of these components are 2D-convolutional networks that we believe have the potential to capture correlation between different time series. The first component captures temporal correlation, and the second captures spatio-temporal correlations explicitly. We use a hybrid loss function to train the model. Our contributions are as follows:
- We propose to capture correlations between sensors explicitly using separate components.
- We propose a hybrid anomaly detection method which uses 2d-CNN as the building blocks
- We provide a comparison in terms of all important metrics.
The rest of this paper is organized as follows. In Section 2, we introduce the problem definition and the method. Section 3 includes data description, data analysis, results, and discussion. The results and discussion section includes the performance, ablation study, and the convergence rate of the method. This paper is concluded in Section 4.
2-1- Problem Definition
Let's denote the input with , where is the number of samples over time, and is the number of sensors to read the MTS. Figure 1 shows the architecture of MTS. Let's denote the output for with , where 0 indicates a normal point, and 1 indicates an anomaly. Therefore, the problem of MTSAD becomes learning where is the length of the time window of the input smart meter data. Based on the definition of the anomaly detection problem, we express the MTSAD problem as follows:
where is a threshold that distinguishes between normal and abnormal points.

Figure 1: Matrix of multi-sensor time series data, . Each row is a timestamp sample, and each column represents a sensor reading.
2-2- Proposed Method
We propose a hybrid method that combines temporal and spatiotemporal correlations. This way, our method accounts for all types of correlations in MTS data explicitly. Our method also accounts for the stochasticity of time series using variational inference.
Figure 2 shows the framework of the proposed method called HEADMTS. The first component preprocesses the MTS to make time windows. Then, the windows are fed to the temporal correlation component (TC) and spatiotemporal correlation component (STC), to extract all types of correlation explicitly. The TC component uses 2-dimensional Convolutional Neural Networks (CNN) and Gated Recurrent Unit (GRU) to extract temporal information. The STC component uses 2 dimensional CNN and variational inference to model the distribution of MTS and its stochasticity. The HEADMTS uses a hybrid loss function in the end to detect anomalies. After the training stage, we have a well-trained model on the training data, . This model is used to generate a threshold . The threshold is used to detect anomalies in MTS in the final stage. We will explain in more detail in the next sections.

Figure 2: Architecture of HEADMTS
2-3- Training Phase
2-3-1- TC (Temporal Correlation) Component
In this component, we use two types of neural networks, 2d-CNN and GRU. We deal with multivariate time series. To capture intercorrelation properly, we propose to use 2d-CNN. 2d-CNN building blocks used in our method contain three kinds of layers: 2d convolutional layer, batch normalization layer, and leakyRelu layers. All three layers are wrapped in a time-distributed layer so that the final output can be fed to GRU layers. The 2d convolutional layer maps the input into a feature space containing a correlation of different sensor data, called a feature map, using a sliding filter. In this work, the input of the 2d-CNN block is a time window of the original features. The operation in the convolutional layer is formulated as follows:
where is -th feature map of the layer , is the set of 2d filters, is the output of the convolution operation, is the 2d convolution kernel and is the bias. Each 2d kernel(filter) creates a correlation map of the sliding kernel. Then, a rectified linear activation function is used. In the batch normalization layer, we use the following operation to normalize the output of the 2d layer:
Where is the output of the batch-normalization layer, is the mean of the output of the 2d-CNN layer, is the standard deviation and and are learnable parameters of the layer, which, in the end, shift the mean and standard deviation of the output distribution. The output distribution would have a mean of and a standard deviation of .
The last layer of the 2d-CNN block is the leakyRelu layer. This layer helps to deal with gradient vanishing/exploding problems while keeping the capability of the deep neural network for modelling non-linearity.
Each 2d-CNN block is wrapped in a TimeDistributed layer so that 2d-CNN operations can be applied to all timestamps.
After deriving convoluted features via several layers of the 2d-CNN blocks, the TC components use GRU for extracting temporal correlation from the extracted feature maps. GRU and Long-Short Term Memory (LSTM) are the most used versions of RNN models due to their power in dealing with gradient vanishing/exploding problems, which was a great gap in vanilla RNNs. We use GRU rather than LSTM since it has a smaller number of gates. This means less complexity and is less prone to overfitting issues. The GRU cells contain two types of gates, the update gate z that decides to update the output of the current state via or not, and the reset gate r that decides to ignore the previous hidden state or not, thereby controlling the amount of data that should be remembered from previous timestamps. We express the calculations as follows:
where and are outputs of the update gate, reset gate, activation function, and output gate, respectively. is the sigmoid activation function and is the hyperbolic tangent activation function. We use the mean squared loss as the optimization function, between the prediction and the real value as follows:
2 -3-2- STC(Spatiotemporal Correlation) Component
In this component, we develop an auto-encoder to capture the spatiotemporal correlations of the MTS. Using reconstruction information rather than prediction information of the MTS helps us to better focus on spatial correlation. This component learns the latent distribution of MTS through variational inference and then reconstructs the input. Again, our building block is 2d-CNN for encoding the input to a latent distribution, and then we use 2d-CNNTranspose blocks to reconstruct the input from the learned latent distribution. Using a probabilistic distribution helps to capture the stochasticity of the MTS as well.
The vanilla auto-encoders transform the input into a lower-dimension representation (a latent vector) and then reconstruct the input from this latent representation. The main issue of such an approach is that it is prone to learning the identity function rather than the real representation. The other issue is that it encodes each sample of the data regardless of the relation with other samples, therefore ignoring any underlying distribution. Another important aspect is the relation between different time series, since our data is MTS. To deal with these issues, we use 2d convolutional blocks as the building blocks of the encoder and 2d convolutional transpose blocks as the decoder. This makes the model capable of capturing correlations between sensors. To address the latter issue, we use variational inference to learn the probabilistic distribution of the input via the latent distribution and capture the stochasticity of the time series.
In the STC component, the probabilistic encoder is denoted by and the probabilistic decoder is denoted by via which the reconstruction is done. is the latent variable which represents the latent distribution of the input. We consider a prior distribution for denoted by . This prior distribution serves as a regularization, which will be detailed soon. The relation between these terms is expressed by Bayes theorem as follows:
where is called posterior distribution and is the likelihood. The major issue in the calculation of the above formula is the intractable integral in the denominator. That is why we use variational inference to approximate the integral. The intuition is to consider a set of parameterized families of distributions and look for the best approximation among them. We define and as follows:
where is the mean of the distribution defined by the decoder. Since it is intractable to compute , We approximate it by a Gaussian distribution, which is expressed as follows:
where and are mean and variance of . We consider G and H as the space for and respectively. We use Kullback-Leibler divergence to measure the distance between and . Therefore, we aim to optimize the following expression:
Where is needed to be optimized so that it maximizes the likelihood . Therefore, in the end, we need to optimize the following expression:
We model via decoder and and via encoder networks using 2d-CNN and 2d-CNNTranspose blocks. For both the encoder and decoder, we use a Gaussian distribution. and are the mean and covariance of the encoder and is the mean of the decoder with constant covariance. After the encoding step and approximating , We need to sample from this distribution to derive and reconstruct the input. But z is a random variable, which makes the differentiation and gradient descent impossible, therefore making the backpropagation impossible. To address this issue, we use the reparameterization trick [12] as follows:
Finally, the loss function used for the STC component is expressed as follows:
2 -3-3- Detection Component
This component combines the and errors over validation data to create the threshold . We denote the threshold as follows:
(18) where is a trade-off hyperparameter between and .
HEADMAS uses to do the detection. We have test data denoted as . HEADMTS model calculates the hybrid error for each test data sample as follows:
Then, the detection function, denoted by is carried on as follows:
The HEADMTS is shown in Algorithm 1.
3 - Experiments
3 -1- Experimental Setup
We use Python 3.7.6 in the Spyder 4.0.1 platform. We use Tensorflow 1.14.0 and the Keras library to develop the neural network. The configuration of baseline methods is explained in Table 1.
Algorithm 1 Training and Detection Procedure of HEADMTS
Training Phase
Input MTS data X, batch size M, window size W
Output model parameters and
1: Convert raw MTS into windows , and targets
2: Do:
3: Calculate feature maps for via 2d-convolutional network;//Eq (2) and (3)
4: Do batch-normalization;//Eq (4)
5: Calculate through GRU network with 64 and 32 neuron layers;//Eq (5) to (8)
6: Calculate the , and update ;//Eq (9)
7: While not converged
8: Do:
9: Calculate feature maps for via 4 2d-convolutional network networks with 32, 64, 64, and 64 neurons;//Eq (2), Eq (3)
10: Do batch-normalization;//Eq (4)
11: Calculate to approximate ;
12: Sample z via reparameterization trick, ; ;
13: Calculate via 4 2d-CNNTranspose;//
14: Calculate the , and update
15: While not converged
16: Return and
Detection Phase
Input: test data
Output: Threshold , Labels for all
1: Calculate
// Eq
2: Transform MTS time series into windows , and targets
3: For ; do:
4: Calculate via the TC network;
5: Calculate via the STC network;
6: Calculate hybrid loss ; 7: IF ; 8: " 9: Else: 10: " 11: End for 12: Return Labels for all
Table 1: Configuration of baselines
| Baseline Methods for Comparison | |
|---|---|
| LOF | Number of neighbors:10 |
| IF | Number of estimators:100, contamination:0.01 |
| OCSVM | Kernel:"rbf", gamma:0.6 |
| LSTM-NDT | Number of LTCM layer: 2, Neurons:80, Dropout:0.3, loss:mse, solver=Adam, learning rate (lr):1e-3 |
| MSCRED | Encoder layer sizes={32,64,128,256}, Decoder layer sizes={256,256,128,64}, ConvLSTM Cell:dimension=2,kernel shape=[2,2],forget-bias=1.0; Learning rate:0.0002;threshold:0.005 |
| MAD-GAN | Latent Dimension:15;Number of Variables:78;Learning Rate:0.1; L2 Norm Bound:1e-5;dp sigma:1e-5; dp:False |
| OmniAnomaly | RNNCell:GRU; Hidden Dimension:500;Window length:20;l2 Regulator:0.0001;Search Min:-1;Search Max:1;Level:0.01;NF Layer:20 |
| USAD | Hidden Size:100; Loss:Relu; Window length:20; |
| VAEpro | Weight Decay:1e-3;Dropout:0.2;Activation:Relu;Number of Layers:5 |
We run experiments using baselines, including LOF [13], IF [14], OCSVM [15], LSTM-NDT [2], MSCRED [10], MAD-GAN [1], OmniAnomaly [11], USAD [3], VAEpro [7].
For the MTS dataset, we use three widely used datasets SWAT [1], WADI [1], and SMD [11].
3-2- Evaluation Criteria
To evaluate the performance of methods, we use four widely used metrics. The metrics are defined as follows:
where TP is the true positive, FP is the false positive, and FN is the false negative. Of these three metrics, F1 is the most important one. It finds a balance between precision and recall. As the Precision formula suggests, it penalizes false positives, while the recall penalizes false negatives. In smart meter systems, we believe that a false negative is more costly than a false positive. Therefore, after the f1 measure, recall is more important than precision since it penalizes false negatives.
3-3- Results & Discussion
In this section. We discuss the results of the performance comparison in terms of the mentioned metrics. We also show the convergence rate and run an ablation study as well, to show the effectiveness of each component. Table 2 shows the final configuration of the neural network used for the training stage model.
Table 2: Configuration of neural network models used in HEADMTS.
| Layers | Neurons | Filters | Kernel | Stride | Regularizer | Activation Function | |
|---|---|---|---|---|---|---|---|
| TC Component | 4 | 32 | 32 | (3,3) | 1 | Kernel | LeakyRelu |
| 2D-Convolution | 64 | 64 | Regularizer =L1L2 | ||||
| Blocks | 64 | 64 | BiasRegularizer=L2 | ||||
| GRU 1 | 64 | Dropout=2.0 | Linear | ||||
| GRU 2 | 32 | 0 | |||||
| STC Component | 4 2D-Convolution | 32 | 32 | (3,3) | 1 | Kernel | LeakyRelu |
| Blocks | 64 | 64 | Regularizer =L1L2 | ||||
| 64 | 64 | BiasRegularizer=L2 | |||||
| 4 2D-Convolution | 64 | 64 | (3,3) | 1 | Kernel | LeakyRelu | |
| Transpose | 64 | 64 | Regularizer =L1L2 | ||||
| Blocks | 32 | 32 | BiasRegularizer=L2 |
Table 3: Performance in terms of Accuracy, Precision, Recall, and F1
| Baselines | SWaT | WADI | SMD | Avg F1 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Precision | Recall | F1 | Precision | Recall | F1 | Precision | Recall | F1 | ||
| LOF | 0.3208 | 0.5045 | 0.3926 | 0.4839 | 0.5046 | 0.4921 | 0.4211 | 0.2824 | 0.3422 | 0.4089 |
| IF | 0.4108 | 0.4737 | 0.4111 | 0.4311 | 0.1903 | 0.2108 | 0.4111 | 0.2512 | 0.2624 | 0.2947 |
| OCSVM | 0.3112 | 0.4832 | 0.3802 | 0.4732 | 0.4413 | 0.4645 | 0.4461 | 0.4011 | 0.7322 | 0.5256 |
| LSTM-NDT | 0.5901 | 0.7070 | 0.6433 | 0.4411 | 0.5952 | 0.5067 | 0.7111 | 0.8364 | 0.7687 | 0.6395 |
| MSCRED | 0.4302 | 0.5749 | 0.4921 | 0.5311 | 0.5636 | 0.5469 | 0.7911 | 0.8623 | 0.8252 | 0.6214 |
| MAD-GAN | 0.5601 | 0.5274 | 0.5433 | 0.4811 | 0.3119 | 0.3785 | 0.9014 | 0.8918 | 0.8966 | 0.6061 |
| OmniAnomaly | 0.3605 | 0.9892 | 0.5300 | 0.3111 | 0.5323 | 0.3927 | 0.8891 | 0.9891 | 0.9428 | 0.6218 |
| USAD | 0.6605 | 0.7778 | 0.7144 | 0.4711 | 0.3912 | 0.4275 | 0.8811 | 0.9247 | 0.9024 | 0.6814 |
| VAEpro | 0.6311 | 0.9244 | 0.7501 | 0.7431 | 0.8432 | 0.7900 | 0.7851 | 0.8371 | 0.8103 | 0.7834 |
| HEADMTS | 0.6401 | 0.9994 | 0.7804 | 0.7945 | 0.9921 | 0.8824 | 0.9145 | 0.9483 | 0.9311 | 0.8646 |
Table 3 shows the advantages of our method against baselines. The most important metric we rely on is the Average F1 measure shown in the last column. As the table shows, our method, HEADMTS, outperforms all other baselines by a considerable margin, with F1 of 0.8646. It is due to the ability of our method to consider both temporal and spatiotemporal correlation between features, and using 2d-CNN to capture all types of relations explicitly gives an advantage to HEADMTS. The second-best method is VAEpro. It uses variational inference as well to capture stochasticity, but it only accounts for spatial relations between features. It also uses MLP as the building block of its neural network, which is not as effective as 2d-CNN in both capturing non-linearity and correlation between features. IF, LOF, and OCSVM show the poorest performance. These methods don't capture temporal information. They also suffer from the curse of dimensionality; therefore, they can't model the relationship between features properly.
The most difficult dataset among the three mentioned MTS datasets is WADI. It has 124 sensor time series that have complicated relationships. The result in the table shows that HEADMTS outperforms all other baselines to a good extent. It shows the advantage of HEADMTS in capturing correlations. The F1 of our method for WADI is 0.8824. It is again followed by VAEpro. The worst performance is shown by IF. The existence of complex relations between sensor time series makes it difficult for IF to show good performance. MAD-GAN also shows poor performance. It is an adversarial-based model that uses LSTM as the building block. LSTM is good at capturing temporal information, but might not be as good as 2d-CNN for capturing spatiotemporal correlations. The other reason for its poor performance can be using dimensionality reduction techniques before feeding the MTS to the model, which causes the loss of valuable information associated with the relation between features. The other reason can be mode collapse, which is an issue associated with adversarial-based models.
In terms of recall for WADI, HEADMTS outperforms with a recall of 0.9921. It shows that HEADMTS has low false negatives, which is a very good point for monitoring sensitive systems like energy systems. The second-best recall for WADI is shown by VAEPro. The worst performances belong to IF and MAD-GAN. In terms of precision, HEADMTS outputs a precision of 0.7945 followed by VAEPro with 0.7431. The worst performance is shown by Omnianomaly with 0.3111. It is a reconstruction-based method that uses GRU as the building blocks. It only considers spatial relationships for which it uses GRU, a neural network designed for capturing temporal information.
The second-most difficult dataset is SWAT with 78 sensor time series. Again, here we observe that HEADMTS outperforms other baselines with 0.7804. It shows that HEADMTS has superiority when there are complicated relationships between sensor time series. The second-best is again VAEPro with the competitive result of 0.7501. VAEPro is like our method. The worst results are shown by OCSVM and LOF, with 0.3802 and 0.3926, respectively.
In terms of recall, HEADMTS is superior with 0.9994, which is closely followed by Omnianomaly with 0.9892. While Omnianomaly wasn't good in very high-dimensional datasets like WADI, as the number of sensors starts to decrease, Omnianomaly shows its power using adversarial generative ideas. In terms of precision, USAD is superior with a precision of 0.6605, which is closely followed by HEADMTS with a precision of 0.6401. USAD shows a relatively good F1 measure of 0.7144. It is an auto-encoder-based model that uses reconstruction error to model the training data. It combines the ideas of auto-encoders with adversarial learning. They didn't use variational inference. Instead, the encoding and decoding process of USAD is more deterministic than the stochastic approach taken by HEADMTS. USAD also doesn't focus on capturing temporal correlations as well. The worst precision is shown by OCSVM and LOF, with 0.3112 and 0.3201, respectively.
The last dataset is SMD, which has 39 sensor time series. It is less complex than the other two datasets, due to a simpler relation between features. In this dataset, Omnianomaly is superior by a very slight margin to HEADMTS, with 0.9428 over 0.9311. As mentioned above, Omnianomaly gains an edge when the correlation between features becomes less complex. It shows adversarial learning can be more effective when the relation between features is simpler. Otherwise, taking all kinds of correlation is crucial as HEADMTS does. LOF and IF again are among the worst performance results, with 0.3422 and 0.2624. However, other baselines show better performance than the other two datasets. It shows the superiority of considering non-linearity by deep learning methods over LOF and IF. Also, the ability of deep learning to deal with the curse of dimensionality is better shown in this dataset.
In terms of recall, Omnianomaly is ahead of our method by a better margin, with 0.9891 over 0.9493. Still, HEADMTS is the second-best and is competitive with Omnianomaly. LOF and IF show the worst recall with 0.2824 and 0.2512. In terms of precision, HEADMTS is superior, with 0.9145, followed by MAD-GAN with 0.9014. MAD-GAN is another adversarial-based model. It shows that adversarial-based models are successful in detecting anomalies for SMD datasets. But still, the performance of HEADMTS is competitive in SMD. The worst performance in terms of precision is shown by LOF and IF, with 0.4211 and 0.4111, respectively.
In the end, the consideration of temporal and spatiotemporal correlations with TC and STC components, through 2d-CNN explicitly combined with GRU and variational inference ideas, shows considerable advantage for detecting anomalies in complex time series datasets.
Figure 3 shows the fast convergence of HEADMTS components after almost 10 epochs. The left curve belongs to the TC component, and the right curve belongs to the STC component. A proper number of layers, the right choice of activation functions like leakyRelu, and the layer-level regularisations are the reasons behind this fast convergence. Choosing 2d-CNN for MTS data is another reason why the components converge that fast.


Figure 3: Convergence rate of TC and STC components
In the next study, we run an ablation study to assess the effectiveness of each component. We create two variants of HEADMTS, namely tcHEADMTS and stcHEADMTS. The former only uses the TC component and its associated loss to detect anomalies, and the latter uses only the STC component. We run the study for all three datasets. The results are shown in Table 4.
Again, in terms of the most important metric, which is the average F1, we observe that HEADMTS is superior with an average F1 of 0.8646. Still, we observe that both components show considerable performance, with 0.8422 for tcHEADMTS and 0.8320 for stcHEADMTS. These results show that tcHEADMTS and the associated TC component are more effective than the STC component. This is mainly due to the existence of 2d-CNN in the TC component. Using 2d-CNN in combination with GRU helps to capture both types of correlations, temporal and spatial. While STC only focuses on spatial correlations. Still, their combination yields better results.
For the WADI dataset, which is the most difficult dataset, again HEADMTS is superior, followed by stcHEADMTS in the second place with 0.8621. This is mainly due to the presence of complicated spatial correlations in this dataset and the better capability of the STC component in capturing spatial correlations. In terms of recall, again HEADMTS has the best performance with 0.9921. The second place again belongs to stcHEADMTS with 0.9612. In terms of precision, again HEADMTS outperforms with a precision of 0.7945 followed by tcHEADMTS with 0.7925.
The second dataset in terms of complexity of spatial correlations is SWAT. In this dataset, HEADMTS outperforms in terms of F1 with 0.7804. This time, second place belongs to tcHEADMTS. This is due to less spatial complexity and higher complexity in terms of temporal correlations. tcHEADMTS is better at capturing temporal correlations. In terms of recall, HEADMTS is superior with 0.7338, and stcHEADMTS is ahead of tcHEADMTS with a slight margin. In terms of precision, tcHEADMTS shows the best performance with 0.8449, with HEADMTS owning the second place with 0.8332. It shows that tcHEADMTS has fewer false positives but more false negatives.
The last dataset, SMD has more complicated temporal correlations than spatial correlations. Again, in terms of F1, HEADMTS is the best one with 0.9311, and tcHEADMTS is the second-best with 0.9102. It shows that in the presence of temporal correlations, the TC component is more effective than the STC component. In terms of recall, HEADMTS is superior with 0.9483, and tcHEADMTS is second with 0.9194. The same ranking is observed for precision, with HEADMTS the best and tcHEADMTS the second. We observed that the combination of two components yields better results, and the TC component is more effective than the STC component.
Table 4: ablation study
| Variants | SWaT | WADI | SMD | Avg F1 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Precision | Recall | F1 | Precision | Recall | F1 | Precision | Recall | F1 | ||
| tcHEADMTS | 0.8449 | 0.7108 | 0.7721 | 0.7925 | 0.9033 | 0.8443 | 0.9011 | 0.9194 | 0.9102 | 0.8422 |
| stcHEADMTS | 0.8311 | 0.7157 | 0.7691 | 0.7815 | 0.9612 | 0.8621 | 0.8814 | 0.8488 | 0.8648 | 0.8320 |
| HEADMTS | 0.8332 | 0.7338 | 0.7804 | 0.7945 | 0.9921 | 0.8824 | 0.9145 | 0.9483 | 0.9311 | 0.8646 |
4 - Conclusion
In this paper, we studied the problem of anomaly detection in multivariate time series (MTS). This is a demanded and popular problem in modern systems that are monitored by smart meters. Multiple sensors together collect information on system status and help maintain the health of such systems. But this problem raises several challenges, like the complexity of relation between different time series associated with different sensors. Also, the lack of labelled data makes this problem an unsupervised learning problem, which is another challenge. To detect anomalies in such systems, a method needs to capture all types of correlation, including temporal and spatiotemporal information. We proposed a hybrid method that captures both these correlations explicitly. Our method consisted of two components, TC and STC. The former uses 2D-CNN and GRU to model the temporal information, and the latter uses a variational autoencoder, whose building block is 2D-CNN, which is powerful at capturing spatio-temporal correlations. We conducted several experiments against state-of-the-art, and our method, called HEADMTS, outperformed state-of-the-art in terms of F1 measure. We showed the fast convergence rate of HEADMTS. We also conducted an ablation study to show the effectiveness of each component. The empirical experiments endorse our ideas that capturing both correlations explicitly and 2D-CNN are effective at detecting anomalies in MTS.
References
-
Li, D., et al. MAD-GAN: Multivariate anomaly detection for time series data with generative adversarial networks. in International conference on artificial neural networks. 2019. Springer.
-
Hundman, K., et al. Detecting spacecraft anomalies using lstms and nonparametric dynamic thresholding. in Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining. 2018.
-
Audibert, J., et al. Usad: Unsupervised anomaly detection on multivariate time series. in Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery & data mining. 2020.
-
Chalapathy, R. and S. Chawla, Deep learning for anomaly detection: A survey. arXiv preprint arXiv:1901.03407, 2019.
-
Shen, L., Z. Li, and J. Kwok, Timeseries anomaly detection using temporal hierarchical one-class network. Advances in Neural Information Processing Systems, 2020. 33: p. 13016-13026.
-
Tariq, S., et al. Detecting anomalies in space using multivariate convolutional LSTM with mixtures of probabilistic PCA. in Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 2019.
-
Ikeda, Y., et al., Estimation of dimensions contributing to detected anomalies with variational autoencoders. arXiv preprint arXiv:1811.04576, 2018.
-
Goodfellow, I., et al., Generative adversarial nets. Advances in neural information processing systems, 2014. 27.
-
Arjovsky, M. and L. Bottou, Towards principled methods for training generative adversarial networks. arXiv preprint arXiv:1701.04862, 2017.
-
Zhang, C., et al. A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data. in Proceedings of the AAAI conference on artificial intelligence. 2019.
-
Su, Y., et al. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. in Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 2019.
-
Kingma, D.P., T. Salimans, and M. Welling, Variational dropout and the local reparameterization trick. Advances in neural information processing systems, 2015. 28.
-
Johannesen, N.J., M.L. Kolhe, and M. Goodwin, Vertical Approach Anomaly Detection Using Local Outlier Factor, in Power Systems Cybersecurity: Methods, Concepts, and Best Practices. 2023, Springer. p. 297-310.
-
Li, T., et al., Ensemble offshore wind turbine power curve modelling—an integration of isolation forest, fast radial basis function neural network, and metaheuristic algorithm. Energy, 2022. 239: p. 122340.
-
Ji, Y. and H. Lee, Event-based anomaly detection using a one-class svm for a hybrid electric vehicle. IEEE Transactions on Vehicular Technology, 2022. 71(6): p. 6032-6043.