Method and device for analyzing time sequence data and electronic equipment

By using the learnable mask matrix, max pooling layer and cross-scale attention calculation mechanism in the Transformer model to process multi-variable time series data, the problem of difficulty in capturing different time scale features in the existing technology is solved, and the prediction output is significantly improved. accuracy.

CN118656591APending Publication Date: 2024-09-17BINZHOU WEIQIAO NATIONAL SCIENCE & TECHNOLOGY ADVANCED TECHNOLOGY RESEARCH INSTITUTE +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410839645.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

When analyzing multi-variable time series data, it is difficult for existing technologies to accurately capture key features on different time scales, resulting in low accuracy of prediction output.

Method used

A learnable mask matrix is ​​used to adjust the contribution value of the time series data, combined with the maximum pooling layer to extract key features of different time scales, and the projection results are processed through a cross-scale attention calculation mechanism to generate an initial prediction output for the initial time series data. And perform inverse normalization to obtain the target prediction output.

Benefits of technology

It effectively suppresses noise and outliers, captures short-term fluctuations and long-term trends on different time scales, and improves the accuracy of prediction output of multi-variable time series data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656591A
    Figure CN118656591A
Patent Text Reader

Abstract

The invention relates to the technical field of time sequence analysis, and discloses a method and device for analyzing time sequence data and electronic equipment. The method comprises the steps that a learnable mask matrix is adopted, contribution values of all points in all channels of initial time series data are adjusted, and first time series data are obtained; wherein the initial time series data is multivariable time series data after local instance normalization processing; extracting key features of different time scales in the first time sequence data by adopting a maximum pooling layer, and splicing the key features with the first time sequence data to obtain second time sequence data; performing projection processing on the second time sequence data to obtain a projection result, and processing the projection result by adopting a cross-scale attention calculation mechanism to obtain initial prediction output for the initial time sequence data; and performing local instance inverse normalization processing on the initial prediction output to obtain target prediction output. The accuracy of analyzing the multivariable time sequence data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of time series analysis, for example, to a method and device, and electronic equipment for analyzing time series data. Background Art

[0002] By analyzing time series data, we can predict the situation in the future, for example, financial market forecasts, weather trend forecasts, and energy consumption forecasts. Currently, time series data is usually analyzed through the Transformer model, but the Transformer model has certain limitations and the prediction output is less accurate.

[0003] In the related art, in order to improve the accuracy of the prediction output obtained by analyzing time series data, the Independent Channel (IC) method is applied to the Transformer model. This method can independently process each channel in the time series data (such as temperature, humidity, wind speed, etc.), and can reverse the dimension of the input time series data by transposing the data, so that the attention mechanism of the Transformer model shifts from focusing on the dimension of the original variable to focusing on the dimension of the sequence, which helps the Transformer model to effectively learn the local features of the time series data and improve the accuracy of the prediction output.

[0004] However, when analyzing multivariate time series data, the solutions of the related art may ignore key features at different time scales, thereby affecting the prediction performance of the Transformer model. Therefore, when analyzing multivariate time series data, the accuracy of the prediction output obtained by the solutions of the related art is still low. Therefore, how to improve the accuracy of the prediction output obtained by analyzing multivariate time series data has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0006] The embodiments of the present disclosure provide a method and device for analyzing time series data, and an electronic device, which can improve the accuracy of prediction output obtained by analyzing multivariate time series data.

[0007] In some embodiments, a method for analyzing time series data includes: using a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data; wherein the initial time series data is multivariate time series data after local instance normalization processing; using a maximum pooling layer to extract key features of different time scales in the first time series data, and splicing the key features with the first time series data to obtain second time series data; projecting the second time series data to obtain a projection result, and using a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data; and performing inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0008] Optionally, a learnable mask matrix is ​​used to adjust the contribution value of each point in each channel of the initial time series data to obtain the first time series data, including: flipping the initial time series data into third time series data; performing element-wise multiplication calculation on the third time series data and the learnable mask matrix to obtain the first time series data.

[0009] Optionally, using a maximum pooling layer to extract key features of different time scales in the first time series data includes: performing an i-tree partitioning operation on the first time series data to obtain i branches; wherein, is a set of positive integers; a set of relative extreme values ​​of all branches of each fork tree partition is generated through the maximum pooling layer as the key features of different time scales in the first time series data.

[0010] Optionally, a set of relative extreme values ​​of all branches of each fork tree partition is generated through a maximum pooling layer according to the following formula:

[0011] F i =AdaptiveMaxPooling i (Y,S(i));

[0012] Among them, F i is the set of relative extreme values ​​of all branches of the i-th fork tree partition, Y is the first time series data, S(i)=i×i, is a set of positive integers.

[0013] Optionally, the key feature is concatenated with the first time series data according to the following formula to obtain the second time series data:

[0014] Y′=Concat(F1,F2,…,F i ,Y);

[0015] Among them, Y′ is the second time series data, Fi is the key feature, and Y is the first time series data.

[0016] Optionally, the projection result includes a first projection result and a second projection result, and the projection result is obtained by projecting the second time series data, including: calculating the product of the second time series data and the first set projection matrix as the fourth time series data; calculating the product of the fourth time series data and the second set projection matrix as the first projection result; calculating the product of the first time series data and the second set projection matrix as the second projection result.

[0017] Optionally, a cross-scale attention calculation mechanism is used to process the projection results to obtain an initial prediction output for the initial time series data, including: assigning the first projection result to the query item and the value item in the cross-scale attention calculation mechanism, assigning the second projection result to the key value in the cross-scale attention calculation mechanism, performing attention calculation to obtain a prediction result for the initial time series data; projecting the prediction result on a linear projection layer through a GELU activation function to obtain an initial prediction output.

[0018] Optionally, perform attention calculation to obtain prediction results for the initial time series data according to the following formula:

[0019]

[0020] Among them, Z is the prediction result, Q is the query item, K is the key value, V is the value item, and d k is the dimension of K.

[0021] In some embodiments, a device for analyzing time series data includes: an adjustment module, configured to use a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data; wherein the initial time series data is multivariate time series data after normalization; a feature extraction module, configured to use a maximum pooling layer to extract key features of different time scales in the first time series data, and splice the key features with the first time series data to obtain second time series data; a cross-scale attention calculation module, configured to project the second time series data to obtain a projection result, and use a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data; a data processing module, configured to perform inverse normalization on the initial prediction output to obtain a target prediction output.

[0022] In some embodiments, an apparatus for analyzing time series data includes a processor and a memory storing program instructions, wherein the processor is configured to execute the method for analyzing time series data as described above.

[0023] In some embodiments, an electronic device includes: a device body; and an apparatus for analyzing time series data as described above, installed on the device body.

[0024] The method, device, and electronic device for analyzing time series data provided by the embodiments of the present disclosure can achieve the following technical effects:

[0025] In the disclosed embodiment, the initial time series data is multivariate time series data after local instance normalization processing. Specifically, by adopting a learnable mask matrix and adjusting the contribution value of each point in each channel of the initial time series data, the noise and outliers in each channel can be suppressed. By adopting a maximum pooling layer to extract key features of different time scales in the first time series data, and splicing the key features with the first time series data, the short-term fluctuations and long-term trends in each channel at different time scales can be captured simultaneously. By adopting a cross-scale attention calculation mechanism to process the projection result obtained by projecting the second time series data, the expressiveness of the time series data can be improved and enhanced based on the cross-scale key features, which facilitates the understanding and utilization of key information in the time series data. Therefore, the disclosed embodiment can improve the accuracy of the prediction output obtained by analyzing multivariate time series data.

[0026] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:

[0028] Figure 1 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure;

[0029] Figure 2 is a schematic diagram of a method for analyzing time series data provided by an embodiment of the present disclosure;

[0030] Figure 3 is a schematic diagram of another method for analyzing time series data provided by an embodiment of the present disclosure;

[0031] Figure 4 is a schematic diagram of another method for analyzing time series data provided by an embodiment of the present disclosure;

[0032] Figure 5 is a schematic diagram of another method for analyzing time series data provided by an embodiment of the present disclosure;

[0033] Figure 6is a schematic diagram of a structure of a multi-level analysis model constructed based on the method for analyzing time series data provided by an embodiment of the present disclosure;

[0034] Figure 7 It is a schematic diagram comparing the use of a multi-level analysis model to analyze multivariate time series data and other methods of running time;

[0035] Figure 8 It is a schematic diagram comparing the memory usage of using a multi-level analysis model to analyze multivariate time series data and other methods;

[0036] Fig. 9 is a schematic diagram of a device for analyzing time series data provided by an embodiment of the present disclosure;

[0037] Fig.10 It is a schematic diagram of another device for analyzing time series data provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0038] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.

[0039] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0040] Unless otherwise stated, the term "plurality" means two or more.

[0041] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0042] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0043] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.

[0044] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.

[0045] The electronic device provided by the embodiment of the present disclosure is as follows: Figure 1 As shown, the electronic device 100 includes a device body 110 and an apparatus 900 ( 1000 ) for analyzing time series data.

[0046] Optionally, the device 1000 for analyzing time series data includes a processor, which uses a learnable mask matrix to adjust the contribution value of each point in each channel of the multivariate time series data (i.e., the initial time series data) after local instance normalization to obtain the first time series data. The maximum pooling layer can be used to extract the key features of different time scales in the first time series data, and the key features can be spliced ​​with the first time series data to obtain the second time series data. The second time series data can be projected to obtain a projection result, and the projection result can be processed using a cross-scale attention calculation mechanism to obtain an initial prediction output for the initial time series data. The initial prediction output can be subjected to local instance inverse normalization to obtain a target prediction output.

[0047] Combination Figure 1 The electronic device shown in the figure, the embodiment of the present disclosure provides a method for analyzing time series data, such as Figure 2 As shown, the method includes:

[0048] S201, the processor uses a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data, wherein the initial time series data is multivariate time series data after local instance normalization processing.

[0049] Specifically, since the initial time series data is multivariate time series data after local instance normalization, the initial time series data is in matrix form. A channel of the initial time series data represents a row or a column in the matrix, and a point in the channel represents a data in a row or a column of the matrix.

[0050] Specifically, through research, it is found that one of the reasons why related technical solutions cannot accurately analyze multivariate time series data is that different channels of multivariate time series data usually contain semantic information of different types and densities, which will inevitably lead to noise and outliers, affecting the accuracy of subsequent prediction output. Therefore, it is necessary to first use a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to suppress noise and outliers in each channel.

[0051] Specifically, the learnable mask matrix is ​​a channel-level and point-level adaptive mask matrix, which allows adaptive adjustment of each point in each channel during training. Therefore, the processor can use the learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series.

[0052] It is understandable that because the time series of multivariate time series data are different and the distribution of data in different time periods in the time series is different, the learnable mask matrix cannot directly process the multivariate time series data. Therefore, before using the learnable mask matrix to process the multivariate time series data, it is necessary to perform local instance normalization on the multivariate time series data to obtain standardized initial time series data. In this way, it is convenient to perform subsequent prediction analysis based on the standardized initial time series data.

[0053] Specifically, multivariate time series data are obtained by Indicates, where X is multivariate time series data, L is the total number of time points, and C is the number of channels. represents the set of positive integers, Represents a data space.

[0054] Optionally, local instance normalization is performed on the multivariate time series data, including: the average value μ of each channel c in the multivariate time series data at all time points l is calculated as c ; Subtract the corresponding mean μ from the value of l at each time point c , obtain the standard value of each channel; calculate the standard deviation σ of the standard value on L c , and use the standard deviation σ c The multivariate time series data is scaled to obtain the initial time series data.

[0055] Specifically, the average value μ of each channel c at all time points l in the multivariate time series data is calculated according to the following formula: c :

[0056]

[0057] Here, x is the value at each time point.

[0058] Specifically, the standard deviation σ of the standard value on L is calculated according to the following formula: c :

[0059]

[0060] Among them, x′ l,c is the standard value, ∈ is the set value, which is generally set to 1×10 -5 .

[0061] Specifically, the standard deviation σ is calculated according to the following formula: c Scale the multivariate time series data to obtain the initial time series data:

[0062] X ori =(X-μ c ) / σ c ;

[0063] Among them, X ori is the initial time series data, and X is the multivariate time series data.

[0064] S202, the processor uses a maximum pooling layer to extract key features of different time scales in the first time series data, and concatenates the key features with the first time series data to obtain second time series data.

[0065] Specifically, through research, it is found that the second reason why the solutions of the related art cannot accurately analyze multivariate time series data is that the solutions of the related art cannot clearly define the key features at different time scales. Therefore, in the embodiment of the present disclosure, after obtaining the first time series data, the maximum pooling layer is used to extract the key features of different time scales in the first time series data, and the key features are spliced ​​with the first time series data to obtain the second time series data. In this way, based on the second time series data, short-term fluctuations and long-term trends in each channel at different time scales can be captured simultaneously, which is conducive to improving the accuracy of the prediction output obtained by analyzing the time series data.

[0066] S203, the processor projects the second time series data to obtain a projection result, and uses a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data.

[0067] Specifically, through research, it was found that the third reason why the solutions of the related art cannot accurately analyze multivariate time series data is that the solutions of the related art do not consider the mutual influence between different channels. Therefore, in the embodiment of the present disclosure, after obtaining the second time series data, the second time series data will first be projected to obtain a projection result, and then the projection result will be processed by a cross-attention calculation mechanism to determine the initial prediction output for the initial time series data. In this way, the expressiveness of time series data can be improved and enhanced based on cross-scale key features, and the semantic information of key features at different scales can be fused to facilitate the understanding and utilization of key information in time series data, reduce the mutual influence between different channels, and ensure the accuracy of the initial prediction output obtained.

[0068] S204: The processor performs local instance inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0069] Specifically, since the embodiment of the present disclosure analyzes and processes the multivariate time series data that has been subjected to local instance normalization processing, the time scale parameters of the initial prediction output and the original multivariate time series data are different, which may cause the initial prediction output to be inconsistent with the user's requirements. Therefore, after the initial prediction output is obtained, the initial prediction output is subjected to local instance inverse normalization processing to obtain the final prediction output, that is, the target prediction output.

[0070] Specifically, the initial prediction output is subjected to local instance inverse normalization according to the following formula:

[0071]

[0072] in, is the target prediction output, is the initial prediction output, σ c is the standard value of each channel of the multivariate time series data during the local instance normalization process, μ c It is the average value of each channel at all time points in the multivariate time series data during the local instance normalization process.

[0073] In the embodiment of the present disclosure, by using a learnable mask matrix and adjusting the contribution value of each point in each channel of the initial time series data, noise and outliers in each channel can be suppressed. By using a maximum pooling layer to extract key features of different time scales in the first time series data and splicing the key features with the first time series data, short-term fluctuations and long-term trends in each channel at different time scales can be captured simultaneously. By using a cross-scale attention calculation mechanism to process the projection results obtained by projecting the second time series data, the expressiveness of the time series data can be improved and enhanced based on the cross-scale key features, making it easier to understand and utilize the key information in the time series data. Therefore, the embodiment of the present disclosure can improve the accuracy of the prediction output obtained by analyzing multivariate time series data.

[0074] The present disclosure provides another method for analyzing time series data. Figure 3 As shown, the method includes:

[0075] S301, the processor flips the initial time series data into third time series data, wherein the initial time series data is multivariate time series data after local instance normalization processing.

[0076] Specifically, since multivariate time series data can be obtained through Therefore, the shape of the initial time series data can be regarded as (L, C). The flipping process of the initial time series data is to convert the initial time series data into the third time series data with the shape of (C, L).

[0077] S302: The processor performs element-wise multiplication calculation on the third time series data and the learnable mask matrix to obtain the first time series data.

[0078] Specifically, the shape of the learnable mask matrix is ​​the same as the shape of the third time series data. Therefore, the processor can perform element-level multiplication calculation on the third time series data and the learnable mask matrix.

[0079] Specifically, the element-wise multiplication calculation of the third time series data and the learnable mask matrix is ​​performed according to the following formula:

[0080] Y=X inv ⊙M;

[0081] Among them, Y is the first time series data, X inv is the third time series data, M is the learnable mask matrix, and ⊙ represents element-level multiplication.

[0082] It should be noted that the learnable mask matrix is ​​initially a matrix of all 1s, and its parameters are learnable. After deep learning, the parameters of the learnable mask matrix can be adaptively adjusted according to the time series data to be processed.

[0083] S303, the processor uses a maximum pooling layer to extract key features of different time scales in the first time series data, and concatenates the key features with the first time series data to obtain second time series data.

[0084] S304, the processor projects the second time series data to obtain a projection result, and uses a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data.

[0085] S305: The processor performs local instance inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0086] In the disclosed embodiment, by flipping the initial time series data and performing element-wise multiplication of the flipped data with the learnable mask matrix, noise and outliers in the initial time series data can be suppressed. In this way, the accuracy of the prediction output obtained by subsequent analysis of the initial time series data is improved.

[0087] The present disclosure provides another method for analyzing time series data. Figure 4 As shown, the method includes:

[0088] S401, the processor uses a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data, wherein the initial time series data is multivariate time series data after local instance normalization processing.

[0089] S402: The processor performs an i-ary tree partitioning operation on the first time series data to obtain i branches.

[0090] in, is a set of positive integers;

[0091] Specifically, by performing an i-tree partitioning operation on the first time series data, each time scale can be recursively max-pooled so that each branch of the tree generates a relative extreme value, which is the key feature of each time scale. Therefore, the processor needs to perform an i-tree partitioning operation on the first time series data to obtain i branches.

[0092] S403, the processor generates a set of relative extreme values ​​of all branches of each fork tree partition through a maximum pooling layer as key features of different time scales in the first time series data.

[0093] Specifically, the relative extreme value of each branch obtained by performing the i-tree partitioning operation on the first time series data can represent the key feature of the corresponding i-tree partition (one i-tree partition corresponds to one time scale). Therefore, the set of relative extreme values ​​of all branches of each i-tree partition generated by the maximum pooling layer can be used as the key feature of different time scales in the first time series data.

[0094] Optionally, a set of relative extreme values ​​of all branches of each fork tree partition is generated through a maximum pooling layer according to the following formula:

[0095] F i =AdaptiveMaxPooling i (Y,S(i));

[0096] Among them, F i is the set of relative extreme values ​​of all branches of the i-th fork tree partition, Y is the first time series data, S(i)=i×i, is a set of positive integers.

[0097] S404: The processor concatenates the key feature with the first time series data to obtain second time series data.

[0098] Optionally, the key feature is concatenated with the first time series data according to the following formula to obtain the second time series data:

[0099] Y′=Concat(F1,F2,…,F i ,Y);

[0100] Among them, Y′ is the second time series data, F i is the key feature, and Y is the first time series data.

[0101] S405, the processor projects the second time series data to obtain a projection result, and uses a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data.

[0102] S406: The processor performs local instance inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0103] In the disclosed embodiment, by performing an i-tree partitioning operation on the first time series data and generating a set of relative extreme values ​​of all branches of the i-tree through a maximum pooling layer, key features of different time scales in the first time series data can be extracted. By splicing the key features with the first time series data, the short-term fluctuations and long-term trends in each channel on different time scales can be captured based on the obtained second time series data. This is conducive to improving the accuracy of the prediction output obtained by the subsequent analysis of the second time series data.

[0104] The present disclosure provides another method for analyzing time series data. Figure 5 As shown, the method includes:

[0105] S501, the processor uses a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data, wherein the initial time series data is multivariate time series data after local instance normalization processing.

[0106] S502: The processor uses a maximum pooling layer to extract key features of different time scales in the first time series data, and concatenates the key features with the first time series data to obtain second time series data.

[0107] S503: The processor projects and processes the second time series data to obtain a projection result, wherein the projection result includes a first projection result and a second projection result.

[0108] Optionally, projecting the second time series data to obtain a projection result includes: calculating the product of the second time series data and the first set projection matrix as the fourth time series data; calculating the product of the fourth time series data and the second set projection matrix as the first projection result; calculating the product of the first time series data and the second set projection matrix as the second projection result.

[0109] Specifically, the product of the second time series data and the first set projection matrix is ​​calculated as the fourth time series data according to the following formula:

[0110] Y″=W p Y′;

[0111] Wherein, Y″ is the fourth time series data, Y′ is the second time series data, and W p First set the projection matrix.

[0112] Specifically, the product of the fourth time series data and the second set projection matrix is ​​calculated as the first projection result according to the following formula:

[0113] H′=W v Y″;

[0114] Among them, H′ is the first projection result, W v Set the projection matrix for the second.

[0115] Specifically, the product of the first time series data and the second set projection matrix is ​​calculated as the second projection result according to the following formula:

[0116] H=W v Y;

[0117] Among them, H is the second projection result, W v Set the projection matrix for the second.

[0118] Specifically, the cross-scale attention calculation includes Query (Q), Key (K) and Value (V). During the cross-scale attention calculation, the corresponding elements in Q and K interact with each other and jointly determine the similarity between them. In the process of analyzing the second time series data using the cross-scale attention calculation mechanism, when querying the first time series data based on the second time series data, it is necessary to limit the impact of the first time series data on the second time series data.

[0119] Therefore, the processor needs to project the second time series data and refer to the first time series data during the projection process, so as to limit the influence of the first time series data on the second time series data during the subsequent cross-scale attention calculation.

[0120] S504, the processor assigns the first projection result to the query item and the value item in the cross-scale attention calculation mechanism, assigns the second projection result to the key value in the cross-scale attention calculation mechanism, and performs attention calculation to obtain the prediction result for the initial time series data.

[0121] Specifically, since the first projection result and the second projection result in the embodiment of the present disclosure are obtained by mapping the first time series data and the second time series data to the same space. Therefore, the first projection result is assigned to the query item and the value item in the cross-scale attention calculation mechanism, and the second projection result is assigned to the key value in the cross-scale attention calculation mechanism, and the cross-attention calculation is performed, which can limit the influence of the first time series data on the second time series data. In this way, the accuracy of the obtained prediction result is improved.

[0122] Optionally, perform attention calculation to obtain prediction results for the initial time series data according to the following formula:

[0123]

[0124] Among them, Z is the prediction result, Q is the query item, K is the key value, V is the value item, and d k is the dimension of K.

[0125] S505: The processor projects the prediction result on the linear projection layer through the GELU activation function to obtain an initial prediction output.

[0126] Specifically, since the prediction result is calculated by projecting the projection result obtained by processing the second time series data, after obtaining the prediction result, the prediction result needs to be projected on the linear projection layer through the GELU activation function to obtain the initial prediction output.

[0127] S506: The processor performs local instance inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0128] In the embodiment of the present disclosure, after obtaining the second time series data, the second time series data is projected with reference to the first time series data to obtain a projection result, which includes a first projection result corresponding to the second time series data and a second projection result corresponding to the first time series data. When calculating attention, the first projection result and the second projection result are used. In this way, the influence of the first time series data on the second time series data during the attention calculation is reduced, and the accuracy of the obtained prediction result is improved.

[0129] In some embodiments, the method for analyzing time series data proposed in the embodiments of the present disclosure can be constructed as follows: Figure 6 The multi-level analysis model (CSIformer) shown in the figure includes: input unit (InputProcessor), CTM (ChannelTune Masking) unit, MSPI (Multi-Scale Pyramid Integration) unit, MSAF (Multi-Scale Attention Fusion) unit and output unit (Output Processor).

[0130] Specifically, the input unit is used to perform local instance normalization processing on the multivariate time series data to be analyzed to obtain initial time series data. The CTM unit is used to use a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain the first time series data. The MSPI unit is used to extract key features of different time scales in the first time series data using a maximum pooling layer, and splice the key features with the first time series data to obtain the second time series data. The MSAF unit projects the second time series data to obtain a projection result, and uses a cross-scale attention calculation mechanism to process the projection result to fuse the semantic information at different time scales to obtain an initial prediction output for the initial time series data. The output unit is used to perform local instance denormalization processing on the initial prediction output to obtain a target prediction output.

[0131] Specifically, by constructing the above multi-level analysis model, the target prediction output can be obtained by inputting the multi-variable time series data into the multi-level analysis model, thus simplifying the analysis process of the multi-variable time series data.

[0132] Exemplarily, in order to verify the analysis effect of the multi-level analysis model constructed based on the above-mentioned method for analyzing time series data on multivariate time series data, the embodiment of the present disclosure uses 7 known data sets (including 4 ETT data sets: ETTh1, ETTh2, ETTm1 and ETTm2, as well as Electricity, Traffic, and Weather data sets) to verify the multi-level analysis model.

[0133] Specifically, the disclosed embodiment inputs the above-mentioned 7 data sets into the above-mentioned multi-level analysis model, 4 Transformer-based models, 1 TCN-based model, and 1 linear-based model respectively.

[0134] Specifically, the four Transformer-based models include: Informer, Autoformer, PatchTST and iTransformer.

[0135] Specifically, the TCN-based model is TimesNet.

[0136] Specifically, the linear-based model is DLinear.

[0137] Specifically, MSE (mean square error) and MAE (absolute square error) are used as model evaluation indicators, and the evaluation results are shown in Table 1 below.

[0138] Table 1

[0139]

[0140] It can be seen from Table 1 that the multi-level analysis model achieves the best performance in most cases. This shows that the method for analyzing time series data proposed in the embodiment of the present disclosure can improve the accuracy of the prediction output obtained by analyzing multivariate time series data.

[0141] Exemplarily, the embodiment of the present disclosure also verifies the running time of the multi-level analysis model analysis data, and the results are as follows: Figure 7 shown. Figure 7 The bar graphs on each dataset in the figure correspond to the models CSIformer, DLinear, TimesNet, Autoformer, iTransformer, PatchTST, and Informer from left to right. Figure 7 It can be seen that although the running time of CSIformer may be slightly increased compared with iTransformer, it can still maintain a shorter running time overall.

[0142] Exemplarily, the embodiment of the present disclosure also verifies the memory usage of the analysis data of the multi-level analysis model. The results are as follows: Figure 8 shown. Figure 8 The bar graphs on each dataset in the figure correspond to the models CSIformer, PatchTST, DLinear, Autoformer, iTransformer, TimesNet, and Informer from left to right. Figure 8 It can be seen that CSIformer's memory usage is at a low level in most cases.

[0143] Combination Fig. 9As shown, the embodiment of the present disclosure provides a device 900 for analyzing time series data, including: an adjustment module 901, a feature extraction module 902, a cross-scale attention calculation module 903 and a data processing module 904. The adjustment module 901 is configured to use a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain the first time series data; wherein the initial time series data is the multivariate time series data after local instance normalization processing. The feature extraction module 902 is configured to use a maximum pooling layer to extract key features of different time scales in the first time series data, and splice the key features with the first time series data to obtain the second time series data. The cross-scale attention calculation module 903 is configured to project the second time series data to obtain a projection result, and use a cross-scale attention calculation mechanism to process the projection result to obtain an initial prediction output for the initial time series data. The data processing module 904 is configured to perform local instance inverse normalization processing on the initial prediction output to obtain a target prediction output.

[0144] In the embodiment of the present disclosure, the adjustment module 901 can suppress noise and outliers in each channel by using a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data. The feature extraction module 902 can simultaneously capture short-term fluctuations and long-term trends in each channel at different time scales by using a maximum pooling layer to extract key features of different time scales in the first time series data, and splice the key features with the first time series data. The cross-scale attention calculation module 903 uses a cross-scale attention calculation mechanism to process the projection results obtained by projecting the second time series data, which can improve and enhance the performance of the time series data based on the cross-scale key features, and facilitate the understanding and use of key information in the time series data. Therefore, the device for analyzing time series data proposed in the embodiment of the present disclosure can improve the accuracy of the prediction output obtained by analyzing multivariate time series data.

[0145] In some embodiments, the adjustment module 901 is specifically configured to flip the initial time series data into third time series data; perform element-wise multiplication calculation on the third time series data and the learnable mask matrix to obtain the first time series data.

[0146] In some embodiments, the feature extraction module 902 is specifically configured to perform an i-tree partitioning operation on the first time series data to obtain i branches; wherein, is a set of positive integers; a set of relative extreme values ​​of all branches is generated through the maximum pooling layer as the key features of different time scales in the first time series data.

[0147] In some embodiments, the feature extraction module 902 is specifically configured to generate a set of relative extreme values ​​of all branches through a maximum pooling layer according to the following formula:

[0148] F i =AdaptiveMaxPooling i (Y,S(i));

[0149] Among them, F i is the set of relative extreme values ​​of all branches, Y is the first time series data, S(i)=i×i, is a set of positive integers.

[0150] In some embodiments, the feature extraction module 902 is specifically configured to concatenate the key feature with the first time series data according to the following formula to obtain the second time series data:

[0151] Y′=Concat(F1,F2,…,F i ,Y);

[0152] Among them, Y′ is the second time series data, F i is the key feature, and Y is the first time series data.

[0153] In some embodiments, the cross-scale attention calculation module 903 is specifically configured to calculate the product of the second time series data and the first set projection matrix as the fourth time series data; calculate the product of the fourth time series data and the second set projection matrix as the first projection result; calculate the product of the first time series data and the second set projection matrix as the second projection result.

[0154] In some embodiments, the cross-scale attention calculation module 903 is specifically configured to assign the first projection result to the query item and value item in the cross-scale attention calculation mechanism, assign the second projection result to the key value in the cross-scale attention calculation mechanism, perform attention calculation to obtain the prediction result for the initial time series data; project the prediction result on the linear projection layer through the GELU activation function to obtain the initial prediction output.

[0155] In some embodiments, the cross-scale attention calculation module 903 is specifically configured to perform attention calculation to obtain a prediction result for the initial time series data according to the following formula:

[0156]

[0157] Among them, Z is the prediction result, Q is the query item, K is the key value, V is the value item, and d k is the dimension of K.

[0158] Combination Fig.10 As shown, an embodiment of the present disclosure provides a device 1000 for analyzing time series data, and the device 1000 for analyzing time series data includes: a processor (processor) 1001 and a memory (memory) 1002. Optionally, the device may also include a communication interface (Communication Interface) 1003 and a bus 1004. Among them, the processor 1001, the communication interface 1003, and the memory 1002 can communicate with each other through the bus 1004. The communication interface 1003 can be used for information transmission. The processor 1001 can call the logic instructions in the memory 1002 to execute the method for analyzing time series data of the above embodiment.

[0159] In addition, the logic instructions in the memory 1002 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.

[0160] The memory 1002 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 1001 executes the function application and data processing by running the program instructions / modules stored in the memory 1002, that is, the method for analyzing time series data in the above embodiment is implemented.

[0161] The memory 1002 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 1002 may include a high-speed random access memory and may also include a non-volatile memory.

[0162] Combination Figure 1 As shown, an embodiment of the present disclosure provides an electronic device 100, including: a device body 110 and the above-mentioned device 900 (1000) for analyzing time series data. The device 900 (1000) for analyzing time series data is installed in the device body 110. The installation relationship described here is not limited to placement inside the electronic device 100, but also includes installation connections with other components of the electronic device 100, including but not limited to physical connections, electrical connections or signal transmission connections. It can be understood by those skilled in the art that the device 900 (1000) for analyzing time series data can be adapted to a feasible electronic device 100, thereby realizing other feasible embodiments.

[0163] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the above-mentioned method for analyzing time series data.

[0164] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.

[0165] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0166] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0167] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0168] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A method for analyzing time series data, characterized in that include: A learnable mask matrix is ​​used to adjust the contribution value of each point in each channel of the initial time series data to obtain the first time series data; wherein the initial time series data is the multivariate time series data after local instance normalization processing; A maximum pooling layer is used to extract key features of different time scales in the first time series data, and the key features are concatenated with the first time series data to obtain the second time series data; Projecting the second time series data to obtain a projection result, and processing the projection result using a cross-scale attention calculation mechanism to obtain an initial prediction output for the initial time series data; The initial prediction output is subjected to local instance inverse normalization to obtain the target prediction output.

2. The method according to claim 1, characterized in that The learnable mask matrix is ​​used to adjust the contribution value of each point in each channel of the initial time series data to obtain the first time series data, including: Flip the initial time series data into the third time series data; Perform element-wise multiplication calculation on the third time series data and the learnable mask matrix to obtain the first time series data.

3. The method according to claim 1, characterized in that The maximum pooling layer is used to extract key features of different time scales in the first time series data, including: Perform an i-ary tree partition operation on the first time series data to obtain i branches; wherein, is a set of positive integers; The maximum pooling layer is used to generate a set of relative extreme values ​​of all branches of each fork tree partition as the key features of different time scales in the first time series data.

4. The method according to claim 3, characterized in that According to the following formula, the maximum pooling layer generates a set of relative extreme values ​​of all branches of each fork tree partition: F i =AdaptiveMaxPooling i (Y,S(i)); Among them, F i is the set of relative extreme values ​​of all branches of the i-th fork tree partition, Y is the first time series data, is a set of positive integers.

5. The method according to any one of claims 1 to 4, characterized in that According to the following formula, the key features are concatenated with the first time series data to obtain the second time series data: Y′=Concat(F1,F2,…,F i ,Y); Among them, Y′ is the second time series data, F i is the key feature, and Y is the first time series data.

6. The method according to any one of claims 1 to 4, characterized in that The projection result includes a first projection result and a second projection result. The projection result is obtained by projecting the second time series data, including: Calculate the product of the second time series data and the first set projection matrix as fourth time series data; Calculate the product of the fourth time series data and the second set projection matrix as the first projection result; The product of the first time series data and the second set projection matrix is ​​calculated as a second projection result.

7. The method according to claim 6, characterized in that The projection results are processed using a cross-scale attention calculation mechanism to obtain the initial prediction output for the initial time series data, including: Assigning the first projection result to the query item and the value item in the cross-scale attention calculation mechanism, assigning the second projection result to the key value in the cross-scale attention calculation mechanism, and performing attention calculation to obtain the prediction result for the initial time series data; The prediction results are projected on the linear projection layer through the GELU activation function to obtain the initial prediction output.

8. The method according to claim 7, characterized in that According to the following formula, the attention calculation is performed to obtain the prediction results for the initial time series data: Among them, Z is the prediction result, Q is the query item, K is the key value, V is the value item, and d k is the dimension of K.

9. A device for analyzing time series data, characterized in that: include: An adjustment module is configured to use a learnable mask matrix to adjust the contribution value of each point in each channel of the initial time series data to obtain first time series data; wherein the initial time series data is the multivariate time series data after normalization processing; A feature extraction module is configured to extract key features of different time scales in the first time series data using a maximum pooling layer, and concatenate the key features with the first time series data to obtain second time series data; a cross-scale attention calculation module, configured to project the second time series data to obtain a projection result, and process the projection result using a cross-scale attention calculation mechanism to obtain an initial prediction output for the initial time series data; The data processing module is configured to perform inverse normalization processing on the initial prediction output to obtain the target prediction output.

10. A device for analyzing time series data, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to be able to execute the method for analyzing time series data according to any one of claims 1 to 8.

11. An electronic device, characterized in that: include: Equipment body; The device for analyzing time series data as described in claim 9 or 10 is installed on the device body.

Citation Information

Cited By

  • Data sequence generation method and device, equipment and medium

    CN120932047A

  • Data sequence generation method, apparatus, device, and medium

    CN120932047B