Network anomaly detection method based on thermonuclear diffusion diagram variation transformer

The network anomaly detection method based on the thermonuclear diffusion graph mutation Transformer solves the problem that traditional methods cannot handle complex time series data, achieves accurate anomaly detection of industrial sensor data, and improves the accuracy and reliability of detection.

CN118713871APending Publication Date: 2024-09-27HUBEI UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410727363.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Traditional methods cannot achieve accurate anomaly detection of industrial sensor time series data due to the complexity of the spatial location topology of the sensor collected signals and the complexity of abnormal changes in time series data.

Method used

A network anomaly detection method based on the thermonuclear diffusion graph mutation Transformer is adopted to construct an anomaly detection model by converting time and space feature data into time series data, including spatial embedding, time modeling, spatiotemporal feature capture and fully connected network prediction, using Thermal derivative diffusion map and mutation Transformer learn the dependence and time dependence between sensors to realize abnormality judgment.

Benefits of technology

It achieves accurate anomaly detection of industrial sensor time series data, can effectively capture complex spatial topology and time changes, improves the accuracy and reliability of anomaly detection, and becomes an important measure to prevent industrial information system failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713871A
    Figure CN118713871A
Patent Text Reader

Abstract

The invention discloses a network anomaly detection method based on thermonuclear diffusion diagram variation transformer, which comprises the following steps of: converting feature data of two dimensions of time and space into time series data, and performing data preprocessing on the time series data to be detected, the feature data comprises the spatial position identification of the abnormal object, the abnormal occurrence time and the abnormal occurrence type; an anomaly detection model based on the thermonuclear diffusion diagram variation transformer network is constructed, the network anomaly detection model is anomaly detection based on the thermonuclear diffusion diagram variation transformer network, and the anomaly detection comprises spatial embedding, time modeling, spatial and temporal feature capture based on two dimensions of time and space, full-connection network prediction and anomaly judgment. According to the technical scheme, the problem that the anomaly cannot be accurately predicted due to the complexity of a spatial position topological structure of a sensor acquisition signal and the complexity of abnormal change of time sequence data can be solved, and accurate network anomaly detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent manufacturing technology, and in particular to a network anomaly detection method based on a heat kernel diffusion graph mutation transformer. Background Art

[0002] With the advancement of industrialization and modernization, intelligent manufacturing has become an important application scenario for industrial big data. Nowadays, through sensors, controllers, smart instruments, etc., smart products have achieved real-time recording and perception of production operation status and operating environment, generating a large amount of industrial time series data. These time series data are widely present in production facilities and life, such as mechanical equipment operation data, network intrusion data, etc., reflecting the inherent operation status of a system. Benefiting from the continuous and rapid development of the Internet of Things and industrial systems, a large number of sensors are deployed in complex network-physical systems such as smart factories, thereby realizing the simulation, prediction and control of the production cycle.

[0003] A large number of sensor devices in the IoT system continuously run and generate multi-dimensional time series data, which are usually used to monitor the operating status of the system. However, abnormal changes in the monitored environment or device anomalies can cause significant differences in the collected data. At the same time, these sensors are vulnerable to cyber attacks and anomalies. These anomalies may pose a great risk to the security of the entire system and cause property losses. Therefore, effective anomaly detection methods are needed to detect and identify the occurrence of anomalies in the system.

[0004] At present, due to the increasing amount of multidimensional time series data collected by sensors and the complex relationships, the complex abnormal conditions of these multidimensional time series data have gradually attracted attention. Abnormal conditions often occur because of the mutual influence between different sensors, making these anomalies more difficult to detect and identify. Traditional methods usually model the dependencies of time series data in a relatively simple way. However, with the increase of dimensions, the spatial topological structure becomes more complex, and the complexity of time changes no longer allows the use of traditional methods to construct complex rules in the real world. Summary of the invention

[0005] The purpose of an embodiment of the present invention is to provide a network anomaly detection method based on a heat kernel diffusion map variant transformer, aiming to provide a technical solution that can accurately detect anomalies in time series data based on industrial sensors, thereby solving the problem that traditional methods cannot accurately predict anomalies due to the complexity of the spatial position topological structure of sensor acquisition signals and the complexity of abnormal changes in time series data, thereby failing to achieve anomaly detection.

[0006] In order to solve the above technical problems, an embodiment of the present invention provides a network anomaly detection method based on a heat kernel diffusion graph variant transformer, the method comprising:

[0007] S1. Convert the feature data of time and space dimensions into time series data, and perform data preprocessing on the time series data to be detected, wherein the feature data includes the spatial location identifier of the abnormal object, the time when the abnormality occurs, and the type of the abnormality;

[0008] S2. Construct an anomaly detection model based on the heat kernel diffusion map variant transformer network. The network anomaly detection model is an anomaly detection based on the heat kernel diffusion map variant transformer network. The anomaly detection includes spatial embedding, temporal modeling, spatiotemporal feature capture based on two dimensions of time and space, fully connected network prediction, and anomaly judgment.

[0009] Preferably, the spatial embedding specifically includes:

[0010] Perform node embedding on sensor data and construct an adjacency matrix based on the dependency relationships between different sensors obtained using cosine similarity;

[0011] According to the adjacency matrix, adaptive diffusion is performed based on thermal derivative guided diffusion;

[0012] The hidden spatial topological relationship between sensors is obtained through multi-layer diffusion.

[0013] Preferably, the node embedding of the sensor data and constructing an adjacency matrix according to the dependency relationship between different sensors obtained by using cosine similarity specifically includes:

[0014] The input sensor data is graphed, with sensors as nodes of the graph and an embedding vector Feature embedding is performed for P sensors, and cosine similarity is used to measure the similarity of sensor nodes as edges;

[0015] The adjacency matrix is ​​constructed as follows:

[0016]

[0017] G d,f =1{g d,f ∈top-k}

[0018] Where G represents the adjacency matrix, d,f represents the d-th sensor and the f-th sensor, top-k represents the first K distances, and g d,f represents the topological distance between the dth sensor and the fth sensor, G d,f Indicates normalization.

[0019] Preferably, the step of performing adaptive diffusion based on the adjacency matrix and guiding diffusion based on thermal derivatives specifically includes:

[0020] Using the normalized adjacency matrix as the basis for graph diffusion, the formula is as follows:

[0021]

[0022] in, is the normalized adjacency matrix, M d,d represents the degree matrix, where M d,d It is expressed as:

[0023] M d,d =∑ f G d,f

[0024] The thermal derivative diffusion formula is introduced in the graph diffusion process:

[0025]

[0026] in is the thermal derivative operator, the thermal derivative operator h T is differentiable with respect to T, where T represents the time variable.

[0027] Preferably, the obtaining of the hidden spatial topological relationship between sensors by multi-layer diffusion specifically includes:

[0028] The result of solving the thermal derivative diffusion formula is expanded by Taylor series to obtain the relationship between diffusion time and neighborhood size to capture the spatial correlation between long-distance sensors. The formula is as follows:

[0029]

[0030] Among them, k represents its k-order neighborhood;

[0031] Construct a diffusion network with graph structure for adaptive information transmission:

[0032]

[0033] Where r is the layer index, ψ is the Laplacian operator, and W r is the learnable weight matrix of the rth layer;

[0034] In order to obtain the thermal operator at any time T, the spectral calculation method is used to calculate the matrix index of the graph Laplacian matrix, as follows:

[0035]

[0036] in, is the matrix formed by superimposing the first i eigenvectors of the Laplacian matrix, is the transposed matrix of θ, ⊙ represents the Hadamard product, λ 0 ,λ 1 ,...are the corresponding eigenvalues ​​arranged in ascending order.

[0037] Furthermore, the method further comprises:

[0038] Design an operator R, the formula is as follows:

[0039]

[0040] h T (B)+RB=B

[0041] By merging the raw data of R map into the hot operator h T In the spectral approximation of (B) to alleviate the final information loss, the changed heat operator is defined as:

[0042]

[0043] The learnable parameter 1-ρ is simplified and replaced by Z, and the further modified thermal operator is:

[0044]

[0045] where ρ 1 and ρ 2 All are learnable weight parameters, and then the final thermal derivative diffusion network is obtained, the formula is as follows:

[0046]

[0047] in, Characterize the sensor data based on the thermal derivative update process, and finally after the multi-layer thermal derivative diffusion graph network learning update, the output variable is H out .

[0048] Preferably, the time modeling includes:

[0049] The input multivariate time series data is represented as O∈R n×l , where n represents the number of multivariate variables and l represents the sequence length;

[0050] Based on channel independence, O is divided into n univariate time series data O (i) ∈R 1×l ,i∈{0,1,2,…,n};

[0051] For each input univariate time series O (i) Divide into blocks Z′∈R N×P, where N represents the number of blocks and P represents the length of the block, is calculated as follows:

[0052]

[0053] Apply a trainable weight matrix W Z ∈R P×d Let the block Z′∈R N×P Projecting to high-dimensional space, we get Z∈R N×d , where d represents the time dimension, and the formal expression is as follows:

[0054] Z=Z′W Z

[0055] Initialize the relative position embedding parameter w pos =(w 1-N ,…,w 0 ,…,w N-1 ), where w j-i ∈R d , i and j Represent the indexes of block i and block j respectively, and N represents the number of blocks. The formal expression is as follows:

[0056]

[0057] Among them, β Q ,β K ∈R dtxds , d t and d s The dimensions of time and space are trainable weight parameter matrices; (z i β Q )·(z j β K ) represents the regular attention for query and key interaction, (z i β Q )·a ij and (z j β K )·a ij are the relative position metrics representing the query and key, respectively;

[0058] By applying the softmax function, μ ij The normalized attention weight α ij , the formal expression is as follows:

[0059]

[0060] The output of each block is obtained by re-weighting and summing each block by applying the normalized attention weight, which is formally expressed as follows:

[0061]

[0062] Among them, β V ∈R dxd , by taking the same operation on N blocks, we get the final output Z of the self-attention module attn =(z 1 ,……,z N ), where Z attn ∈R N×d ;

[0063] Introducing residual connections to prevent gradient disappearance to learn deeper temporal dependencies:

[0064] Y = BatchNorm(Z + Z attn )

[0065] The Relu activation function and feedforward neural network are used to increase the nonlinear fitting ability of the model, which is formalized as follows:

[0066]

[0067]

[0068] in W 1 ,W 2 is the weight matrix of the feedforward neural network, b 1 ,b 2 is the corresponding bias;

[0069] Will Flatten it to get Y′∈R 1×(N×d) ;

[0070] Using a linear layer to reproject to the same dimension as the input, we get the temporal dependency of the output of a single variable, which can be formally expressed as follows:

[0071]

[0072] in

[0073] Get multivariate output by concatenating n single variables

[0074] right Perform dimensionality increase and project it into the embedding space of the same dimension as the spatial modeling, and finally obtain the output of the temporal modeling.

[0075] Preferably, the spatiotemporal feature capture based on the two dimensions of time and space specifically includes:

[0076] The spatiotemporal attention network δst Expressed as a spatial representation H out and time representation The product of st It reflects the impact of different time steps on each space-time sequence, and the formalization is as follows:

[0077]

[0078] G=δ st H out W tsp

[0079] Among them, W tp ∈R d×d ,W sp ∈R d×d , W tsp ∈R d×d is the learning weight parameter;

[0080] Finally, we use the spatiotemporal attention network δ st For space, H out A parameter-based linear weighted transformation is performed to obtain the spatiotemporal feature G.

[0081] Preferably, the fully connected network prediction specifically includes:

[0082] By using two fully connected layers as the prediction layer and using the spatiotemporal feature G as the input of the prediction layer to make predictions, the final prediction results are obtained. in is the first predicted value of the sensor data, is the lth predicted value of the sensor, R (l-1)×n Represents a (l-1)×n dimensional space.

[0083] Preferably, the abnormality judgment includes:

[0084] Calculate the anomaly score, which is the value of the sensor's predicted data and the true sensor value g t It can be expressed as the squared deviation between:

[0085]

[0086] Calculate the anomaly scores of t timestamps and get a univariate time series consisting of anomaly scores

[0087] Calculate unknown parameters through mean and variance and

[0088]

[0089]

[0090]

[0091] Among them, τ is the initial threshold, Represents the shape parameters and scale parameters are GPD distribution; represents the anomaly score, Follow the parameters and GPD distribution; γ represents the part of the abnormal score exceeding τ, and the final parameter is finally calculated and u represents the average value of sample points above the threshold, J 2 Indicates the variance of sample points exceeding the threshold;

[0092] Use GPD to fit the distribution and calculate the final threshold for anomaly assessment. The calculation formula for the final threshold is as follows:

[0093]

[0094] Among them, θ represents the abnormal risk coefficient, n represents the total number of samples, Ω represents the total number of samples exceeding the initial threshold, and N represents the total number of samples exceeding the initial threshold.

[0095] Compared with the prior art, the network anomaly detection method based on heat kernel diffusion map variant transformer provided by the embodiment of the present invention first performs spatiotemporal embedding preprocessing on the multi-dimensional time series data, and then performs in-depth mining in the two dimensions of time and space. In space, the heat kernel diffusion map is used to capture the global dependency pattern between various sensor devices. In time, the variant transformer is used to efficiently learn the time dependency relationship, and the processed raw data, the extracted time dimension and space dimension features are connected and fed into the attention network to capture the deep features in the fused time series data. Then, a prediction scoring mechanism is used to output the spatiotemporal deep features of the attention network to perform spatiotemporal time series prediction. In addition, residual connections are added to perform stable training to avoid gradient disappearance. Finally, the predicted value and the observed value are input into the dynamic deviation scoring module. If the anomaly score exceeds the adaptive deviation threshold, it is considered that an anomaly occurs at this moment, thereby achieving accurate anomaly detection, so that the multi-dimensional time series anomaly detection method based on modeling in the embodiment of the present invention has become an important measure to prevent industrial information system failures. BRIEF DESCRIPTION OF THE DRAWINGS

[0096] The preferred implementation modes will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.

[0097] Figure 1 This is a flow chart of a network anomaly detection method based on a heat kernel diffusion graph variant transformer according to an embodiment of the present invention;

[0098] Figure 2 It is an implementation flow chart of a network anomaly detection method based on a heat kernel diffusion graph mutation transformer according to another embodiment of the present invention. DETAILED DESCRIPTION

[0099] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.

[0100] In order to simplify the drawings, only the parts related to the invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".

[0101] The following mainly takes some specific embodiments as examples to describe in detail the implementation of the technical solution of the present invention.

[0102] like Figure 1 and 2 As shown, a network anomaly detection method based on a heat kernel diffusion graph variant transformer in an embodiment of the present invention includes:

[0103] S1. Convert the feature data of time and space dimensions into time series data, and perform data preprocessing on the time series data to be detected, wherein the feature data includes the spatial location identifier of the abnormal object, the time when the abnormality occurs, and the type of the abnormality;

[0104] The detected time series data is preprocessed from both time and space aspects. In the process, the network anomaly data, including the spatial location identification of the abnormal object, the time of the abnormal occurrence, the type of the abnormal occurrence and other information about the abnormal object, is converted into time series data.

[0105] S2. Construct an anomaly detection model based on the heat kernel diffusion graph variant transformer network, wherein the network anomaly detection model comprises:

[0106] After data preprocessing, an anomaly detection model based on the heat kernel diffusion map variant transformer network is constructed. The network anomaly detection model is an anomaly detection based on the heat kernel diffusion map variant transformer network. The anomaly detection includes spatial embedding, temporal modeling, spatiotemporal feature capture based on two dimensions of time and space, fully connected network prediction, and anomaly judgment.

[0107] Among them, the anomaly judgment module is based on the anomaly judgment of the threshold scoring mechanism, and uses the defined threshold to compare the predicted value and the observed value for anomaly judgment.

[0108] The spatial embedding specifically includes:

[0109] Perform node embedding on sensor data and construct an adjacency matrix based on the dependency relationships between different sensors obtained using cosine similarity;

[0110] According to the adjacency matrix, adaptive diffusion is performed based on thermal derivative guided diffusion;

[0111] The hidden spatial topological relationship between sensors is obtained through multi-layer diffusion.

[0112] The embodiment of the present invention learns the spatial correlation of sensors through an innovative diffusion learning module guided by thermal derivatives.

[0113] Firstly, the sensor data is embedded in nodes, and the cosine similarity is used to obtain the dependency between different sensors to construct the adjacency matrix. Then, the obtained adjacency matrix is ​​put into the module based on thermal derivative guided diffusion for adaptive diffusion, and the hidden spatial topological relationship between sensors is obtained through multi-layer diffusion.

[0114] Among them, the node embedding of sensor data and the construction of the adjacency matrix based on the dependency relationship between different sensors obtained by cosine similarity specifically include:

[0115] The input sensor data is graphed, with sensors as nodes of the graph and an embedding vector Feature embedding is performed for P sensors, and cosine similarity is used to measure the similarity of sensor nodes as edges;

[0116] The adjacency matrix is ​​constructed as follows:

[0117]

[0118] G d,f =1{g d,f∈top-k}

[0119] Where G represents the adjacency matrix, d,f represents the d-th sensor and the f-th sensor, top-k represents the first K distances, and g d,f represents the topological distance between the dth sensor and the fth sensor, G d,f Indicates normalization.

[0120] That is, the input sensor data is graphed and the sensors are used as nodes of the graph. Due to the differences between the features of different sensors, an embedding vector is used. Feature embedding is performed for P sensors, and cosine similarity is used to measure the similarity of sensor nodes as edges.

[0121] The specific process of constructing the adjacency matrix is ​​as follows:

[0122]

[0123] G d,f =1{g d,f ∈top-k}

[0124] Where G represents the adjacency matrix. d,f represents the dth sensor and the fth sensor. Top-k represents the top K distances. G d,f Indicates the spatial distance between two sensors. G d,f Indicates normalization.

[0125] Then, the normalized adjacency matrix is ​​used as the basis for graph diffusion, and the formula is as follows:

[0126]

[0127] in, is the normalized adjacency matrix, M d,d Degree matrix;

[0128] M d,d =∑ f G d,f

[0129] The step of performing adaptive diffusion based on the adjacency matrix and guiding diffusion based on thermal derivatives specifically includes:

[0130] Using the normalized adjacency matrix as the basis for graph diffusion, the formula is as follows:

[0131]

[0132] in, is the normalized adjacency matrix, M d,d represents the degree matrix, where M d,d It is expressed as:

[0133] M d,d =∑ f G d,f

[0134] The thermal derivative diffusion formula is introduced in the graph diffusion process:

[0135]

[0136] in is the thermal derivative operator, the thermal derivative operator h T is differentiable with respect to T, where T represents the time variable.

[0137] That is, in order to take into account both the local accuracy of information transmission and the sensitivity to the graph structure, the embodiment of the present invention combines the information exchange between multi-hop neighbors and introduces the thermal derivative diffusion formula in the graph diffusion process:

[0138]

[0139] in is the thermal derivative operator, the thermal derivative operator h T is differentiable with respect to T, where T represents the time variable.

[0140] The method of obtaining the hidden spatial topological relationship between sensors through multi-layer diffusion specifically includes:

[0141] The result of solving the thermal derivative diffusion formula is expanded by Taylor series to obtain the relationship between diffusion time and neighborhood size to capture the spatial correlation between long-distance sensors. The formula is as follows:

[0142]

[0143] Among them, k represents its k-order neighborhood;

[0144] Construct a diffusion network with graph structure for adaptive information transmission:

[0145]

[0146] Where r is the layer index, ψ is the Laplacian operator, and W r is the learnable weight matrix of the rth layer;

[0147] In order to obtain the thermal operator at any time T, the spectral calculation method is used to calculate the matrix index of the graph Laplacian matrix, as follows:

[0148]

[0149] in, is the matrix formed by superimposing the first i eigenvectors of the Laplacian matrix, for The transposed matrix of 0 ,λ 1 ,...are the corresponding eigenvalues ​​arranged in ascending order.

[0150] That is, the result of solving the above equation is expanded by Taylor series to obtain the relationship between diffusion time and neighborhood size, capturing the spatial correlation between long-distance sensors. The formula is as follows:

[0151]

[0152] Among them, k represents its k-order neighborhood, and the series can be truncated so that the diffusion is constrained to the K-hop neighborhood.

[0153] Then, a diffusion network with graph structure is constructed to perform adaptive information transmission:

[0154]

[0155] Where r is the layer index, ψ is the Laplacian operator, and W r is the learnable weight matrix of the rth layer.

[0156] In order to obtain the thermal operator at any time T, the spectral calculation method is used to calculate the matrix index of the graph Laplacian matrix as follows:

[0157]

[0158] in, is the matrix formed by superimposing the first i eigenvectors of the Laplacian matrix, for The transposed matrix of 0 ,λ 1 ,...are the corresponding eigenvalues ​​arranged in ascending order.

[0159] In order to avoid the information loss that may be caused by the above low-rank basis projection, an operator R is designed, the formula is as follows:

[0160]

[0161] h T (B)+RB=B

[0162] By merging the raw data of R map into the hot operator h T (B) to alleviate the final information loss. Therefore, the changed heat operator is defined as:

[0163]

[0164] Among them, after simplifying the learnable parameter 1-ρ and replacing it with Z, the further modified thermal operator is:

[0165]

[0166] where ρ 1 and ρ 2 All are learnable weight parameters, and then the final thermal derivative diffusion network is obtained, the formula is as follows:

[0167]

[0168] in, Characterize the sensor data based on the thermal derivative update process, and finally after the multi-layer thermal derivative diffusion graph network learning update, the output variable is H out .

[0169] In order to achieve the modeling of temporal correlation of sensors, an embodiment of the present invention constructs a block variation transformer model that combines relative position encoding and channel independence. By applying channel independence, the model can independently learn the long-term temporal dependency of each variable, thereby enhancing the long-term dependency of model modeling time series data. The time series data is divided into multiple blocks to more effectively extract the semantic information contained in the time series data. At the same time, in the self-attention mechanism, the interaction between query, key and relative position encoding is added, so as to be more sensitive to the sequential information of each time series data.

[0170] The input multivariate time series data is represented as O∈R n×l , where n represents the number of multivariate variables and l represents the sequence length.

[0171] Based on the setting of channel independence, O is divided into n univariate time series data O (i) ∈R 1×l ,i∈{0,1,2,…,n}.

[0172] For each input univariate time series O (i) First, it is divided into blocks Z′∈R N×P , where N represents the number of blocks and P represents the length of the block. The specific calculation method is as follows:

[0173]

[0174] In order to ensure the consistency of the length of the partitioned blocks and avoid the loss of information in the partitioned blocks, the O (i) The last value of is filled S times to the end of the sequence.

[0175] Apply a trainable weight matrix W Z ∈R P×d These blocks Z′∈R N×P Projecting to high-dimensional space, we get Z∈R N×d , where d represents the time dimension, and the formal expression is as follows:

[0176] Z=Z′W Z

[0177] The embodiment of the present invention proposes a new self-attention method combined with relative position embedding to more accurately simulate the time sequence relationship of time series data.

[0178] Specifically, this approach adds the interaction between each query Q, key K, and relative position embedding in the self-attention mechanism

[0179] First, initialize the relative position embedding parameter w pos =(w 1-N ,…,w 0 ,…,w N-1 ), where w j-i ∈R d , i and j represent the indexes of block i and block j respectively, and N represents the number of blocks. The formal expression is as follows:

[0180]

[0181] in, d t and d s The dimensions representing time and space, respectively, are trainable weight parameter matrices;

[0182] (z i β Q )·(z j β K ) represents the regular attention for query and key interaction, (z i β Q )·a ij and (z j β K )·a ij are the relative position metrics representing the query and key respectively.

[0183] Further, μ is calculated by applying the softmax function ij The normalized attention weight α ij , the formal expression is as follows:

[0184]

[0185] The output of each block is obtained by re-weighting and summing each block by applying the normalized attention weight, which is formally expressed as follows:

[0186]

[0187] Among them, β V ∈R dxd , by taking the same operation as above for N blocks, we get the final output Z of the self-attention module attn =(z 1 ,……,z N ), where Z attn ∈R N×d .

[0188] Use Batch Normalization instead of Layer Normalization.

[0189] At the same time, residual connections are introduced to prevent gradient disappearance and learn deeper temporal dependencies.

[0190] Y = BatchNorm(Z + Z attn )

[0191] The Relu activation function and feedforward neural network are used to increase the nonlinear fitting ability of the model, which is formalized as follows.

[0192]

[0193]

[0194] in W 1 ,W 2 is the weight matrix of the feedforward neural network, b 1 ,b 2 is the corresponding bias. Then, Flatten it to get Y′∈R 1×(N×d) .

[0195] Next, a linear layer is used to reproject it to the same dimension as the input, resulting in a single variable output, which is formally expressed as follows.

[0196]

[0197] in

[0198] Through the above process, the time dependence of individual variables is captured.

[0199] Then, we can get the multivariate output by concatenating n single variables.

[0200] In order to facilitate the subsequent space-time fusion, Perform dimensionality increase and project it into the embedding space of the same dimension as the spatial modeling, and finally obtain the output of the temporal modeling.

[0201] The spatiotemporal feature capture based on the two dimensions of time and space in the embodiment of the present invention specifically includes:

[0202] By combining the spatial and temporal dependencies captured by spatial modeling and temporal modeling through the attention network-based spatiotemporal fusion, we can learn spatiotemporal deep features. In this way, spatiotemporal dependencies can be learned and modeled holistically.

[0203] First, the spatiotemporal attention δ st Representation space representation H out and time representation The product of st Represents the impact of different time steps on each spatiotemporal sequence, formalized as follows:

[0204]

[0205] G=δ st H out W tsp

[0206] Among them, W tp ∈R d×d ,W sp ∈R d×d , W tsp ∈R d×d is the learning weight parameter;

[0207] Finally, we use the spatiotemporal attention network δ st For space, H out A parameter-based linear weighted transformation is performed to obtain the spatiotemporal feature G.

[0208] The fully connected network prediction of the embodiment of the present invention specifically includes:

[0209] Next, by using two fully connected layers as the prediction layer and using the spatiotemporal feature G as the input of the prediction layer to make predictions, the final prediction results are obtained. in is the first predicted value of the sensor, is the lth predicted value of the sensor, R (l-1)×n Represents a (l-1)×n dimensional space.

[0210] The abnormality judgment of the embodiment of the present invention includes:

[0211] Calculate the anomaly score, which is the value of the sensor's predicted data and the true sensor value g t It can be expressed as the squared deviation between:

[0212]

[0213] Calculate the anomaly scores of t timestamps and get a univariate time series consisting of anomaly scores

[0214] Calculate unknown parameters through mean and variance and

[0215]

[0216]

[0217]

[0218] Among them, τ is the initial threshold, Represents the shape parameters and scale parameters are GPD distribution; represents the anomaly score, Follow the parameters and GPD distribution; γ represents the part of the abnormal score exceeding τ, and the final parameter is finally calculated and u represents the average value of sample points above the threshold, J 2 Indicates the variance of sample points exceeding the threshold;

[0219] Use GPD to fit the distribution and calculate the final threshold for anomaly assessment. The calculation formula for the final threshold is as follows:

[0220]

[0221] Among them, θ represents the abnormal risk coefficient, n represents the total number of samples, Ω represents the total number of samples exceeding the initial threshold, and N represents the total number of samples exceeding the initial threshold.

[0222] That is, in order to accurately learn the model parameter settings, the predicted value of the joint model at time t and the true value g t The root mean square deviation between 0 as a loss function.

[0223]

[0224] Furthermore, the embodiment of the present invention uses stochastic gradient descent and back propagation algorithms to optimize model parameters, and uses the Adam optimizer to update the parameters.

[0225] Furthermore, in anomaly judgment, the anomaly score is first calculated. For the part of the anomaly score that exceeds the initial threshold, GPD is used to fit its distribution and calculate the corresponding parameters. Then, the final threshold is calculated based on the parameters to perform anomaly assessment.

[0226] The anomaly score is composed of the predicted value and the true value g t It can be expressed as the squared deviation between:

[0227]

[0228] Calculate the anomaly scores of t timestamps and get a univariate time series consisting of anomaly scores In addition, an automatic threshold selection method SPOT is used to analyze data anomalies, estimate the population through the mean and variance, and then calculate the unknown parameters and

[0229]

[0230]

[0231]

[0232] Among them, τ is the initial threshold, Represents the shape parameters and scale parameters are GPD distribution;

[0233] represents the anomaly score, Follow the parameters and GPD distribution;

[0234] γ represents the part of the abnormal score that exceeds τ, and the final parameter is finally calculated and

[0235] u represents the average value of sample points above the threshold, J 2 Indicates the variance of sample points exceeding the threshold.

[0236] Finally, θ represents the risk factor for determining abnormality, n represents the total number of samples, Ω represents the total number of samples exceeding the initial threshold, and N represents the total number of samples exceeding the initial threshold.

[0237] The final threshold is calculated as follows:

[0238]

[0239] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A network anomaly detection method based on heat kernel diffusion graph mutation transformer, characterized in that: The method comprises: S1. Convert the feature data of time and space dimensions into time series data, and perform data preprocessing on the time series data to be detected, wherein the feature data includes the spatial location identifier of the abnormal object, the time when the abnormality occurs, and the type of the abnormality; S2. Construct an anomaly detection model based on the heat kernel diffusion map variant transformer network. The network anomaly detection model is an anomaly detection based on the heat kernel diffusion map variant transformer network. The anomaly detection includes spatial embedding, temporal modeling, spatiotemporal feature capture based on two dimensions of time and space, fully connected network prediction, and anomaly judgment.

2. The network anomaly detection method based on heat kernel diffusion graph mutation transformer according to claim 1 is characterized in that: The spatial embedding specifically includes: Perform node embedding on sensor data and construct an adjacency matrix based on the dependency relationships between different sensors obtained using cosine similarity; According to the adjacency matrix, adaptive diffusion is performed based on thermal derivative guided diffusion; The hidden spatial topological relationship between sensors is obtained through multi-layer diffusion.

3. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 2 is characterized in that: The node embedding of the sensor data and constructing an adjacency matrix according to the dependency relationship between different sensors obtained by using cosine similarity specifically includes: The input sensor data is graphed, with sensors as nodes of the graph and an embedding vector Feature embedding is performed for P sensors, and cosine similarity is used to measure the similarity of sensor nodes as edges; The adjacency matrix is ​​constructed as follows: G d,f =1{g d,f ∈top-k} Where G represents the adjacency matrix, d,f represents the d-th sensor and the f-th sensor, top-k represents the first K distances, and g d,f represents the topological distance between the dth sensor and the fth sensor, G d,f Indicates normalization.

4. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 3 is characterized in that: The step of performing adaptive diffusion based on the adjacency matrix and guiding diffusion based on thermal derivatives specifically includes: Using the normalized adjacency matrix as the basis for graph diffusion, the formula is as follows: in, is the normalized adjacency matrix, M d,d represents the degree matrix, where M d,d It is expressed as: M d ,d=∑ f G d,f The thermal derivative diffusion formula is introduced in the graph diffusion process: in is the thermal derivative operator, the thermal derivative operator h T is differentiable with respect to T, where T represents the time variable.

5. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 4 is characterized in that: The hidden spatial topological relationship between sensors obtained by multi-layer diffusion specifically includes: The result of solving the thermal derivative diffusion formula is expanded by Taylor series to obtain the relationship between diffusion time and neighborhood size to capture the spatial correlation between long-distance sensors. The formula is as follows: Among them, k represents its k-order neighborhood; Construct a diffusion network with graph structure for adaptive information transmission: Where r is the layer index, ψ is the Laplacian operator, and W r is the learnable weight matrix of the rth layer; In order to obtain the thermal operator at any time T, the spectral calculation method is used to calculate the matrix index of the graph Laplacian matrix, as follows: in, is the matrix formed by superimposing the first i eigenvectors of the Laplacian matrix, for The transposed matrix of , ⊙ represents the Hadamard product, λ0,λ1,... are the corresponding eigenvalues ​​arranged in ascending order.

6. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 5, characterized in that: The method further comprises: Design an operator R, the formula is as follows: h T (B)+RB=B By merging the raw data of R map into the hot operator h T In the spectral approximation of (B) to alleviate the final information loss, the changed heat operator is defined as: The learnable parameter 1-ρ is simplified and replaced by Z, and the further modified thermal operator is: Among them, ρ1 and ρ2 are both learnable weight parameters, and then the final thermal derivative diffusion network is obtained, the formula is as follows: in, Characterize the sensor data based on the thermal derivative update process, and finally after the multi-layer thermal derivative diffusion graph network learning update, the output variable is H out .

7. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 6 is characterized in that: The time modeling includes: The input multivariate time series data is represented as O∈R n×l , where n represents the number of multivariate variables and l represents the sequence length; Based on channel independence, O is divided into n univariate time series data O (i) ∈R 1×l ,i∈{0,1,2,…,n}; For each input univariate time series O (i) Divide into blocks Z′∈R N×P , where N represents the number of blocks and P represents the length of the block, is calculated as follows: Apply a trainable weight matrix W Z ∈R P×d Let the block Z′∈R N×P Projecting to high-dimensional space, we get Z∈R N×d , where d represents the time dimension, and the formal expression is as follows: Z=Z′W Z Initialize relative position embedding parameter w pos =(w 1-N ,…,w0,…,w N-1 ), where w j-i ∈R d , i and j represent the indexes of block i and block j respectively, and N represents the number of blocks. The formal expression is as follows: in, d t and d s The dimensions of time and space are trainable weight parameter matrices; (z i β Q )·(z j β K ) represents the regular attention for query and key interaction, (z i β Q )·a ij and (z j β K )·a ij are the relative position metrics representing the query and key, respectively; By applying the softmax function, μ ij The normalized attention weight α ij , which is formally expressed as follows: The output of each block is obtained by re-weighting and summing each block by applying the normalized attention weight, which is formally expressed as follows: Among them, β V ∈R dxd , by taking the same operation on N blocks, we get the final output Z of the self-attention module attn =(z1,……,z N ), where Z attn ∈R N×d ; Introducing residual connections to prevent gradient disappearance to learn deeper temporal dependencies: Y=BatchNorm(Z+Z attn ) The Relu activation function and feedforward neural network are used to increase the nonlinear fitting ability of the model, which is formalized as follows: in W1, W2 are the weight matrices of the feedforward neural network, and b1, b2 are the corresponding biases; Will Flatten it to get Y′∈R 1×(N×d) ; Using a linear layer to reproject to the same dimension as the input, we get the temporal dependency of the output of a single variable, which can be formally expressed as follows: in Get multivariate output by concatenating n single variables right Perform dimensionality increase and project it into the embedding space of the same dimension as the spatial modeling, and finally obtain the output of the temporal modeling.

8. The network anomaly detection method based on heat kernel diffusion graph mutation transformer as claimed in claim 7 is characterized in that: The spatiotemporal feature capture based on the two dimensions of time and space specifically includes: The spatiotemporal attention network δ st Expressed as a spatial representation H out and time representation The product of st It reflects the impact of different time steps on each space-time sequence, and the formalization is as follows: G=δ st H out W tsp Among them, W tp ∈R d×d ,W sp ∈R d×d , W tsp ∈R d×d is the learning weight parameter; Finally, we use the spatiotemporal attention network δ st For space, H out A parameter-based linear weighted transformation is performed to obtain the spatiotemporal feature G.

9. The network anomaly detection method based on heat kernel diffusion graph variant transformer as claimed in claim 8, characterized in that: The fully connected network prediction specifically includes: By using two fully connected layers as the prediction layer and using the spatiotemporal feature G as the input of the prediction layer to make predictions, the final prediction results are obtained. in is the first predicted value of the sensor data, is the lth predicted value of the sensor, R (l-1)×n Represents a (l-1)×n dimensional space.

10. The network anomaly detection method based on heat kernel diffusion graph mutation transformer according to claim 9, characterized in that: The abnormality judgment includes: Calculate the anomaly score, which is the value of the sensor's predicted data and the true sensor value g t It can be expressed as the squared deviation between: Calculate the anomaly scores of t timestamps and get a univariate time series consisting of anomaly scores Calculate unknown parameters through mean and variance and Among them, τ is the initial threshold, Represents the shape parameters and scale parameters are GPD distribution; represents the anomaly score, Follow the parameters and GPD distribution; γ represents the part of the abnormal score exceeding τ, and the final parameter is finally calculated and u represents the average value of sample points above the threshold, J 2 Indicates the variance of sample points exceeding the threshold; Use GPD to fit the distribution and calculate the final threshold for anomaly assessment. The calculation formula for the final threshold is as follows: Among them, θ represents the abnormal risk coefficient, n represents the total number of samples, Ω represents the total number of samples exceeding the initial threshold, and N represents the total number of samples exceeding the initial threshold.

Citation Information

Cited By

  • Time sequence information prediction method, system and equipment based on dynamic segmentation and medium

    CN120429837A