Time series data anomaly detection method combining graph learning and double attention mechanism
Through the method of joint graph learning and dual attention mechanism, the spatio-temporal features of multi-dimensional time series data are extracted and a directed weighted graph is constructed, which solves the problems of ignoring spatio-temporal dependencies and insufficient anomaly evaluation in multi-dimensional time series data anomaly detection in the existing technology. More accurate anomaly detection is achieved.
Patent Information
- Application Number
- CN202410937150.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing multi-dimensional time series data anomaly detection methods have shortcomings in capturing short-term abnormal events, modeling complex relationships between multi-dimensional data, and assessing anomaly severity. In particular, they ignore spatiotemporal dependencies when processing multi-dimensional time series data.
Using the method of joint graph learning and dual attention mechanism, spatiotemporal features are extracted through graph attention network and attention-enhanced gated recurrent unit, and the anomaly score is calculated by combining temporal convolutional network and long short-term memory network-variational autoencoder. Construct a directed weighted graph to quantify dependencies between features and dynamically adjust anomaly thresholds.
It improves the feature representation capability and accuracy of anomaly detection for multi-dimensional time series data anomaly detection, can more accurately identify the abnormal status of time series data, and optimizes the anomaly scoring mechanism.
Smart Images

Figure CN118779804A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of anomaly detection, and in particular relates to a time series data anomaly detection method combining graph learning and dual attention mechanism. Background Art
[0002] In today's information age, with the rapid development of the Internet of Things and industrial automation, multi-dimensional time series data has become a key asset, playing a vital role in many industries such as energy management, intelligent manufacturing, network security, and transportation systems. These data record in detail various parameters and status information from single sensors to complex systems in the form of time series. For example, on a highly automated production line, various sensors monitor key indicators such as temperature, pressure, and vibration of the equipment in real time. These time series data not only reflect the operating status of a single device, but also can reveal the interaction between devices and the health status of the overall production process through advanced data analysis technology. Therefore, an effective anomaly detection mechanism is particularly important, which can prevent failures, ensure production safety, and reduce unnecessary economic losses.
[0003] The development of anomaly detection technology has experienced a transition from traditional statistical methods to modern machine learning and deep learning technologies. Early anomaly detection relied on simple threshold settings and basic statistical tests, which may be sufficient when dealing with simple or low-dimensional data, but with the increase in data dimensions and the complexity of the environment, these methods gradually revealed their inability to handle complex data structures and dynamic changes. In recent years, with the enhancement of computing power and the development of algorithms, deep learning technology has become a cutting-edge method for anomaly detection in multi-dimensional time series data. By constructing complex network structures such as convolutional neural networks (CNN), recurrent neural networks (RNN), and long short-term memory networks (LSTM), deep learning models can capture high-level features and time dependencies in the data, significantly improving the accuracy and efficiency of anomaly detection. Although deep learning models have achieved remarkable results in anomaly detection, current methods still face multiple challenges in practical applications:
[0004] 1. Insufficient sensitivity to transient abnormal events. Existing deep learning methods often perform poorly in capturing sudden transient abnormal events, which are often of great significance in practical applications.
[0005] 2. Insufficient modeling of complex relationships between multidimensional data. Although deep learning can handle time dependencies in a single data stream, it still has significant difficulties in integrating multidimensional data sources, especially in understanding and modeling the complex spatial relationships between these data.
[0006] 3. The model’s anomaly scoring mechanism still has room for improvement in performance. Although current anomaly detection methods can identify anomalies, how to accurately assess and quantify the severity of anomalies remains a major challenge, especially in a continuously changing data environment. Summary of the invention
[0007] Most existing multidimensional time series data anomaly detection methods do not fully mine the data information of multidimensional data, ignore the potential complex spatiotemporal dependencies of the data, and pay attention to the importance of the time period of data anomalies. In response to the above problems, the present invention provides a time series data anomaly detection method that combines graph learning and dual attention mechanism.
[0008] A time series data anomaly detection method combining graph learning and dual attention mechanism of the present invention comprises the following steps:
[0009] Step 1: Preprocess multidimensional time series data.
[0010] Step 2: Determine the graph structure and assign weights for multi-dimensional time series data.
[0011] Step 3: Infer the causal direction of edges in the graph structure.
[0012] Step 4: Determine the initial attention weight of the Graph Attention Network (GAT).
[0013] Step 5: Perform spatial feature extraction and process the spatial dependencies between nodes of the graph through GAT.
[0014] Step 6: Perform temporal feature extraction and use the attention-enhanced gated recurrent unit ATT-GRU (Attention-Gated Recurrent Unit) to capture the temporal dependencies of the time series.
[0015] Step 7: Send the multi-dimensional time series data with spliced spatiotemporal features into the prediction module composed of the temporal convolutional network TCN (Temporal Convolutional Network) to obtain the prediction output.
[0016] Step 8: Send the multi-dimensional time series data of spliced spatiotemporal features into the reconstruction module composed of the long short-term memory network combined with the variational autoencoder LSTM-VAE (Long Short-Term Memory-Variational Autoencoder) to obtain the reconstructed output.
[0017] Step 9: Calculate the anomaly score by combining the predicted output and the reconstructed output, and determine the abnormal status of the data point based on the anomaly threshold.
[0018] Furthermore, in step 1, the minimum-maximum normalization method is used to normalize the time series data of each dimension before the training process. The normalization formula is as follows:
[0019]
[0020] Among them, min(x train,m ) and max(x train,m ) represent the minimum and maximum values of the m-th dimension feature in the training set.
[0021] Furthermore, step 2 is specifically as follows:
[0022] Step 2.1: Considering that the graph structure and weights between dimensions of multidimensional time series data are not defined in advance, they are determined based on the Spearman correlation coefficient and constraints. The Spearman correlation coefficient measures the intrinsic connection between the feature dimensions in multidimensional time series data. The formula is as follows:
[0023]
[0024] Among them, d t Represents the difference in ranking between two different dimensions of the time series at a specific time point t; the ranking is determined based on the values of the data points in each dimension, and the one with a larger value gets a higher ranking; n represents the total number of time points in the time series.
[0025] Based on the correlation coefficient, determine the data relationship matrix between multidimensional time series data corresponding to sensors i and j It is expressed as:
[0026]
[0027] Step 2.2: Add constraints and determine the sensor association matrix It is expressed as:
[0028]
[0029] Step 2.3: According to the sensor data relationship matrix B1 and the sensor association relationship matrix B2 obtained in step 2.1 and step 2.2, the final sensor relationship matrix B3 is obtained by weighting method, that is:
[0030]
[0031] ω1+ω2=1 (6)
[0032] Based on the sensor relationship matrix B3, the weights of the edges in the directed weighted graph G are represented, and the weight matrix W is obtained, which is expressed as:
[0033]
[0034] That is, every element w in W ij Directly corresponds to the corresponding element in B3 in represents the final weighted relationship between sensor i and sensor j; finally, the correlation threshold ξ is determined, and the adjacency matrix B of the sensor graph structure is calculated as follows: ij ) k×k To express:
[0035]
[0036] Furthermore, in step 3, based on the k×k undirected weighted graph between sensors obtained in step 2, the Granger causality relationship is used to determine the direction of the graph structure edge, and a complete directed weighted graph G is obtained; it is expressed as:
[0037]
[0038] Among them, GC ij Indicates whether there is a Granger causal relationship between sensor i and j; when GC ij = 1, indicating that the time series of sensor i affects the time series of sensor j within a certain period of time; in the graph structure, it means that from the vertex v representing sensor i i To vertex v representing sensor j j There is a directed edge; if GC ij = 0, it means that sensors i and j have no obvious order of influence. Therefore, the edge O of the directed weighted graph G = (o ij ) k×k It is expressed as:
[0039]
[0040] Furthermore, step 4 is specifically as follows:
[0041] Step 4.1: Compared with ordinary graph neural networks, the graph attention network introduces an attention mechanism. The attention mechanism assigns different attention weights to neighbor nodes based on the dependencies between nodes in the network; therefore, a reasonable weight initialization strategy will improve the efficiency and stability of network training; when the directed weighted graph structure representation G between sensor data has been obtained, the attention weights in the graph attention network are first initialized using the node degree centrality of the graph G.
[0042] The node degree centrality reflects the number of direct connections between a node and other nodes in the graph. For node u in the graph, the degree centrality C D(u) It is expressed as:
[0043]
[0044] Where deg(u) represents the degree of node u, and N is the total number of nodes in the graph; therefore, when initializing the attention weights of the graph attention network, C D(u) Adjust the initial attention weight of node u to its neighbor v
[0045]
[0046] Where N (u) is the set of adjacent nodes of node u.
[0047] Step 4.2: Eigenvector centrality measures the influence of a node, taking into account the quality of connections between nodes. It is obtained by calculating the eigenvector corresponding to the maximum eigenvalue of the adjacency matrix. For the adjacency matrix B of the graph, the calculation of eigenvector centrality is expressed as:
[0048] Bx=λx (13)
[0049] Where x represents the eigenvector of the adjacency matrix B, and λ is the corresponding maximum eigenvalue. After obtaining the maximum eigenvalue λ and its corresponding eigenvector v, the eigenvector centrality of node u is x u That is, the component corresponding to the node u in the eigenvector corresponding to the maximum eigenvalue, indicating the relative importance of the node in the graph; when initializing the attention weight of the graph attention network, based on x u Adjust the initial attention weight of node u to its neighbor v
[0050]
[0051] Step 4.3: Based on the two initial attention weights obtained in step 4.1 and step 4.2, a weighted method is used to obtain the final initial attention weight of node u to its neighbor v:
[0052]
[0053] ω3+ω4=1 (16)
[0054] Furthermore, in step 5, the graph attention network is used to learn complex dependencies from the directed weighted graph G to extract spatial features. Specifically, the graph attention network evaluates the importance of the relationship between each node and its neighboring nodes and adjusts the weight of the connection accordingly. i ∈R s Represents the feature vector of each node in the network, where s represents the sliding window size; calculates the attention score a of node u and node v uv :
[0055] e uv =LeakyRELU(a T [Wh u ||Wh v ]) (17)
[0056]
[0057] Among them, || represents the vector concatenation operation, W∈R F′ Represents the parameters related to the feature transformation weight matrix, α∈R 2F′ Represents the weight parameter, LeakyRELU is a nonlinear activation function, and the weight coefficient e from the neighbor node u to v is obtained by calculation uv ; For the weight coefficient e uv Perform the normalization operation to get the attention score a between nodes uv uv , where exp is an exponential function with the natural constant e as the base.
[0058] After weighted summation, we get the feature vector h′ of node u. u , expressed as:
[0059]
[0060] Among them, σ represents the activation function sigmoid.
[0061] Furthermore, in step 6, the extraction of temporal features is implemented based on the attention-enhanced gated recurrent unit ATT-GRU. In GRU, two gating mechanisms, the reset gate and the update gate, jointly regulate the flow of information. The reset gate determines how much past information is forgotten, and the update gate controls how much information is passed from the old state to the new state. t With update gate z t The calculation formula is as follows:
[0062] r t =σ(W r ·[ht-1 ,x t ]) (20)
[0063] z t =σ(W z ·[h t-1 ,x t ]) (twenty one)
[0064] Where W r With W z is the learning parameter, σ is the sigmoid function, h t-1 is the hidden state at the previous moment, x t is the current input; the candidate hidden state h′ is calculated by combining the previous state adjusted by the reset gate with the current input, so that the GRU model selectively abandons the previous memory and adopts new information. The calculation formula is:
[0065] h′=tanh(W h, ·[r t *h t-1 ,x t ]) (twenty two)
[0066] Where W′ h is the weight parameter, tanh function is the activation function; the final hidden state h t The calculation is obtained by updating the gate control, so that the GRU model decides how many old states and candidate states to retain. The calculation formula is:
[0067] h t =(1-z t )*h t-1 +z t *h′ (23)
[0068] In ATT-GRU, for each time step input x t , after the linear transformation layer, the feature vector z is generated t :
[0069] z t =W z x t +b z (twenty four)
[0070] Where W z With b z is the learning parameter; then, the GRU unit is used according to the current input z t The hidden state h at the previous moment t-1 Update the current hidden state h t :
[0071] h t =GRU(zt ,h t-1 ) (25)
[0072] Determine the importance of each time step by measuring the current hidden state h t And the transformed input features z t The correlation between them is used to calculate the attention score e t :
[0073] e t =tanh(W a ,h t ) T z t (26)
[0074] And use the softmax function to normalize the attention scores of all time steps to obtain the weight a of each time step t :
[0075]
[0076] According to the obtained weight a t , calculate the weighted average and generate the final attention output vector A:
[0077]
[0078] The weight of each time step is determined by its relative importance, which is automatically learned through the attention mechanism; therefore, the attention output vector A combines the most informative representation of the time series and reflects the most critical features of the time series for the anomaly detection task.
[0079] Furthermore, in step 7, the prediction module uses a time series convolutional network (TCN) to predict the future state of multi-dimensional time series data. TCN increases the receptive field by dilating convolution without increasing the number of parameters, and solves the network degradation problem by introducing residual connections, thereby effectively capturing long-distance data dependencies. Dilated convolution increases the dilation factor layer by layer, allowing the network layer to cover a longer input history. In TCN, the configuration of each dilated convolution layer is expressed as:
[0080]
[0081] Where x(t) represents the network input at time point t, y(t) represents the convolution output, and ω i is the weight of the convolution kernel, K is the size of the convolution kernel, and d is the expansion factor; the residual connection helps maintain the information flow in the deep network and alleviates the gradient disappearance problem during training, ensuring that even in the deep network, the input information can be effectively transmitted to the output layer, expressed as:
[0082] Output=RELU(y(t)+Input) (30)
[0083] Among them, Input is the input of the residual connection, RELU is a nonlinear activation function; the prediction module uses the mean square error MSE as the loss function to quantify the deviation between the predicted value and the actual time series data point, expressed as:
[0084]
[0085] Where M is the number of samples, y i is the actual value of the sample, y i ′ is the predicted value of the model; the module adjusts parameters through an iterative training process to minimize the prediction loss; the iterative process includes four steps: forward propagation, loss calculation, back propagation and parameter update; after the training is completed, the prediction module receives the input data, outputs the predicted value and compares it with the actual value, calculates the predicted output and participates in the calculation of the anomaly score.
[0086] Furthermore, in step 8, the reconstruction module combines the variational autoencoder VAE and the long short-term memory network LSTM to capture the complex dependencies of time series data and reconstruct them effectively; VAE provides a probabilistic framework, and the model reconstructs data by learning the potential representation of the input data, while LSTM is responsible for processing the time dependency of the input data.
[0087] The encoder part uses an LSTM network to process the input time series x to capture temporal dependencies and outputs the mean μ and logarithmic variance log(σ) describing the data latent space. 2 ), expressed as:
[0088] μ,log (σ 2 )=LSTM encoder (x) (32)
[0089] Among them, LSTM encoder is the encoder's LSTM network, whose output is converted into parameters of the latent space through a fully connected layer; applying the reparameterization technique, we get the latent vector z:
[0090]
[0091] Among them, ∈ is a random variable drawn from a standard normal distribution; the decoder part also uses an LSTM network, which receives the latent vector z and attempts to reconstruct the original input x:
[0092] x′=LSTM decoder (z) (34)
[0093] Among them, LSTM decoderis the LSTM network of the decoder, which aims to reconstruct the input data from the latent vector; the reconstruction module combines the reconstruction loss and KL divergence of the variational autoencoder to optimize the overall performance of the model:
[0094] Loss recons =MES(x,x′)+β·KL Divergence(μ,σ) (35)
[0095] Among them, MES represents reconstruction loss, KL Divergence is used to measure the difference between the potential representation and the prior distribution, and β is a parameter that adjusts the importance of the two. The module is also iteratively trained through four steps: forward propagation, loss calculation, back propagation, and parameter update. After the training is completed, the reconstruction module reconstructs the input x and compares it with the reconstructed output x′ to obtain the reconstruction error, and calculates the KL divergence, which participates in the calculation of the anomaly score.
[0096] Furthermore, in step 9, the abnormal state is determined by comparing the anomaly score with the set anomaly threshold; the calculation of the anomaly score combines the outputs of the prediction module and the reconstruction module to comprehensively quantify the degree of anomaly of each time series data point; the anomaly score is mainly determined by three key metrics: prediction error, reconstruction error and KL divergence; the prediction error MES pred The reconstruction error MES is obtained by calculating the mean square error between the model prediction value and the actual observation value. recons The KL divergence is obtained by calculating the mean square error between the input data and the model reconstruction data. It is used to measure the deviation between the actual probability distribution of the potential representation and its prior distribution, expressed as:
[0097]
[0098] Among them, μ i and are estimates of the mean and variance of the latent vector of the i-th data point, respectively; therefore, the anomaly score calculation formula is expressed as:
[0099] Anomaly Score=
[0100] δ×Norm(MSE pred )+β×Norm(MSE recons )+γ×Norm(KL Divergence)(37)
[0101] Where Norm is the normalization function, δ, β, γ are weighting factors for adjusting relative importance; after confirming the anomaly score, the POT method is used to determine the threshold of the anomaly score.
[0102] The beneficial technical effects of the present invention are:
[0103] 1. The present invention performs graph structure representation learning of multidimensional time series data, quantifies the complex dependencies between features through the Spearman correlation coefficient and Granger causality, and constructs a directed weighted graph that can reflect the interactive relationship between the features of multidimensional time series data.
[0104] 2. The present invention considers the spatiotemporal characteristics of multi-dimensional time series data, constructs a dual-channel attention feature extraction network based on GAT and ATT-GRU, realizes dual-dimensional deep feature extraction, and splices the spatiotemporal features with multi-dimensional time series data to enhance the feature representation ability of the anomaly detection method.
[0105] 3. The present invention optimizes the anomaly detection link, combines the prediction module composed of TCN and the reconstruction module composed of LSTM-VAE, jointly calculates the anomaly score, and comprehensively evaluates the degree of anomaly of the data point. The anomaly threshold is dynamically adjusted based on the super-threshold model to accurately identify the abnormal state of time series data. BRIEF DESCRIPTION OF THE DRAWINGS
[0106] Figure 1 The figure is a flow chart of the overall structure of the model network of the present invention.
[0107] Figure 2 Schematic diagram of sliding window partitioning.
[0108] Figure 3 This is the GAT attention score calculation process.
[0109] Figure 4 This is the TCN convolution structure diagram.
[0110] Figure 5 This is the VAE model structure diagram. DETAILED DESCRIPTION
[0111] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0112] The present invention provides a time series data anomaly detection method combining graph learning and dual attention mechanism, the model network principle is as follows Figure 1 As shown in the figure, by learning the representation of the graph structure of multi-dimensional time series data, a directed weighted graph of the interactive relationship of multi-dimensional time series data features is constructed to quantify the complex dependencies between features. A dual-channel attention feature extraction network is constructed based on GAT and ATT-GRU, and the attention mechanism is used to focus on the abnormal time period of the data to achieve deep feature extraction in two dimensions. Finally, the prediction module built based on TCN and the reconstruction module built based on LSTM-VAE calculate the anomaly score through a joint scoring mechanism, and dynamically adjust the anomaly threshold through the super-threshold model to accurately identify the abnormal state of time series data.
[0113] Example:
[0114] The public datasets MSL and SMAP are used as experimental datasets. The MSL dataset is derived from the large-scale scientific data collected by the Curiosity rover during its mission on the surface of Mars, including the recorded information of various sensors and actuators on the rover. The SMAP dataset includes soil samples and remote detection data collected from the rover. These two datasets contain observation data of 55 and 25 dimensions respectively. Each dataset is divided into a training set and a test set, and the abnormal data in the test set has been clearly marked.
[0115] The specific steps include:
[0116] Step 1: Preprocess multidimensional time series data.
[0117] Considering that the data value ranges between different dimensions of multidimensional time series data may vary greatly, the minimum-maximum normalization method is used to normalize the time series data of each dimension before the training process to reduce the impact of numerical differences between different feature dimensions on model performance and accelerate the convergence of the model training process. The normalization formula is as follows:
[0118]
[0119] Among them, min(x train,m ) and max(x train,m ) represent the minimum and maximum values of the m-th dimension feature in the training set.
[0120] Step 2: Determine the graph structure and assign weights for multi-dimensional time series data.
[0121] Step 2.1: Considering that the graph structure and weights between dimensions of multidimensional time series data are not defined in advance, they are determined based on the Spearman correlation coefficient and constraints. The Spearman correlation coefficient measures the intrinsic connection between the feature dimensions in multidimensional time series data. The formula is as follows:
[0122]
[0123] Among them, d t Represents the difference in ranking between two different dimensions of the time series at a specific time point t; the ranking is determined based on the values of the data points in each dimension, and the one with a larger value gets a higher ranking; n represents the total number of time points in the time series.
[0124] Based on the correlation coefficient, determine the data relationship matrix between multidimensional time series data corresponding to sensors i and j It is expressed as:
[0125]
[0126] Step 2.2: In actual application scenarios, the relationship between sensors may be affected by prior correlation factors such as mechanical transmission relationship and functional association between monitoring components. These widely existing and recognized prior correlation factors provide key structural information input for constructing directed weighted graphs. Therefore, constraints are added to determine the sensor correlation matrix. It is expressed as:
[0127]
[0128] Step 2.3: According to the sensor data relationship matrix B1 and the sensor association relationship matrix B2 obtained in step 2.1 and step 2.2, the final sensor relationship matrix B3 is obtained by weighting method, that is:
[0129]
[0130] ω1+ω2=1 (6)
[0131] Based on the sensor relationship matrix B3, the weights of the edges in the directed weighted graph G are represented, and the weight matrix W is obtained, which is expressed as:
[0132]
[0133] That is, every element w in W ij Directly corresponds to the corresponding element in B3 in represents the final weighted relationship between sensor i and sensor j; finally, the correlation threshold ξ is determined, and the adjacency matrix B of the sensor graph structure is calculated as follows: ij ) k×k To express:
[0134]
[0135] Step 3: Infer the causal direction of edges in the graph structure.
[0136] Based on the k×k undirected weighted graph between sensors obtained in step 2, Granger Causality (GC) is used to determine the direction of the graph structure edge to obtain a complete directed weighted graph G. Granger causality is widely used to measure the mutual influence between time series. In this step, it is used to test whether the change of the detection data of one sensor can explain the change of another sensor within a certain period of time, so as to determine the causal relationship between sensors and further infer the causal direction of the graph structure edge. It can be expressed as:
[0137]
[0138] Among them, GC ijIndicates whether there is a Granger causal relationship between sensor i and j; when GC ij = 1, indicating that the time series of sensor i affects the time series of sensor j within a certain period of time; in the graph structure, it means that from the vertex v representing sensor i i To vertex v representing sensor j j There is a directed edge; if GC ij = 0, it means that sensors i and j have no obvious order of influence. Therefore, the edge O of the directed weighted graph G = (o ij ) k×k It is expressed as:
[0139]
[0140] Step 4: Determine the initial attention weight of the Graph Attention Network (GAT).
[0141] Step 4.1: Compared with ordinary graph neural networks, the graph attention network introduces an attention mechanism. The attention mechanism assigns different attention weights to neighbor nodes based on the dependencies between nodes in the network; therefore, a reasonable weight initialization strategy will improve the efficiency and stability of network training; when the directed weighted graph structure representation G between sensor data has been obtained, the attention weights in the graph attention network are first initialized using the node degree centrality of the graph G.
[0142] The node degree centrality reflects the number of direct connections between a node and other nodes in the graph. For node u in the graph, the degree centrality C D(u) It is expressed as:
[0143]
[0144] Where deg(u) represents the degree of node u, and N is the total number of nodes in the graph; therefore, when initializing the attention weights of the graph attention network, C D(u) Adjust the initial attention weight of node u to its neighbor v
[0145]
[0146] Where N (u) is the set of adjacent nodes of node u.
[0147] Step 4.2: Eigenvector centrality measures the influence of a node, taking into account the quality of connections between nodes. It is obtained by calculating the eigenvector corresponding to the maximum eigenvalue of the adjacency matrix. For the adjacency matrix B of the graph, the calculation of eigenvector centrality is expressed as:
[0148] Bx=λx (13)
[0149] Where x represents the eigenvector of the adjacency matrix B, and λ is the corresponding maximum eigenvalue. After obtaining the maximum eigenvalue λ and its corresponding eigenvector v, the eigenvector centrality of node u is x u That is, the component corresponding to the node u in the eigenvector corresponding to the maximum eigenvalue, indicating the relative importance of the node in the graph; when initializing the attention weight of the graph attention network, based on x u Adjust the initial attention weight of node u to its neighbor v
[0150]
[0151] Step 4.3: Based on the two initial attention weights obtained in step 4.1 and step 4.2, a weighted method is used to obtain the final initial attention weight of node u to its neighbor v:
[0152]
[0153] ω3+ω4=1 (16)
[0154] Through the above method, the initial attention weights of the graph neural network are defined.
[0155] Step 5: Perform spatial feature extraction and process the spatial dependencies between nodes of the graph through GAT.
[0156] The graph attention network is used to learn complex dependencies from the directed weighted graph G to extract spatial features. Specifically, the graph attention network evaluates the importance of the relationship between each node and its neighboring nodes and adjusts the weight of the connection accordingly. i ∈R s Represents the feature vector of each node in the network, where s represents the size of the sliding window. The principle of sliding window division is as follows Figure 2 As shown; calculate the attention score a of node u and node v uv :GAT attention score calculation process is as follows Figure 3 As shown. The formula is:
[0157] e uv =LeakyRELU(a T [Wh u ||Wh v ]) (17)
[0158]
[0159] Among them, || represents the vector concatenation operation, W∈R F′ Represents the parameters related to the feature transformation weight matrix, α∈R 2F′Represents the weight parameter, LeakyRELU is a nonlinear activation function, and the weight coefficient e from the neighbor node u to v is obtained by calculation uv ; For the weight coefficient e uv Perform the normalization operation to get the attention score a between nodes uv uv , where exp is an exponential function with the natural constant e as the base.
[0160] After weighted summation, we get the feature vector h′ of node u. u , expressed as:
[0161]
[0162] Among them, σ represents the activation function sigmoid. Through the above steps, the graph attention network extracts the comprehensive features of each node and its context from the directed weighted graph G. These features reflect not only the attributes of a single node, but also its spatial relationship and role in the entire network, which provides rich feature representation for subsequent anomaly detection tasks.
[0163] Step 6: Perform temporal feature extraction and use the attention-enhanced gated recurrent unit ATT-GRU (Attention-Gated Recurrent Unit) to capture the temporal dependencies of the time series.
[0164] The extraction of temporal features is based on the attention-enhanced gated recurrent unit ATT-GRU. In GRU, two gating mechanisms, the reset gate and the update gate, jointly regulate the flow of information. The reset gate determines how much past information is forgotten, and the update gate controls how much information is passed from the old state to the new state. t With update gate z t The calculation formula is as follows:
[0165] r t =σ(W r ·[h t-1 ,x t ]) (20)
[0166] z t =σ(W z ·[h t-1 ,x t ]) (twenty one)
[0167] Where W r With W z is the learning parameter, σ is the sigmoid function, h t-1 is the hidden state at the previous moment, x tis the current input; the candidate hidden state h′ is calculated by combining the previous state adjusted by the reset gate with the current input, so that the GRU model selectively abandons the previous memory and adopts new information. The calculation formula is:
[0168] h′=tanh(W h′ ·[r t *h t-1 ,x t ]) (twenty two)
[0169] Where W′ h is the weight parameter, tanh function is the activation function; the final hidden state h t The calculation is obtained by updating the gate control, so that the GRU model decides how many old states and candidate states to retain. The calculation formula is:
[0170] h t =(1-z t )*h t-1 +z t *h′ (23)
[0171] In ATT-GRU, for each time step input x t , after the linear transformation layer, the feature vector z is generated t :
[0172] z t =W z x t +b z (twenty four)
[0173] Where W z With b z is the learning parameter; then, the GRU unit is used according to the current input z t The hidden state h at the previous moment t-1 Update the current hidden state h t :
[0174] h t =GRU(z t ,h t-1 ) (25)
[0175] Determine the importance of each time step by measuring the current hidden state h t And the transformed input features z t The correlation between them is used to calculate the attention score e t :
[0176] e t =tanh(W a ,h t ) T z t(26)
[0177] And use the softmax function to normalize the attention scores of all time steps to obtain the weight a of each time step t :
[0178]
[0179] According to the obtained weight a t , calculate the weighted average and generate the final attention output vector A:
[0180]
[0181] The weight of each time step is determined by its relative importance, which is automatically learned through the attention mechanism; therefore, the attention output vector A combines the most informative representation of the time series and reflects the most critical features of the time series for the anomaly detection task.
[0182] Step 7: Send the multi-dimensional time series data with spatiotemporal features into the prediction module composed of the temporal convolutional network TCN (Temporal Convolutional Network) to obtain the prediction output. The TCN convolution structure is as follows: Figure 4 shown.
[0183] The prediction module uses the time series convolutional network (TCN) to predict the future state of multi-dimensional time series data. TCN increases the receptive field by dilating convolution without increasing the number of parameters, and solves the network degradation problem by introducing residual connections, thereby effectively capturing long-distance data dependencies. Dilated convolution increases the dilation factor layer by layer, allowing the network layer to cover a longer input history. In TCN, the configuration of each dilated convolution layer is expressed as:
[0184]
[0185] Where x(t) represents the network input at time point t, y(t) represents the convolution output, and ω i is the weight of the convolution kernel, K is the size of the convolution kernel, and d is the expansion factor; the residual connection helps maintain the information flow in the deep network and alleviates the gradient disappearance problem during training, ensuring that even in the deep network, the input information can be effectively transmitted to the output layer, expressed as:
[0186] Output=RELU(y(t)+Input) (30)
[0187] Among them, Input is the input of the residual connection, RELU is a nonlinear activation function; the prediction module uses the mean square error MSE as the loss function to quantify the deviation between the predicted value and the actual time series data point, expressed as:
[0188]
[0189] Where M is the number of samples, y i is the actual value of the sample, y i ′ is the predicted value of the model; the module adjusts parameters through an iterative training process to minimize the prediction loss; the iterative process includes four steps: forward propagation, loss calculation, back propagation and parameter update; after the training is completed, the prediction module receives the input data, outputs the predicted value and compares it with the actual value, calculates the predicted output and participates in the calculation of the anomaly score.
[0190] Step 8: Send the multi-dimensional time series data with spliced spatiotemporal features into the reconstruction module composed of the long short-term memory network combined with the variational autoencoder LSTM-VAE (Long Short-Term Memory-Variational Autoencoder) to obtain the reconstructed output. The VAE model structure is as follows: Figure 5 shown.
[0191] The reconstruction module combines the variational autoencoder VAE and the long short-term memory network LSTM to capture the complex dependencies of time series data and reconstruct them effectively; VAE provides a probabilistic framework, and the model reconstructs data by learning the potential representation of the input data, while LSTM is responsible for processing the temporal dependencies of the input data.
[0192] The encoder part uses an LSTM network to process the input time series x to capture temporal dependencies and outputs the mean μ and logarithmic variance log(σ) describing the data latent space. 2 ), expressed as:
[0193] μ,log (σ 2 )=LSTM encoder (x) (32)
[0194] Among them, LSTM encoder is the encoder's LSTM network, whose output is converted into parameters of the latent space through a fully connected layer; applying the reparameterization technique, we get the latent vector z:
[0195]
[0196] Among them, ∈ is a random variable drawn from a standard normal distribution; the decoder part also uses an LSTM network, which receives the latent vector z and attempts to reconstruct the original input x:
[0197] x′=LSTM decoder (z) (34)
[0198] Among them, LSTM decoderis the LSTM network of the decoder, which aims to reconstruct the input data from the latent vector; the reconstruction module combines the reconstruction loss and KL divergence of the variational autoencoder to optimize the overall performance of the model:
[0199] Loss recons =MES(x,x′)+β·KL Divergence(μ,σ) (35)
[0200] Among them, MES represents reconstruction loss, KL Divergence is used to measure the difference between the potential representation and the prior distribution, and β is a parameter that adjusts the importance of the two. The module is also iteratively trained through four steps: forward propagation, loss calculation, back propagation, and parameter update. After the training is completed, the reconstruction module reconstructs the input x and compares it with the reconstructed output x′ to obtain the reconstruction error, and calculates the KL divergence, which participates in the calculation of the anomaly score.
[0201] Step 9: Calculate the anomaly score by combining the predicted output and the reconstructed output, and determine the abnormal status of the data point based on the anomaly threshold.
[0202] The abnormal state is determined by comparing the anomaly score with the set anomaly threshold; the calculation of the anomaly score combines the outputs of the prediction module and the reconstruction module to comprehensively quantify the degree of anomaly of each time series data point; the anomaly score is mainly determined by three key metrics: prediction error, reconstruction error and KL divergence; the prediction error MES pred The reconstruction error MES is obtained by calculating the mean square error between the model prediction value and the actual observation value. recons The KL divergence is obtained by calculating the mean square error between the input data and the model reconstruction data. It is used to measure the deviation between the actual probability distribution of the potential representation and its prior distribution, expressed as:
[0203]
[0204] Among them, μ i and are estimates of the mean and variance of the latent vector of the i-th data point, respectively; therefore, the anomaly score calculation formula is expressed as:
[0205] Anomaly Score=
[0206] δ×Norm(MSE pred )+β×Norm(MSE recons )+γ×Norm(KL Divergence)(37)
[0207] Where Norm is a normalization function, δ, β, and γ are weighting factors for adjusting relative importance; after confirming the anomaly score, the POT method is used to determine the threshold of the anomaly score. The POT method is an extreme value theory method, which is often used to identify extreme events that exceed a certain threshold. The POT method determines a dynamic threshold by statistically analyzing the anomaly scores in historical data. This threshold is the benchmark for judging whether a data point is abnormal. If the anomaly score of a data point exceeds the threshold determined by the POT model, the data point is marked as anomaly. This comprehensive use of multiple metrics ensures the accuracy of anomaly detection.
[0208] Experimental verification:
[0209] In order to verify the effectiveness of the model, this paper selects 6 mainstream anomaly detection methods for comparison.
[0210] LSTM-VAE: Published at the IEEE ICASSP International Conference in 2020, this model uses LSTM as the encoder of the variational autoencoder. It combines LSTM with VAE to apply it to anomaly detection in time series data by learning the distribution of normal data and using reconstruction probability for anomaly scoring.
[0211] DAGMM: Published at the International Conference on Learning Representations (ICLR) in 2018, it combines deep autoencoders with Gaussian mixture models to perform anomaly detection through low-dimensional representation learning and reconstruction errors.
[0212] MAD-GAN: Published at the International Conference on Artificial Neural Networks in 2019, it uses LSTM-RNN optimized by adversarial training as a discriminator, generates data points through a generative adversarial network, and judges anomalies based on the generated error.
[0213] OmniAnomaly: Published at the ACM SIGKDD International Conference in 2019, it uses a random recurrent neural network to model time series and explain detected anomalies by reconstructing probabilities.
[0214] MTAD-GAT: Published at the IEEE ICDM International Conference in 2020, it uses a dual-graph attention network to combine the prediction and reconstruction results of time series for anomaly judgment, and effectively uses the graph attention mechanism to explore time series dependencies.
[0215] MST-GAT: Published in the journal Information Fusion in 2023, it effectively captures the spatiotemporal relationship of multimodal time series by combining the multimodal graph attention network with the temporal convolutional network, improving the accuracy and efficiency of anomaly detection.
[0216] The experiment uses the Adam optimizer for optimization training, and the learning rate is set to 0.0001. The batch size of the entire network training is 256, and the total number of training rounds is 100. Considering the impact of the sliding window length on the model anomaly detection results, different values are selected for experiments on the MSL dataset and the sliding window length is set to 32. The dropout strategy is used to avoid overfitting, and the dropout layer dropout rate is 0.2. The dataset embedding dimension is 128, and the GRU hidden unit size is 128. The prediction module TCN is configured with 2 layers and the convolution kernel size is 3. In the reconstruction module LSTM-VAE, for the MSL dataset, the input dimension is 165, the hidden layer dimension is 128, and the potential layer dimension is 55; for the SMAP dataset, the input dimension is 75, the hidden layer dimension is 128, and the potential layer dimension is 25. All datasets in the experiment use the original partitioning method to obtain the training set and test set.
[0217] The performance of the model is evaluated using precision, recall and F1 score as evaluation indicators to comprehensively evaluate the model performance.
[0218] The performance comparison results of different models on the dataset are shown in Table 1.
[0219] Table 1 Model performance comparison results
[0220]
[0221]
[0222] The iDualATT-GraphNet model proposed in the present invention outperforms the other six baseline models on both MSL and SMAP datasets. Especially in terms of processing time series, the model effectively improves the overall performance of the model by introducing ATT-GRU and GAT networks to optimize spatiotemporal features respectively. Compared with MST-GAT, the best performing baseline model, iDualATT-GraphNet improved the F1 index on the two datasets by 4.52% and 6.28% respectively. In addition, the model further improves the precision and recall by deeply mining the associations between modalities through a multimodal attention network. These results not only demonstrate the superiority of the iDualATT-GraphNet model in multivariate time series anomaly detection, but also show its powerful ability in processing complex data relationships.
[0223] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described in the present invention. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the above specific implementation methods. Therefore, any modification or equivalent replacement of the present invention; and all technical solutions and improvements thereof that do not depart from the spirit and scope of the invention are included in the scope of the claims of the present invention.
Claims
1. A time series data anomaly detection method based on joint graph learning and dual attention mechanism, It is characterized in that The following steps are involved: Step 1: Preprocess multidimensional time series data; Step 2: Determine the graph structure and assign weights for multi-dimensional time series data; Step 3: Infer the causal direction of edges in the graph structure; Step 4: Determine the initial attention weight of the graph attention network GAT; Step 5: Perform spatial feature extraction and process the spatial dependencies between nodes in the graph through GAT; Step 6: Perform temporal feature extraction, using the attention-enhanced gated recurrent unit ATT-GRU to capture the temporal dependencies of the time series; Step 7: Send the multi-dimensional time series data with spliced spatiotemporal features into the prediction module composed of the temporal convolutional network TCN to obtain the prediction output; Step 8: Send the multi-dimensional time series data of spliced spatiotemporal features into the reconstruction module composed of the long short-term memory network combined with the variational autoencoder LSTM-VAE to obtain the reconstructed output; Step 9: Calculate the anomaly score by combining the predicted output and the reconstructed output, and determine the abnormal status of the data point based on the anomaly threshold.
2. According to claim 1, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 1, the minimum-maximum normalization method is used to normalize the time series data of each dimension before the training process. The normalization formula is as follows: Among them, min(x train,m ) and max(x train,m ) represent the minimum and maximum values of the m-th dimension feature in the training set.
3. According to claim 1, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that The step 2 is specifically as follows: Step 2.1: Considering that the graph structure and weights between dimensions of multidimensional time series data are not defined in advance, they are determined based on the Spearman correlation coefficient and constraints. The Spearman correlation coefficient measures the intrinsic connection between the feature dimensions in multidimensional time series data. The formula is as follows: Among them, d t Represents the difference in rank between two different dimensions of a time series at a specific time point t; the rank is determined based on the values of the data points in each dimension, and the one with a larger value gets a higher rank; n represents the total number of time points in the time series; Based on the correlation coefficient, determine the data relationship matrix between multidimensional time series data corresponding to sensors i and j It is expressed as: Step 2.2: Add constraints and determine the sensor association matrix It is expressed as: Step 2.3: The sensor data relationship matrix B obtained from steps 2.1 and 2.2 1 Sensor association matrix B 2 , the final sensor relationship matrix B is obtained by weighted method 3 ,Right now: oh 1 +oh 2 =1 (6) Based on the sensor relationship matrix B 3 Represents the weight of the edge in the directed weighted graph G, and obtains the weight matrix W, which is expressed as: That is, every element w in W ij Directly corresponds to B 3 The corresponding elements in in represents the final weighted relationship between sensor i and sensor j; finally, the correlation threshold ξ is determined, and the adjacency matrix B of the sensor graph structure is calculated as follows: ij ) k×k To express:
4. According to claim 3, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 3, based on the k×k undirected weighted graph between sensors obtained in step 2, the direction of the graph structure edge is determined by using Granger causality to obtain a complete directed weighted graph G; it is expressed as: Among them, GC ij Indicates whether there is a Granger causal relationship between sensor i and j; when GC ij = 1, indicating that the time series of sensor i affects the time series of sensor j within a certain period of time; in the graph structure, it means that from the vertex v representing sensor i i To vertex v representing sensor j j There is a directed edge; if GC ij = 0, it means that sensors i and j have no obvious sequential influence; therefore, the edge O of the directed weighted graph G = (o ij ) k×k It is expressed as:
5. According to claim 4, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that The step 4 is specifically as follows: Step 4.1: Compared with ordinary graph neural networks, the graph attention network introduces an attention mechanism. The attention mechanism assigns different attention weights to neighbor nodes based on the dependency relationship between nodes in the network. Therefore, a reasonable weight initialization strategy will improve the efficiency and stability of network training. When the directed weighted graph structure representation G between sensor data has been obtained, the attention weights in the graph attention network are first initialized using the node degree centrality of the graph G. The node degree centrality reflects the number of direct connections between a node and other nodes in the graph. For node u in the graph, the degree centrality C D(u) It is expressed as: Where deg(u) represents the degree of node u, and N is the total number of nodes in the graph; therefore, when initializing the attention weights of the graph attention network, C D(u) Adjust the initial attention weight of node u to its neighbor v Where N (u) is the set of adjacent nodes of node u; Step 4.2: Eigenvector centrality measures the influence of a node, taking into account the quality of connections between nodes. It is obtained by calculating the eigenvector corresponding to the maximum eigenvalue of the adjacency matrix. For the adjacency matrix B of the graph, the calculation of eigenvector centrality is expressed as: Bx=λx (13) Where x represents the eigenvector of the adjacency matrix B, and λ is the corresponding maximum eigenvalue. After obtaining the maximum eigenvalue λ and its corresponding eigenvector v, the eigenvector centrality of node u is x u That is, the component corresponding to the node u in the eigenvector corresponding to the maximum eigenvalue, indicating the relative importance of the node in the graph; when initializing the attention weight of the graph attention network, based on x u Adjust the initial attention weight of node u to its neighbor v Step 4.3: Based on the two initial attention weights obtained in step 4.1 and step 4.2, a weighted method is used to obtain the final initial attention weight of node u to its neighbor v: oh 3 +oh 4 = 1 (16).
6. According to claim 5, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 5, the graph attention network is used to learn complex dependencies from the directed weighted graph G to extract spatial features. Specifically, the graph attention network evaluates the importance of the relationship between each node and its neighboring nodes and adjusts the weight of the connection accordingly. i ∈R s Represents the feature vector of each node in the network, where s represents the sliding window size; calculates the attention score a of node u and node v uv : e uv =LeakyRELU(a T [Wh u ||Wh v ]) (17) Among them, || represents the vector concatenation operation, W∈R F′ Represents the parameters related to the feature transformation weight matrix, α∈R 2F′ Represents the weight parameter, LeakyRELU is a nonlinear activation function, and the weight coefficient e from the neighbor node u to v is obtained by calculation uv ; For the weight coefficient e uv Perform the normalization operation to get the attention score a between nodes uv uv , where exp is an exponential function with the natural constant e as the base; After weighted summation, we get the feature vector h′ of node u. u , expressed as: Among them, σ represents the activation function sigmoid.
7. According to claim 6, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 6, the extraction of temporal features is implemented based on the attention-enhanced gated recurrent unit ATT-GRU. In GRU, two gating mechanisms, the reset gate and the update gate, jointly regulate the flow of information. The reset gate determines how much past information is forgotten, and the update gate controls how much information is passed from the old state to the new state. t With update gate z t The calculation formula is as follows: r t =σ(W r ·[h t-1 ,x t ]) (20) z t =σ(W z ·[h t-1 ,x t ]) (21) Where W r With W z is the learning parameter, σ is the sigmoid function, h t-1 is the hidden state at the previous moment, x t is the current input; the candidate hidden state h′ is calculated by combining the previous state adjusted by the reset gate with the current input, so that the GRU model selectively abandons the previous memory and adopts new information. The calculation formula is: h′=tanh(W h′ ·[r*h t-1 ,x t ]) (22) Where W′ h is the weight parameter, tanh function is the activation function; the final hidden state h t The calculation is obtained by updating the gate control, so that the GRU model decides how many old states and candidate states to retain. The calculation formula is: h t =(1-z t )*h t-1 +z t *h′ (23) In ATT-GRU, for each time step input x t , after the linear transformation layer, the feature vector z is generated t : z t =W z x t +b z (24) Where W z With b z is the learning parameter; then, the GRU unit is used according to the current input z t The hidden state h at the previous moment t-1 Update the current hidden state h t : h t =GRU(z t ,h t-1 ) (25) Determine the importance of each time step by measuring the current hidden state h t And the transformed input features z t The correlation between them is used to calculate the attention score e t : e t =tanh(W a ,h t ) T z t (26) And use the softmax function to normalize the attention scores of all time steps to obtain the weight a of each time step t : According to the obtained weight a t , calculate the weighted average and generate the final attention output vector A: The weight of each time step is determined by its relative importance, which is automatically learned through the attention mechanism; therefore, the attention output vector A combines the most informative representation of the time series and reflects the most critical features of the time series for the anomaly detection task.
8. According to claim 7, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 7, the prediction module uses a time series convolutional network (TCN) to predict the future state of multi-dimensional time series data. TCN increases the receptive field by dilating convolution without increasing the number of parameters, and solves the network degradation problem by introducing residual connections, thereby effectively capturing long-distance data dependencies. Dilated convolution increases the dilation factor layer by layer, allowing the network layer to cover a longer input history. In TCN, the configuration of each dilated convolution layer is expressed as: Where x(t) represents the network input at time point t, y(t) represents the convolution output, and ω i is the weight of the convolution kernel, K is the size of the convolution kernel, and d is the expansion factor; the residual connection helps maintain the information flow in the deep network and alleviates the gradient disappearance problem during training, ensuring that even in the deep network, the input information can be effectively transmitted to the output layer, expressed as: Output=RELU(y(t)+Input) (30) Among them, Input is the input of the residual connection, RELU is a nonlinear activation function; the prediction module uses the mean square error MSE as the loss function to quantify the deviation between the predicted value and the actual time series data point, expressed as: Where M is the number of samples, y i is the actual value of the sample, y i ′ is the predicted value of the model; the module adjusts parameters through an iterative training process to minimize the prediction loss; the iterative process includes four steps: forward propagation, loss calculation, back propagation and parameter update; after the training is completed, the prediction module receives the input data, outputs the predicted value and compares it with the actual value, calculates the predicted output and participates in the calculation of the anomaly score.
9. According to claim 8, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 8, the reconstruction module combines the variational autoencoder VAE and the long short-term memory network LSTM to capture the complex dependencies of time series data and reconstruct them effectively; VAE provides a probabilistic framework, and the model reconstructs data by learning the potential representation of the input data, while LSTM is responsible for processing the time dependency of the input data; The encoder part uses an LSTM network to process the input time series x to capture temporal dependencies and outputs the mean μ and logarithmic variance log(σ) describing the data latent space. 2 ), expressed as: u,log(σ 2 )=LSTM encoder (x) (32) Among them, LSTM encoder is the encoder's LSTM network, whose output is converted into parameters of the latent space through a fully connected layer; applying the reparameterization technique, we get the latent vector z: Among them, ∈ is a random variable drawn from a standard normal distribution; the decoder part also uses an LSTM network, which receives the latent vector z and attempts to reconstruct the original input x: x′=LSTM decoder (z) (34) Among them, LSTM decoder is the LSTM network of the decoder, which aims to reconstruct the input data from the latent vector; the reconstruction module combines the reconstruction loss and KL divergence of the variational autoencoder to optimize the overall performance of the model: Loss recons =MES(x,x′)+β·KL Divergence(μ,σ) (35) Among them, MES represents reconstruction loss, KL Divergence is used to measure the difference between the potential representation and the prior distribution, and β is a parameter that adjusts the importance of the two. The module is also iteratively trained through four steps: forward propagation, loss calculation, back propagation, and parameter update. After the training is completed, the reconstruction module reconstructs the input x and compares it with the reconstructed output x′ to obtain the reconstruction error, and calculates the KL divergence, which participates in the calculation of the anomaly score.
10. According to claim 9, a method for detecting anomalies in time series data by combining graph learning and dual attention mechanism, It is characterized in that In step 9, the abnormal state is determined by comparing the anomaly score with the set anomaly threshold; the calculation of the anomaly score combines the outputs of the prediction module and the reconstruction module to comprehensively quantify the degree of anomaly of each time series data point; the anomaly score is mainly determined by three key metrics: prediction error, reconstruction error and KL divergence; the prediction error MES pred The reconstruction error MES is obtained by calculating the mean square error between the model prediction value and the actual observation value. recons The KL divergence is obtained by calculating the mean square error between the input data and the model reconstruction data. It is used to measure the deviation between the actual probability distribution of the potential representation and its prior distribution, expressed as: Among them, μ i and are estimates of the mean and variance of the latent vector of the i-th data point, respectively; therefore, the anomaly score calculation formula is expressed as: Anomaly Score=δ×Norm(MSE pred )+β×Norm(MSE recons )+γ×Norm(KL Divergence) (37) Where Norm is the normalization function, δ, β, γ are weighting factors for adjusting relative importance; after confirming the anomaly score, the POT method is used to determine the threshold of the anomaly score.
Citation Information
Cited By
High-pressure water pump real-time data analysis method based on edge calculation
CN119244504A
Time series data anomaly detection method and system based on flattening attention mechanism
CN119336821A
Time series data anomaly detection method and system based on flattened attention mechanism
CN119336821B
Power Internet of Things anomaly detection method and system based on hypergraph fusion
CN119337326A
Time sequence data modeling method for body-equipped agent based on frequency domain learning
CN119357642A
