Multi-element sensor time series data anomaly detection method based on time series converter

Through a time series converter-based method, combined with the Laplacian kernel function and the multi-head attention mechanism, the problems of high dependence on labeled data and computational complexity in the existing technology are solved, and the problem of high dependence on labeled data and computational complexity is achieved in resource-constrained environments. Anomaly detection of multi-sensor time series data improves the accuracy and adaptability of detection.

CN118535981APending Publication Date: 2024-08-23GUILIN UNIV OF ELECTRONIC TECH

Patent Information

Application Number
CN202410613628.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing multi-sensor time series data anomaly detection methods are highly dependent on labeled data, have complex training processes and are computationally resource-intensive, making them difficult to effectively apply in resource-constrained environments, and may suffer from overfitting and ignoring time dependencies.

Method used

Using a time series converter-based method, through feature matrix generation, dense connection network DenseNet feature matrix layering, time series converter encoder processing and feature matrix reconstruction, combined with the Laplacian kernel function and multi-head attention mechanism, it reduces Compute complexity and capture dynamic changes and complex relationships in time series.

Benefits of technology

It achieves effective anomaly detection on unlabeled data sets, reduces computational complexity, improves the adaptability and generalization capabilities of the model, can promptly detect signs of system failures and data corruption, and provides security protection for wireless sensor networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535981A
    Figure CN118535981A
Patent Text Reader

Abstract

The invention discloses a multi-sensor time series data anomaly detection method based on a time series converter. The method comprises the following steps: 1) generating a feature matrix; 2) layering by adopting a dense connection network feature matrix; 3) serializing time sequence data based on a time sequence converter; 4) reconstructing a feature matrix; and 5) abnormity determination. According to the method, a plurality of time windows are adopted to construct a feature matrix, the feature matrix is serialized in a layered fusion mode, so that features of time series data are learned, in the learning process, original features are restored by reconstructing the feature matrix, then abnormal scores between the original feature matrix and the reconstructed feature matrix are calculated, and the abnormal scores of the original feature matrix and the reconstructed feature matrix are calculated. And when the abnormity score exceeds a preset threshold value, the system diagnoses abnormity. According to the method, signs of system faults, external attacks or data damage can be found in time, potential loss or damage can be prevented, and important reference is provided for network maintenance and safety protection of the wireless sensor network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a wireless sensor network time series data anomaly detection technology, which is used in scenarios such as industrial control systems, space probes, and Internet servers that require sensor data to be aggregated and uniformly monitored. Specifically, it is a multi-sensor time series data anomaly detection method based on a time series converter. Background Art

[0002] With the advancement of technology and the acceleration of digital transformation, wireless sensor networks (WSNs) are increasingly being used in various fields. These networks can achieve real-time monitoring of the environment and system status in a wide range of areas by deploying multiple sensor nodes. Anomaly detection, that is, identifying unusual patterns in data, can promptly detect signs of system failures, external attacks, or data corruption, and prevent potential losses or damages, which is crucial to ensuring the reliability and security of wireless sensor networks.

[0003] In the early days, sensor anomaly detection methods mainly focused on threshold-based and statistical model-based techniques, identifying abnormal data points by setting thresholds or building statistical models. However, these methods often have limited effects when processing high-dimensional and dynamically changing data, and lack sufficient adaptability to complex data patterns and noise. In recent years, with the development of deep learning technology, multi-sensor time series data anomaly detection methods based on deep learning have gradually emerged. Using models such as long short-term memory networks (LSTM) and convolutional neural networks (CNN), the long-term dependencies and local features between time series data can be better captured, thereby improving the accuracy and efficiency of anomaly detection. However, these deep learning methods also have some problems. For example, the LSTM model requires a large amount of labeled data during training, but it may be difficult to obtain labeled data in practical applications, which limits its application on unlabeled data sets. At the same time, the LSTM model may have overfitting problems for complex data patterns and dynamic environments, resulting in poor generalization performance. On the other hand, the CNN model may ignore the temporal dependency between data when processing multivariate data, resulting in poor detection performance. In addition, since these models require a large number of parameters for training, the computational complexity is high, and there may be a problem of excessive computational overhead on resource-constrained sensor nodes. The existing multivariate sensor time series data anomaly detection methods have the following two main shortcomings: First, they are highly dependent on labeled data, and the difficulty in obtaining labeled data may affect the generalization ability and adaptability of the model; second, the computational complexity is high, and the model training and inference process requires a large amount of computing resources, which limits its application in resource-constrained environments. Summary of the invention

[0004] The purpose of the present invention is to address the deficiencies of the prior art and to provide a method for detecting anomalies in multi-sensor time series data based on a time series converter. This method can promptly detect signs of system failures, external attacks or data corruption, prevent potential losses or damages, and provide an important reference for network maintenance and security protection of wireless sensor networks.

[0005] The technical solution for achieving the purpose of the present invention is:

[0006] A method for detecting anomaly in multivariate sensor time series data based on a time series converter comprises the following steps:

[0007] 1) Feature matrix generation: Given a time series data with n dimensions and a time span of T Each dimension of data Each data point in the time series represents the value of the n-dimensional data at time point t. For time point t, this technical solution uses three time windows w of different lengths, w is 5, 10, and 30 respectively. Under each time window w, the data from tw to t in the n-dimensional time series is sent to the Laplace kernel function to generate an n×n feature matrix M t , slices of multivariate time series data in time windows of size w Given two time series data and First, the time window average of the time series data is calculated by formula (1), and then the correlation of the two time series data is calculated by the Laplace kernel function shown in formula (2):

[0008]

[0009]

[0010] in, is the feature matrix M t The element of the i-th row and j-th column of , σ is the bandwidth parameter, which is a positive real number used to control the decay rate of the kernel function. In this technical solution, the data sampling frequency is set to sample once every 5 time points, and the characteristic matrix M obtained by calculating the correlation based on the time window size of 3 different lengths is t Characterize the system state at different scales, and convert the obtained characteristic matrix M t Concatenate into a tensor Represented as the original feature matrix, the feature matrix formed in this way can model the spatial relationship in the original data well, and the Laplace kernel can map the original feature space to a higher-dimensional space, so that the data that was originally linearly inseparable in the original space becomes linearly separable in the new feature space;

[0011] 2) Using densely connected network DenseNet feature matrix layering: Densely connected network DenseNet is used to extract the spatial information of the feature matrix, and the original feature matrix is ​​divided into 3 layers. Each layer is the output of the corresponding denseblock, which will be used as the input of the next part. In the densely connected network DenseNet, each layer will receive the output of all previous layers as the input of the next layer, so that information and gradients can be directly transmitted from any layer to all subsequent layers, which enhances the propagation of features and reduces the loss of information. This technical solution converts the original feature matrix χ t,0 Pass multiple densely connected layers, assuming that the output of the lth layer at time t is represented by χ t,l-1 , represents the feature matrix of the l-1th layer at time t, then the output of the lth layer is expressed as shown in formula (3):

[0012] χ t,l =H l ([χ t,0 ,x t,1 ,...,χ t,l-1 ]) (3),

[0013] Among them, [χ t,0 ,x t,1 ,...,χ t,l-1 ] represents the tensor of the concatenated 0th, 1st, ..., l-1th layers at time t, H l (.) is a composite function of batch normalization (BN), rectified linear unit (ReLU), pooling, and convolution (Conv). Because for any given arrangement, the generated local pattern can be captured by DenseNet, the exact order of the time series based on which the feature matrix is ​​formed is not important;

[0014] 3) Time series data serialization based on time series converter: The time series converter module converts the time series data into a series of patch vectors and processes these vectors using the time series converter to finally obtain a rich time series feature representation. This process covers multiple stages from local feature extraction to global dependency modeling, enabling the model to effectively capture the dynamic changes and complex relationships in time series data. The feature matrix χ t,l Before passing into the time series converter module, the feature matrix χ of each layer is t,l Push forward ts in sequence, ts is 5 time steps and merge all feature matrices with time steps, so that the feature matrix χ of each layer t,l becomes a feature matrix with time steps Where ts is the time step, n l is the height and width of the feature matrix, c lis the number of channels. By effectively extracting and transforming the feature matrix, the time series converter module can capture the dynamic features in the time series, including:

[0015] 3-1) Patch Embedding: First, the feature matrix of each time step is divided into multiple small patches, and these patches are converted into a series of vector representations. This step not only reduces the computational complexity of the model, but also provides the model with the ability to process time series. The feature matrix of the lth layer with ts time steps at time t is converted into Divide into N l patches, N l for Each patch has the same number of channels c l , the size of patches is P×P, and the vectorized representation of patches is Then a linear transformation is used to map each patch to the new embedding space Where D is the embedding dimension, D is 256, and the linear transformation formula of the feature matrix with time steps is expressed as shown in formula (4):

[0016]

[0017] in, is the embedding matrix, is the bias term;

[0018] 3-2) Positional Embedding: Since the model itself does not have the ability to process sequence order, positional embedding is introduced to provide sequential information between time steps. The positional embedding vector is added to the feature matrix patch embedding vector, which provides the model with the ability to capture dynamic changes in time series. As shown in formula (5), positional embedding adds a learnable vector To provide location information for each patch, where N is the total number of patches, the embedding vector is obtained

[0019]

[0020] 3-3) Time Series Transformer Encoder Processing: The time series transformer encoder has multiple encoder layers, each of which consists of two parts: a multi-head attention mechanism and a feedforward neural network. The input vector The initialization input after position embedding is processed by H layers of time series transformer encoders. Each layer contains a self-attention mechanism and a feedforward network, plus residual connections and layer normalization to improve the stability and efficiency of training. The process is as follows:

[0021] For the μth layer time series transformer encoder input is the output of the μ-1th layer, and the 1st layer input is For the 1st layer to the μth layer, the iterative calculation of each layer is shown in formula (6) and formula (7):

[0022]

[0023]

[0024] Among them, LN represents layer normalization, MHA represents multi-head attention mechanism, FFN represents feedforward neural network, all layers include residual connections, and after H layers, the output can be expressed as

[0025] 4) Feature Matrix Reconstruction: This technical solution provides an efficient reconstruction layer, which concatenates and reshapes multiple output sequences serialized by the time series converter, and then uses layer-by-layer deconvolution to restore them to the reconstructed feature matrix with the same dimension as the original feature matrix. This process is crucial for feature understanding and visualization in time series analysis and related application scenarios, as shown below:

[0026] First, multiple output sequences serialized by the time series converter are concatenated and merged as shown in formula (8):

[0027]

[0028] Get the merged sequence Where N=N1+N2+…N l , and then reshape the sequence into a matrix form, as shown in formula (9):

[0029] Z t′ =Reshape(Z t ) (9),

[0030] Among them, Reshape represents the reshaping operation, which changes the merged sequence Z t Without changing the shape of the data, the reshaped matrix is ​​represented as Finally, Z t′ A δ-layer deconvolution layer is used, where δ is 4, and the reconstructed feature matrix with the same dimension as the original feature matrix is ​​restored layer by layer, as shown in formula (10):

[0031] Q δ =f(W δ ⊙q δ-1 +b δ ) (10),

[0032] Among them, the input of the δth layer is the output of the δ-1th layer, and the input Q0 of the 1st layer is Zt′ , f(·) represents the Relu activation function, ⊙ represents the deconvolution operation, With b δ ∈d δ is the filter kernel and bias parameter of the δth deconvolution layer. Each layer aims to further amplify the feature matrix and reduce the feature depth until the dimension and number of channels of the original input are restored. After the δth deconvolution layer, the final reconstructed feature matrix is ​​obtained. The purpose of this technical solution is to minimize the error between the original feature matrix and the reconstructed feature matrix. The loss function is shown in formula (11):

[0033]

[0034] in, Use stochastic gradient descent method and Adam optimizer to minimize the above losses and achieve end-to-end training;

[0035] 5) Anomaly determination: Divide the training data into training set D in a ratio of 4:1 train With the validation set D valid , for the validation set D valid At each time point t, count the abnormal score s(t) at each time point t valid , take the validation set D valid The maximum value of the anomaly score on is used as the threshold θ for anomaly determination, where θ = max{s(t) valid}, for the test set D test At each time point t in , count the abnormal score s(t) at each time point t test , and compared with the threshold θ, when the anomaly score s(t) test When it is greater than the threshold value θ, it is judged as abnormal data, otherwise, it is normal data:

[0036]

[0037] Among them, label(t) represents the final label at time point t, that is, abnormal or normal.

[0038] This method can promptly detect signs of system failure, external attacks or data corruption, prevent potential losses or damages, and provide an important reference for network maintenance and security protection of wireless sensor networks. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram for generating a feature matrix of the method in the embodiment;

[0040] Figure 2 A training diagram of the method in the embodiment;

[0041] Figure 3 Schematic diagram of the process in the embodiment. DETAILED DESCRIPTION

[0042] The content of the present invention is further described below in conjunction with the drawings and embodiments, but the present invention is not limited thereto.

[0043] Example:

[0044] Reference Figure 3 , a method for detecting anomaly of multivariate sensor time series data based on time series converter, comprising the following steps:

[0045] 1) Feature matrix generation: Figure 1 As shown, given an n-dimensional time series data with a time span of T Each dimension of data Each data point in the time series represents the value of the n-dimensional data at time point t. For time point t, in this example, three time windows w of different lengths are used, w is 5, 10, and 30 respectively. Under each time window w, the data from tw to t in the n-dimensional time series are sent to the Laplace kernel function to generate an n×n feature matrix M t . Slice multivariate time series data in time windows of size w Given two time series data and First, the time window average of the time series data is calculated by formula (1), and then the correlation of the two time series data is calculated by the Laplace kernel function shown in formula (2):

[0046]

[0047]

[0048] in, is the feature matrix M t The element of the i-th row and j-th column of , σ is the bandwidth parameter, which is a positive real number used to control the decay rate of the kernel function. In this example, the data sampling frequency is set to sample once every 5 time points. The characteristic matrix M obtained by calculating the correlation based on the time window size of 3 different lengths t Characterize the system state at different scales, and convert the obtained characteristic matrix M t Concatenate into a tensor Represented as the original feature matrix, the feature matrix formed in this way can model the spatial relationship in the original data well, and the Laplace kernel can map the original feature space to a higher-dimensional space, so that the data that was originally linearly inseparable in the original space becomes linearly separable in the new feature space;

[0049] 2) Using densely connected network DenseNet feature matrix layering: Densely connected network DenseNet is used to extract the spatial information of the feature matrix, and the original feature matrix is ​​divided into 3 layers. Each layer is the output of the corresponding denseblock, which will be used as the input of the next part. In the densely connected network DenseNet, each layer will receive the output of all previous layers as the input of the next layer, so that information and gradients can be directly transmitted from any layer to all subsequent layers, which enhances the propagation of features and reduces the loss of information. In this example, the original feature matrix χ t,0 Pass multiple densely connected layers, assuming that the output of the lth layer at time t is represented by χ t,l-1 , represents the feature matrix of the l-1th layer at time t, then the output of the lth layer is expressed as shown in formula (3):

[0050] χ t,l =H l ([χ t,0 ,x t,1 ,...,χ t,l-1 ]) (3),

[0051] Among them, [χ t,0 ,x t,1 ,...,χ t,l-1 ] represents the tensor of the concatenated 0th, 1st, ..., l-1th layers at time t, H l (.) is a composite function of batch normalization (BN), rectified linear unit (ReLU), pooling, and convolution (Conv). Because for any given arrangement, the generated local pattern can be captured by DenseNet, the exact order of the time series based on which the feature matrix is ​​formed is not important;

[0052] 3) Time series data serialization based on time series converter: The time series converter module converts the time series data into a series of patch vectors and processes these vectors using the time series converter to finally obtain a rich time series feature representation. This process covers multiple stages from local feature extraction to global dependency modeling, enabling the model to effectively capture the dynamic changes and complex relationships in time series data. The feature matrix χ t,l Before passing into the time series converter module, the feature matrix χ of each layer is t,l Push forward ts in sequence, ts is 5 time steps and merge all feature matrices with time steps, so that the feature matrix χ of each layer t,l becomes a feature matrix with time steps Where ts is the time step, n l is the height and width of the feature matrix, c lis the number of channels. By effectively extracting and transforming the feature matrix, the time series converter module can capture the dynamic features in the time series, including:

[0053] 3-1) Patch Embedding: First, the feature matrix of each time step is divided into multiple small patches, and these patches are converted into a series of vector representations. This step not only reduces the computational complexity of the model, but also provides the model with the ability to process time series. The feature matrix of the lth layer with ts time steps at time t is converted into Divide into N l patches, N l for Each patch has the same number of channels c l , the size of patches is P×P, and the vectorized representation of patches is Then a linear transformation is used to map each patch to the new embedding space Where D is the embedding dimension, D is 256, and the linear transformation formula of the feature matrix with time steps is expressed as shown in formula (4):

[0054]

[0055] in, is the embedding matrix, is the bias term;

[0056] 3-2) Positional Embedding: Since the model itself does not have the ability to process sequence order, positional embedding is introduced to provide sequential information between time steps. The positional embedding vector is added to the feature matrix patch embedding vector, which provides the model with the ability to capture dynamic changes in time series. As shown in formula (5), positional embedding adds a learnable vector To provide location information for each patch, where N is the total number of patches, the embedding vector is obtained

[0057]

[0058] 3-3) Time Series Transformer Encoder Processing: The time series transformer encoder has multiple encoder layers, each of which consists of two parts: a multi-head attention mechanism and a feedforward neural network. The input vector The initialization input after position embedding is processed by H layers of time series transformer encoders. Each layer contains a self-attention mechanism and a feedforward network, plus residual connections and layer normalization to improve the stability and efficiency of training. The process is as follows:

[0059] For the μth layer time series transformer encoder input is the output of the μ-1th layer, and the 1st layer input is For the 1st layer to the μth layer, the iterative calculation of each layer is shown in formula (6) and formula (7):

[0060]

[0061]

[0062] Among them, LN represents layer normalization, MHA represents multi-head attention mechanism, FFN represents feedforward neural network, all layers include residual connections, and after H layers, the output can be expressed as

[0063] 4) Feature Matrix Reconstruction: In this example, multiple output sequences serialized by the time series converter are concatenated, merged, and reshaped, and then layer-by-layer deconvolution is used to restore the reconstructed feature matrix with the same dimension as the original feature matrix. This process is crucial for feature understanding and visualization in time series analysis and related application scenarios, as shown below:

[0064] First, multiple output sequences serialized by the time series converter are concatenated and merged as shown in formula (8):

[0065]

[0066] Get the merged sequence Where N=N1+N2+…N l , and then reshape the sequence into a matrix form, as shown in formula (9):

[0067] Z t′ =Reshape(Z t ) (9),

[0068] Among them, Reshape represents the reshaping operation, which changes the merged sequence Z t Without changing the shape of the data, the reshaped matrix is ​​represented as Finally, Z t′ A δ-layer deconvolution layer is used, where δ is 4, and the reconstructed feature matrix with the same dimension as the original feature matrix is ​​restored layer by layer, as shown in formula (10):

[0069] Q δ =f(W δ ⊙q δ-1 +b δ ) (10),

[0070] Among them, the input of the δth layer is the output of the δ-1th layer, and the input Q0 of the 1st layer is Z t′, f(·) represents the Relu activation function, ⊙ represents the deconvolution operation, With b δ ∈d δ is the filter kernel and bias parameter of the δth deconvolution layer. Each layer aims to further amplify the feature matrix and reduce the feature depth until the dimension and number of channels of the original input are restored. After the δth deconvolution layer, the final reconstructed feature matrix is ​​obtained. In this example, the error between the original feature matrix and the reconstructed feature matrix is ​​minimized, and the loss function is shown in formula (11):

[0071]

[0072] in, Use stochastic gradient descent method and Adam optimizer to minimize the above losses and achieve end-to-end training;

[0073] In this example, the model training process adopts step 2) to step 4), such as Figure 2 As shown;

[0074] 5) Anomaly determination: Divide the training data into training set D in a ratio of 4:1 train With the validation set D valid , for the validation set D valid At each time point t, count the abnormal score s(t) at each time point t valid , take the validation set D valid The maximum value of the anomaly score on is used as the threshold θ for anomaly determination, where θ = max{s(t) valid}, for the test set D test At each time point t in , count the abnormal score s(t) at each time point t test , and compared with the threshold θ, when the anomaly score s(t) test When it is greater than the threshold value θ, it is judged as abnormal data, otherwise, it is normal data:

[0075]

[0076] Among them, label(t) represents the final label at time point t, that is, abnormal or normal.

[0077] In this example, the anomaly detection process of multi-sensor time series data based on time series converter is as follows:

[0078] Step 1: Read time series data Data Perform minimum and maximum normalization processing;

[0079] Step 2: Based on the three time window sizes (w = 5, 10, 30), the correlation is calculated according to the Laplace kernel to construct the original feature matrix χ t,0 ;

[0080] Step 3: pass the constructed feature matrix into the initial convolutional layer for preliminary feature extraction;

[0081] Step 4 uses 3 denseblocks and 2 intermediate conversion layers to divide the original feature matrix into 3 layers, and each layer takes the output of denseblock as χ t,1 ,x t,2 ,x t,3 , which will be used as input for the next part;

[0082] Step 5: Push forward ts (ts=5) time steps one by one, concatenate all feature matrices with time steps, and construct a complete feature matrix with time steps.

[0083] Step 6: The feature matrix of the lth layer with time steps at time t Divide into N l patches and map each patch to the new embedding space through linear transformation middle;

[0084] Step 7 Add a learnable vector Pos l To provide position information for each patch, get the embedded sequence

[0085] Step 8 Sequence After being processed by the H-layer time series converter encoder, the output sequence is obtained

[0086] Step 9: Combine the three output sequences of the time series data serialized by the time series converter to get Z t ;

[0087] Step 10: The merged sequence Z t Reshape into matrix Z t′ ;

[0088] Step 11 Matrix Z t′ Through 4 layers of deconvolution layers, the reconstructed feature matrix with the same dimension as the original feature matrix is ​​restored layer by layer.

[0089] Step 12 uses the stochastic gradient descent method and the Adam optimizer to minimize the original feature matrix χ t,0 and reconstruct the feature matrix The mean square error is used for training;

[0090] Step 13: Divide the training data into training set D in a ratio of 4:1 train With the validation set D valid ;

[0091] Step 14 For the validation set D valid At each time point t, count the abnormal score s(t) at each time point t valid , take the validation set D valid The maximum value of the anomaly score on is taken as the threshold θ for anomaly determination;

[0092] Step 15 For the test set D test At each time point t in , count the abnormal score s(t) at each time point t test , and compared with the threshold θ;

[0093] Step 16 When the anomaly score s(t) test When it is greater than the threshold value θ, it is determined to be abnormal data, otherwise, it is normal data.

Claims

1. A method for detecting anomaly in multivariate sensor time series data based on a time series converter, characterized in that: The steps include: 1) Feature matrix generation: Given a time series data with n dimensions and a time span of T Each dimension of data Each data point in the time series represents the value of the n-dimensional data at time point t. For time point t, three time windows w of different lengths are used, w is 5, 10, and 30 respectively. Under each time window w, the data from tw to t in the n-dimensional time series are sent to the Laplace kernel function to generate an n×n feature matrix M t , slices of multivariate time series data in time windows of size w In the example, given two time series data and First, the time window average of the time series data is calculated by formula (1), and then the correlation of the two time series data is calculated by the Laplace kernel function shown in formula (2): in, is the feature matrix M t The element of the i-th row and j-th column of , s is the bandwidth parameter, which is a positive real number. The data sampling frequency is set to sample once every 5 time points. The characteristic matrix M obtained by calculating the correlation based on the time window size of 3 different lengths t Characterize the system state at different scales, and convert the obtained characteristic matrix M t Concatenate into a tensor Represented as the original feature matrix, the Laplacian kernel maps the original feature space into a higher-dimensional space; 2) Using densely connected network feature matrix layering: Using densely connected network to extract spatial information of feature matrix, the original feature matrix is ​​divided into 3 layers, each layer is the output of the corresponding denseblock, which will be used as the input of the next part. In the densely connected network, each layer will receive the output of all previous layers as the input of the next layer. Information and gradients are directly transmitted from any layer to all subsequent layers, and the original feature matrix c t,0 Pass multiple densely connected layers, assuming that the output of the lth layer at time t is represented by c t,l-1 , represents the feature matrix of the l-1th layer at time t, then the output of the lth layer is expressed as shown in formula (3): c t,l =H l ([c t,0 ,c t,1 ,...,c t,l-1 ]) (3), Among them, [c t,0 ,c t,1 ,...,c t,l-1 ] represents the tensor of the concatenated layers 0, 1, L, and l-1 at time t, H l (.) is a composite function of batch normalization, rectified linear unit, pooling, and convolution operations; 3) Time series data serialization based on time series converter: feature matrix c of each layer t,l Before passing into the time series converter module, the feature matrix c of each layer is t,l Push forward ts in sequence, ts is 5 time steps and merge all feature matrices with time steps, so that the feature matrix c of each layer t,l becomes a feature matrix with time steps Where ts is the time step, n l is the height and width of the feature matrix, c l is the number of channels, and the feature matrix is ​​used for feature extraction and transformation to capture the dynamic features in the time series, including: 3-1) Feature Matrix Patch Embedding: First, the feature matrix of each time step is divided into multiple small patches, and these patches are converted into a series of vector representations. The feature matrix of the lth layer at time t with ts time steps is Divide into N l patches, N l for Each patch has the same number of channels c l , the size of patches is P×P, and the vectorized representation of patches is Then a linear transformation is used to map each patch to the new embedding space Where D is the embedding dimension, D is 256, and the linear transformation formula of the feature matrix with time steps is expressed as shown in formula (4): in, is the embedding matrix, is the bias term; 3-2) Position Embedding: The position embedding vector is added to the feature matrix patch embedding vector, which provides the model with the ability to capture dynamic changes in time series. As shown in formula (5), the position embedding adds a learnable vector To provide location information for each patch, where N is the total number of patches, the embedding vector is obtained 3-3) Time Series Transformer Encoder Processing: The time series transformer encoder has multiple encoder layers, each of which consists of two parts: a multi-head attention mechanism and a feedforward neural network. The input vector The initialization input after position embedding is processed by H layers of time series transformer encoders. Each layer contains a self-attention mechanism and a feedforward network, plus residual connections and layer normalization. The process is as follows: For the μth layer time series transformer encoder input is the output of the m-1th layer, the 1st layer input is For the 1st layer to the μth layer, the iterative calculation of each layer is shown in formula (6) and formula (7): Among them, LN represents layer normalization, MHA represents multi-head attention mechanism, FFN represents feedforward neural network, all layers include residual connections, and after H layers, the output is expressed as 4) Feature matrix reconstruction: Multiple output sequences serialized by the time series converter are concatenated, merged, and reshaped, and then layer-by-layer deconvolution is used to restore the reconstructed feature matrix with the same dimension as the original feature matrix. This process is as follows: First, multiple output sequences serialized by the time series converter are concatenated and merged as shown in formula (8): Get the merged sequence Where N=N1+N2+…N l , and then reshape the sequence into a matrix form, as shown in formula (9): Z t′ =Reshape(Z t ) (9), Among them, Reshape represents the reshaping operation, which changes the merged sequence Z t Without changing the shape of the data, the reshaped matrix is ​​represented as Finally, Z t′ A δ-layer deconvolution layer is used, where δ is 4, and the reconstructed feature matrix with the same dimension as the original feature matrix is ​​restored layer by layer, as shown in formula (10): Q δ =f(W δ ⊙q δ-1 +b δ ) (10), Among them, the input of the δth layer is the output of the δ-1th layer, and the input Q0 of the 1st layer is Z t′ , f(·) represents the Relu activation function, ⊙ represents the inverse convolution operation, With b δ ∈d δ is the filter kernel and bias parameter of the δth deconvolution layer. Each layer further amplifies the feature matrix and reduces the feature depth until the dimension and number of channels of the original input are restored. After the δth deconvolution layer, the final reconstructed feature matrix is ​​obtained. In order to minimize the error between the original feature matrix and the reconstructed feature matrix, the loss function is shown in formula (11): in, Use stochastic gradient descent method and Adam optimizer to achieve end-to-end training; 5) Anomaly determination: Divide the training data into training set D in a ratio of 4:1 train With the validation set D valid , for the validation set D valid At each time point t, count the abnormal score s(t) at each time point t valid , take the validation set D valid The maximum value of the anomaly score on is used as the threshold θ for anomaly determination, where θ = max{s(t) valid }, for the test set D test At each time point t in , count the abnormal score s(t) at each time point t test , and compared with the threshold θ, when the anomaly score s(t) test When it is greater than the threshold value θ, it is judged as abnormal data, otherwise, it is normal data: Among them, label(t) represents the final label at time point t, that is, abnormal or normal.

Citation Information

Patent Citations

  • ADS-B message anomaly detector and detection method

    CN113468703A

  • Unsupervised learning battery production process abnormal fluctuation detection method

    CN114648076A

  • Differential time sequence reconstruction spacecraft anomaly detection method based on auto-encoder and model construction method

    CN117574219A

  • Unusual Insider Behavior Detection Framework on Enterprise Resource Planning Systems using Adversarial Recurrent Auto-encoder

    KR102307632B1

Cited By

  • Standard value prediction method, error monitoring method and device of current transformer

    CN119128440A

  • Power ciphertext data anomaly detection method and system based on function encryption

    CN119249460A

  • Urban multi-category security risk early warning method and system based on federated super network

    CN119250545A

  • Abnormality detection method and device based on adaptive multi-scale feature modeling

    CN119939476A

  • Anomaly detection method and device based on adaptive multi-scale feature modeling

    CN119939476B