Multivariable time sequence anomaly detection method and device based on multi-scale adaptive double attention mechanism
The time series anomaly detection method based on a multi-scale adaptive dual attention mechanism dynamically allocates weights and combines them with a dual-path attention module, which solves the problems of insufficient feature extraction and poor anomaly recognition ability of traditional methods on high-dimensional data, and achieves more accurate anomaly detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-03-10
AI Technical Summary
Existing time series anomaly detection methods struggle to adaptively capture time series patterns at different scales when processing high-dimensional data, and they also have difficulty simultaneously and efficiently modeling local correlations within segments and global dependencies between segments, resulting in insufficient feature extraction and poor anomaly recognition capabilities.
A multi-scale adaptive dual attention mechanism is adopted, which dynamically allocates weights through an adaptive temporal sampler, captures global and local dependencies by combining a dual-path attention module, and uses an anomaly scoring system that combines sparsity processing and reconstruction error to achieve cross-scale feature fusion.
It improves the model's generalization ability, accurately portrays normal patterns, reduces false positives and false negatives, and enhances the overall performance of anomaly detection.
Smart Images

Figure CN121637352A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of multivariate time series anomaly detection, and particularly relates to a multivariate time series anomaly detection method and device based on a multi-scale adaptive double attention mechanism. BACKGROUND
[0002] Industrial equipment, network systems and the like generate massive amounts of multivariate time series data. Anomaly detection on these data is a key task to ensure system stability and predict equipment failure, and has great engineering value.
[0003] At present, time series anomaly detection methods are mainly divided into traditional statistical methods and deep learning-based methods. Traditional methods are difficult to capture complex nonlinear dynamics in data and perform poorly on high-dimensional data. Although deep learning-based methods have improved, they still have significant limitations: on the one hand, most existing models use fixed-size windows to process sequences, which cannot adaptively capture time series patterns at different scales (such as short-term fluctuations and long-term trends), resulting in insufficient feature extraction; on the other hand, after segmenting the sequence, the model is difficult to efficiently model both the local correlation within the segment and the global dependence between segments, limiting the recognition ability of complex anomalies. Therefore, how to cooperatively model multi-scale features and global-local dependence is a key technical challenge to improve anomaly detection performance. SUMMARY
[0004] The purpose of the application is to provide a multivariate time series anomaly detection method and device based on a multi-scale adaptive double attention mechanism, to solve the problems of insufficient feature extraction and poor anomaly recognition ability of existing time series anomaly detection methods.
[0005] To achieve the above purpose, the technical solution of the application is:
[0006] In a first aspect, the application provides a multivariate time series anomaly detection method based on a multi-scale adaptive double attention mechanism, comprising the following steps:
[0007] Obtain the original data of the multivariate time series, segment the original data based on a preset adaptive time sampler, dynamically allocate weights to different scales, output the weight distribution corresponding to the scale segmentation, and obtain the sparse weight distribution of each scale segment by sparse processing the weight distribution;
[0008] The global temporal pattern weight, the local temporal pattern weight, the global temporal pattern representation and the local temporal pattern representation of each scale segment are obtained through the double-path attention module, the activation scale of each sparse weight distribution is weighted and fused based on the global temporal pattern weight, the local temporal pattern weight, the global temporal pattern representation and the local temporal pattern representation, and the final global temporal pattern weight, the final local temporal pattern weight, the final global temporal pattern representation and the final local temporal pattern representation across the scale segments are output.
[0009] The similarity difference of the final global temporal pattern weight and the final local temporal pattern weight is calculated, the reconstructed time sequence is obtained based on the final global temporal pattern representation and the final local temporal pattern representation, the reconstruction error between the reconstructed time sequence and the original data is calculated, and the final anomaly score is calculated based on the similarity difference and the reconstruction error.
[0010] The final anomaly score is compared with a preset anomaly threshold, and an anomaly detection result is output according to a comparison result.
[0011] The process of dynamically allocating weights to different scale segments by the preset adaptive time sampler includes: performing adaptive temporal decomposition on the original data to output periodic components and trend components of the original data, integrating the original data, the periodic components and the trend components to obtain temporal fusion features, and dynamically obtaining the weight distribution of the original data in different scale segments based on the temporal fusion features and a preset weight generation function, wherein the calculation formula of the weight distribution is:
[0012]
[0013] wherein G is the weight distribution, and is a learnable projection matrix, is a random disturbance term subject to standard normal distribution, Softmax and Softplus are activation functions, is the temporal fusion feature.
[0014] The sparse processing process includes: using a top-k operator to sparsify the weight distribution, only keeping the top-k values with the highest weights, and setting the rest to zero to obtain a sparse weight distribution, and the scales corresponding to the top-k values with the highest weights are the activation scales.
[0015] The process of obtaining the global temporal pattern weight, the local temporal pattern weight, the global temporal pattern representation and the local temporal pattern representation of each scale segment through the double-path attention module includes:
[0016] The original data is reshaped into fragments of a certain activation scale, wherein N is the number of segments, W is the window size of the original data, and S is the scale of the specific activated segment;
[0017] The data view of the original data is adjusted to be in units of segments, the correlation between the N segments is calculated through a dual-path attention mechanism, a global correlation matrix across segments is obtained, and the global correlation matrix is up-sampled to obtain global temporal pattern weights;
[0018] The data view of the original data is adjusted to be in units of time points within a segment, the correlation between the S time points is calculated through a dual-path attention mechanism, a local correlation matrix across segments is obtained, and the local correlation matrix is up-sampled to obtain local temporal pattern weights;
[0019] The global correlation matrix, the local correlation matrix, and the value vector of the original data are cross-attention calculated to obtain global temporal pattern representation and local temporal pattern representation.
[0020] The calculation formulas of the final global temporal pattern weights, the final local temporal pattern weights, the final global temporal pattern representation, and the final local temporal pattern representation of the cross-scale segmentation are as follows:
[0021]
[0022]
[0023] wherein, are the final global temporal pattern weights and the final local temporal pattern weights, respectively, are the final global temporal pattern representation and the final local temporal pattern representation, respectively, , , , represent the global temporal pattern weights, the local temporal pattern weights, the global temporal pattern representation, and the local temporal pattern representation at the i-th scale, respectively, is a sparse weight distribution, and M is the number of segments for scaling the original data.
[0024] The calculation method of the similarity difference is as follows: the Jensen-Shannon divergence is used to quantify the distribution difference of the row vector corresponding to each time point in the final global temporal pattern weights and the final local temporal pattern weights, to obtain a similarity difference score, and the calculation formula of the similarity difference score is as follows:
[0025]
[0026] wherein, is the similarity difference score, represents the Jensen-Shannon divergence, represents a gradient stop operation.
[0027] The reconstruction error is a mean square error between the original data and a reconstruction time series obtained by inputting the final global time series pattern representation and the final local time series pattern representation into a preset decoder.
[0028] The final anomaly score is calculated according to the following formula:
[0029]
[0030] wherein, is the final anomaly score, denotes element-wise multiplication, is a similarity difference score, O is a reconstruction time series, and X is original data, denotes a reconstruction error.
[0031] The scale of each segment of the scale segmentation of the original data is different.
[0032] In a second aspect, the present application provides a kind of multivariate time series anomaly detection device based on multi-scale adaptive double attention mechanism, the device is used to realize the steps of the above method, the device includes:
[0033] A data acquisition module is configured to obtain original data of a multivariate time series to be detected.
[0034] A data segmentation module is configured to divide the original data into multiple time segments of different scales by dynamically generating a multi-scale segmentation scheme through an adaptive time sampler according to periodicity and trend characteristics of the original data.
[0035] A feature extraction module is configured to extract global time series pattern weights, local time series pattern weights, global time series pattern representations and local time series pattern representations by modeling global dependencies across segments and local dependencies within segments in each scale through a double-path attention mechanism.
[0036] A feature fusion module is configured to generate final global time series pattern weights, final local time series pattern weights, final global time series pattern representations and final local time series pattern representations across scales by weighted aggregation of the global time series pattern weights, local time series pattern weights, global time series pattern representations and local time series pattern representations extracted in multiple scales.
[0037] An anomaly calculation module is configured to calculate a final anomaly score by combining a similarity difference of the final global time series pattern weights and the final local time series pattern weights across scales and a reconstruction error between reconstruction data and original data based on the final global time series pattern representations and the final local time series pattern representations.
[0038] An output module configured to determine the anomaly score according to a preset threshold and output an anomaly detection result.
[0039] The method of the present application can dynamically select the optimal analysis scale combination according to the internal characteristics of different data through the adaptive time sampler, avoid the limitations of traditional fixed scale analysis, and improve the generalization ability of the model. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 is a multivariate time series anomaly detection method flow chart based on a multi-scale adaptive double attention mechanism provided by an embodiment of the present application;
[0041] Figure 2 is a general framework diagram of a multivariate time series anomaly detection method based on a multi-scale adaptive double attention mechanism provided by an embodiment of the present application;
[0042] Figure 3 is a structure schematic diagram of an adaptive time sampler in an embodiment of the present application;
[0043] Figure 4 is a schematic diagram of a multi-scale segmentation process in an embodiment of the present application;
[0044] Figure 5 is a structure schematic diagram of a double-path attention module in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The technical solutions of the present application will be described in detail below with reference to the drawings and specific embodiments. It should be understood that the specific features in the embodiments and the specific embodiments of the present application are detailed descriptions of the technical solutions of the present application, and are not limitations of the technical solutions of the present application. In the case of no conflict, the technical features in the embodiments and the specific embodiments can be combined with each other.
[0046] Embodiment 1
[0047] Reference Figures 1 to 5 As shown in the figure, a multivariate time series anomaly detection method based on a multi-scale adaptive double attention mechanism includes the following steps:
[0048] Step S1, obtaining original data of a multivariate time series, performing scale segmentation on the original data based on a preset adaptive time sampler, dynamically allocating weights to different scales, outputting a weight distribution corresponding to the scale segmentation, and performing sparse processing on the weight distribution to obtain a sparse weight distribution of each scale segmentation;
[0049] In this embodiment, multivariate time series original data from sensors, server nodes or Internet of Things devices is obtained , where W is the length of a sliding time window, and d is the number of variables (dimensions). According to the internal mode of the input original data, such as periodicity and trend, an adaptive time sampler is used to dynamically allocate weights to different segmented scale data, and an optimal multi-scale segmentation scheme is generated.
[0050] The original data is adaptively decomposed in time sequence, and the periodic component and the trend component of the original data are output. The original data, the periodic component and the trend component are integrated to obtain time sequence fusion features. Based on the time sequence fusion features and a preset weight generation function, the weight distribution of the original data in several scale segments is dynamically obtained.
[0051] The specific implementation process of the adaptive time sampler includes: reconstructing the periodic component by extracting the dominant frequency component through discrete Fourier transform of the original data , applying multi-core average pooling and adaptive weighting to the time series data obtained by deseasonalizing the original data to obtain the trend component , integrating the original data, the periodic component and the trend component, and obtaining the time sequence fusion features through a linear layer .
[0052] The time sequence fusion features are input into a preset weight generation function, and the calculation formula of the weight distribution G for M different segmented scales is calculated as follows:
[0053]
[0054] wherein, and are learnable projection matrices, is a random disturbance term subject to a standard normal distribution. Random noise can enhance the exploration ability of the model and avoid falling into local optimum. Softmax and Softplus are activation functions.
[0055] The top-k operator is used to perform sparse processing on the weight distribution, and only the top k values are retained, i.e. the k active scales, and the remaining items are set to zero, to obtain a sparse weight distribution .
[0056] Step S2, obtain the global timing pattern weight, the local timing pattern weight, the global timing pattern representation and the local timing pattern representation of each scale segment through the double-path attention module, weight and fuse the activation scale of each sparse weight distribution based on the global timing pattern weight, the local timing pattern weight, the global timing pattern representation and the local timing pattern representation, and output the final global timing pattern weight, the final local timing pattern weight, the final global timing pattern representation and the final local timing pattern representation of the cross-scale segment;
[0057] For any activated specific scale S, the original data X is reshaped into N segments with a length of S, .
[0058] Before inputting the segment set into the double-path attention module, we use the channel independent strategy for processing. By fusing the feature dimension and the batch dimension, the input size is converted to for inter-segment attention, for intra-segment attention.
[0059] The operation steps of the double-path attention module include:
[0060] The multi-head self-attention mechanism is used to capture global and local dependencies in parallel. For each scale, two types of attention are calculated, including: inter-segment attention and intra-segment attention.
[0061] Inter-segment attention aims to model the global long-term dependency between different time segments. First, the input is embedded to obtain and the query matrix (Q) and the key matrix (K) are used to calculate the global time dependency through the scaled dot-product attention:
[0062]
[0063]
[0064] wherein, is the number of heads, and represent the learnable parameter matrix of and respectively, the function normalizes the weight and connects the multi-head output together to form the global association matrix .
[0065] Intra-segment attention represents local time pattern features by establishing associations between points within each segment. Similar to the processing method of inter-segment attention, first, the input is embedded to obtain , the local relational matrix is calculated by scaled dot-product attention:
[0066]
[0067]
[0068] where, is the number of heads, and are the learnable parameter matrices for and respectively, the function normalizes the weights and concatenates the multi-head outputs to form the local relational matrix .
[0069] The global relational matrix is up-sampled to obtain the global temporal pattern weight , and the local relational matrix is up-sampled to obtain the local temporal pattern weight :
[0070]
[0071] The global temporal pattern weight , the local temporal pattern weight , and the value vector of the original data are cross-attention calculated to obtain the global temporal pattern representation and the local temporal pattern representation :
[0072]
[0073]
[0074]
[0075] where is the value matrix, and represent the inter-segment and intra-segment temporal pattern representations obtained after embedding and linear projection of X.
[0076] Cross-scale feature synthesis is performed, for each activated scale, the process of the double-path attention module is performed in parallel, while capturing the global temporal dependency and local temporal dependency of each activated scale, and the global temporal feature and the local temporal feature are weighted and summed to obtain the final global temporal pattern representation and the final local temporal pattern representation across scales, and the specific calculation formula is:
[0077]
[0078]
[0079] respectively are final global temporal pattern weights and final local temporal pattern weights, respectively are final global temporal pattern representation and final local temporal pattern representation, 、 、 、 respectively represent global temporal pattern weights, local temporal pattern weights, global temporal pattern representation and local temporal pattern representation under the i-th scale.
[0080] Step S3, calculate the similarity difference of the final global temporal pattern weights and the final local temporal pattern weights, output the similarity difference score; input the final global temporal pattern representation and the final local temporal pattern into a preset encoder for reconstruction processing to obtain a reconstructed time series, calculate the reconstruction error between the reconstructed time series and the original data of the multivariate time series, and calculate the final anomaly score of the multivariate time series based on the similarity difference score and the reconstruction error;
[0081] Normal time points should present similar patterns under global and local perspectives, while abnormal points produce greater differences. The Jensen-Shannon (JS) divergence is used to quantify the distribution difference of the row vector corresponding to each time point in the final global temporal pattern weights and the final local temporal pattern weights, to obtain the similarity difference score. The specific calculation formula is:
[0082]
[0083]
[0084] wherein, is the similarity difference score, represents the Jensen-Shannon divergence, represents the gradient stop operation.
[0085] Input the final global temporal pattern representation and the final local temporal pattern representation into the decoder to reconstruct the time series, calculate the mean square error between the original data and the reconstructed time series, i.e. the reconstruction error, and perform element-by-element multiplication according to the similarity difference score and the reconstruction error to obtain the final anomaly score of each time point. The calculation formula is:
[0086]
[0087] wherein, is the final anomaly score, represents element-by-element multiplication, O is the reconstructed time series, represents the reconstruction error.
[0088] Step S4, compare the final anomaly score with the preset anomaly threshold, and output an anomaly detection result according to the comparison result.
[0089] If the final anomaly score is higher than the preset anomaly threshold, the corresponding time point is marked as abnormal, otherwise it is marked as normal.
[0090] Embodiment 2
[0091] A multivariate time series anomaly detection device based on a multi-scale adaptive double attention mechanism, comprising:
[0092] A data acquisition module for acquiring original data of a multivariate time series to be detected;
[0093] A data segmentation module for dynamically generating a multi-scale segmentation scheme through an adaptive time sampler according to the periodicity and trend characteristics of the original data, and dividing the original data into multiple time segments of different scales;
[0094] A feature extraction module for modeling global dependence across segments and local dependence within segments in each scale through a double-path attention mechanism, respectively, to extract global time series pattern weights, local time series pattern weights, global time series pattern representations, and local time series pattern representations;
[0095] A feature fusion module for weighting and aggregating the global time series pattern weights, local time series pattern weights, global time series pattern representations, and local time series pattern representations extracted under multiple scales to generate cross-scale final global time series pattern weights, final local time series pattern weights, final global time series pattern representations, and final local time series pattern representations;
[0096] An anomaly calculation module for calculating a final anomaly score by combining the similarity difference between the cross-scale final global time series pattern weights and final local time series pattern weights, and the reconstruction error between the reconstructed data based on the final global time series pattern representations and final local time series pattern representations and the original data;
[0097] A result output module for judging the anomaly score according to a preset threshold and outputting an anomaly detection result.
[0098] In summary, the multivariate time series anomaly detection method based on the multi-scale adaptive double attention mechanism of the present application can effectively solve the problem of multivariate time series anomaly detection, and has the advantages of strong adaptability, comprehensive feature capture, and high detection accuracy.
[0099] 1) Strong adaptability: through the adaptive time sampler, the model can dynamically select the optimal analysis scale combination according to the internal characteristics (such as period, trend) of different data, avoiding the limitations of traditional fixed scale analysis and improving the generalization ability of the model;
[0100] 2) Feature capture comprehensiveness: the designed dual-path attention mechanism can capture the dependence of time series from both global and local dimensions simultaneously, neither missing long-range correlations nor ignoring local mutations, making the characterization of normal patterns more accurate and the identification of anomalies more sensitive;
[0101] 3) High detection accuracy: by combining the "pattern similarity difference" and "reconstruction error" two criteria, a more robust anomaly scoring system is constructed; normal data points behave consistently in both views, while abnormal points will produce significant deviations in both dimensions, effectively reducing the false positive and false negative rates and improving the overall detection effect.
[0102] Those skilled in the art will understand that embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0103] The present application is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0104] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction system that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0105] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are generated to realize the computer-implemented processes, and the instructions executed on the computer or other programmable devices provide a process for implementing the functions specified in the flowchart Figure 1 one flow or multiple flows and / or the functions specified in the block Figure 1 one flow or multiple flows and / or the functions specified in the block
[0106] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the specific embodiments described above, and the specific embodiments described above are merely illustrative, but not restrictive, and those of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims, which are all within the protection of the present application.
Claims
1. A multivariate time series anomaly detection method based on a multi-scale adaptive dual attention mechanism, characterized in that, The method comprises the following steps: obtaining original data of a multivariate time series, performing scale segmentation on the original data based on a preset adaptive time sampler, dynamically allocating weights to different scales, outputting a weight distribution corresponding to the scale segmentation, and performing sparse processing on the weight distribution to obtain a sparse weight distribution of each scale segmentation; obtaining global time sequence pattern weights, local time sequence pattern weights, global time sequence pattern representations and local time sequence pattern representations of each scale segmentation through a double-path attention module, performing weighted fusion on the activation scale of each sparse weight distribution based on the global time sequence pattern weights, the local time sequence pattern weights, the global time sequence pattern representations and the local time sequence pattern representations, and outputting final global time sequence pattern weights, final local time sequence pattern weights, final global time sequence pattern representations and final local time sequence pattern representations across scale segmentations; calculating the similarity difference between the final global time sequence pattern weights and the final local time sequence pattern weights; obtaining a reconstructed time sequence based on the final global time sequence pattern representations and the final local time sequence pattern representations, calculating a reconstruction error between the reconstructed time sequence and the original data, and calculating a final anomaly score based on the similarity difference and the reconstruction error; comparing the final anomaly score with a preset anomaly threshold, and outputting an anomaly detection result according to the comparison result.
2. The method of claim 1, wherein the method is based on a multi-scale adaptive dual attention mechanism. The process of dynamically allocating weights to different scale segmentations by the preset adaptive time sampler comprises: performing adaptive time decomposition on the original data, outputting periodic components and trend components of the original data, integrating the original data, the periodic components and the trend components to obtain time fusion features, and dynamically obtaining the weight distribution of the original data at different scale segmentations based on the time fusion features and a preset weight generation function, wherein the calculation formula of the weight distribution is: where G is a weight distribution, and is a learnable projection matrix, is a random disturbance term subject to a standard normal distribution, Softmax and Softplus are activation functions, is a time sequence fusion feature.
3. The method of claim 1, wherein the method is based on a multi-scale adaptive dual attention mechanism. The sparse processing process comprises: using a top-k operator to sparsify the weight distribution, retaining only the top-k values with the highest weights, and setting the remaining items to zero to obtain a sparse weight distribution, wherein the scales corresponding to the top-k values with the highest weights are the activation scales.
4. The method of claim 1, wherein, The process of obtaining the global time sequence pattern weights, the local time sequence pattern weights, the global time sequence pattern representations and the local time sequence pattern representations of each scale segmentation through the double-path attention module comprises: reshaping the original data into a plurality of segments of a specific activation scale, wherein N is the number of segments, W is the window size of the original data, and S is the scale of the specific activation segment. adjusting the data view of the original data to be in units of segments, calculating the relevance between N segments through a double-path attention mechanism to obtain a global correlation matrix across segments, and upsampling the global correlation matrix to obtain the global time sequence pattern weights; adjusting the data view of the original data to be in units of time points within a segment, calculating the relevance between S time points through a double-path attention mechanism to obtain a local correlation matrix across segments, and upsampling the local correlation matrix to obtain the local time sequence pattern weights; performing cross-attention calculation on the global correlation matrix, the local correlation matrix and the value vector of the original data to obtain the global time sequence pattern representations and the local time sequence pattern representations.
5. The method of claim 1, wherein, The calculation formulae of the final global time sequence pattern weights, the final local time sequence pattern weights, the final global time sequence pattern representations and the final local time sequence pattern representations across scale segmentations are: wherein, are a final global temporal pattern weight and a final local temporal pattern weight, respectively, are a final global temporal pattern representation and a final local temporal pattern representation, respectively, represent a global temporal pattern weight, a local temporal pattern weight, a global temporal pattern representation and a local temporal pattern representation at the i-th scale, respectively, is a sparse weight distribution, and M is a number of segments for segmenting the original data into scales. 6. The method of claim 1, wherein, The similarity difference is calculated by using the Jensen-Shannon divergence to quantify the distribution difference of the row vector corresponding to each time point in the final global time series pattern weight and the final local time series pattern weight, to obtain a similarity difference score, and the calculation formula of the similarity difference score is: wherein, is a similarity difference score, denotes a Jensen-Shannon divergence, denotes a gradient stop operation.
7. The method of claim 1, wherein, The reconstruction error is the mean square error between the original data and the reconstructed time series, and the reconstructed time series is obtained by inputting the final global time series pattern representation and the final local time series pattern representation into a preset decoder.
8. The method of claim 1, wherein, The calculation formula of the final anomaly score is: wherein, is the final anomaly score, denotes element-wise multiplication, is the similarity difference score, O is the reconstructed time series, X is the original data, denotes the reconstruction error.
9. The method of claim 1, wherein, The scales of each segment of the original data are different.
10. A multivariate time series anomaly detection device based on a multi-scale adaptive dual attention mechanism, characterized in that, The device is used to implement the steps of the method of any one of claims 1 to 9, and the device comprises: a data acquisition module configured to acquire original data of a multivariate time series to be detected; a data segmentation module configured to divide the original data into multiple time segments of different scales by dynamically generating a multiscale segmentation scheme through an adaptive time sampler according to the periodicity and trend characteristics of the original data; a feature extraction module configured to extract a global time series pattern weight, a local time series pattern weight, a global time series pattern representation, and a local time series pattern representation by modeling global dependencies across segments and local dependencies within segments in each scale through a dual-path attention mechanism; a feature fusion module configured to aggregate the global time series pattern weight, the local time series pattern weight, the global time series pattern representation, and the local time series pattern representation extracted under multiple scales by weighting, to generate a final global time series pattern weight, a final local time series pattern weight, a final global time series pattern representation, and a final local time series pattern representation across scales; an anomaly calculation module configured to calculate a final anomaly score by combining the similarity difference of the final global time series pattern weight and the final local time series pattern weight across scales, and the reconstruction error between the reconstructed data based on the final global time series pattern representation and the final local time series pattern representation and the original data; a result output module configured to judge the anomaly score according to a preset threshold, and output an anomaly detection result. a result output module configured to judge the anomaly score according to a preset threshold, and output an anomaly detection result.