Prediction method and prediction device for time series and electronic equipment
Through the adaptive noise cancellation and two-dimensional patch division methods, combined with the dual attention mechanism, the problems of poor denoising effect and periodic characteristics in the prediction of multivariate time series data are solved, and the accuracy of the prediction results is improved.
Patent Information
- Application Number
- CN202411727575.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-18
AI Technical Summary
When the prior art performs time series prediction based on multivariate time series data, the denoising effect is poor, and the periodic characteristics difference of each channel is ignored, resulting in low accuracy of the prediction results.
By identifying the reference noise data of the multivariate time series data, the adaptive noise cancellation strategy is used for denoising to obtain the target time series data. Then, the dominant cycle of each channel is identified, multiple 2D patches are divided, and the prediction is performed using a dual attention mechanism that aggregates patched attention and full attention.
The denoising effect of multivariate time series data and the accuracy of time series prediction are improved, and the global dependence relationship between different channels and local changes of each channel are comprehensively considered.
Smart Images

Figure CN119646442A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of time series prediction, for example, to a prediction method and prediction device and electronic equipment for time series. Background Art
[0002] Currently, time series forecasting has been widely used in many key fields such as finance, healthcare, and the Internet of Things.
[0003] In the related art, a subsequent time series is usually predicted based on a pre-built prediction model and input time series data.
[0004] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:
[0005] The prediction model in the related art has a poor denoising effect on multivariate time series data when performing time series prediction based on multivariate time series data, and ignores the periodic characteristic differences of each channel in the multivariate time series data, which leads to low accuracy of the obtained time series prediction results. Therefore, when performing subsequent time series prediction based on multivariate time series data, how to improve the accuracy of the obtained time series prediction results has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] 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.
[0007] The embodiments of the present disclosure provide a prediction method and prediction device for time series, and an electronic device, which can improve the accuracy of the obtained time series prediction results when performing subsequent time series prediction based on multivariate time series data.
[0008] In some embodiments, a prediction method for time series includes: processing received multivariate time series data to determine reference noise data corresponding to the multivariate time series data; denoising the multivariate time series according to an adaptive noise elimination strategy based on the reference noise data to obtain target time series data; identifying the dominant period of each channel in the target time series data, and determining multiple two-dimensional patches corresponding to the target time series data based on the dominant period; using a dual attention mechanism that aggregates patch attention and full attention, predicting based on the target time series data and multiple two-dimensional patches, and determining a time series prediction result.
[0009] Optionally, the received multivariate time series data is processed to determine reference noise data corresponding to the multivariate time series data, including: performing a fast Fourier transform on the multivariate time series data to obtain a first time series; filtering the first time series to obtain a second time series; performing an inverse fast Fourier transform on the second time series, and removing the inverse fast Fourier transformed second time series from the multivariate time series data to obtain reference noise data.
[0010] Optionally, based on the reference noise data, the multivariate time series is denoised according to an adaptive noise elimination strategy to obtain target time series data, including: determining a filter weight matrix corresponding to each time step in the multivariate time series data; calculating noise estimation data corresponding to each time step based on the filter weight matrix corresponding to each time step and the reference noise data corresponding to each time step; and based on the noise estimation data corresponding to each time step, denoising the time series data corresponding to each time step in the multivariate time series data to obtain the target time series data.
[0011] Optionally, the filter weight matrix corresponding to each time step in the multivariate time series data is determined according to the following expression, including:
[0012] W t =W t-1 +2μY t-1 R t-1 ;
[0013] Among them, W t is the filter weight matrix corresponding to the time step t, W t-1 is the filter weight matrix corresponding to time step t-1, R t-1 is the reference noise data corresponding to time step t-1 in the reference noise data, Y t-1 It is the time series data obtained after denoising the time series data corresponding to time step t-1.
[0014] Optionally, the dominant period of each channel in the target time series data is identified, and multiple two-dimensional patches corresponding to the target time series data are determined according to the dominant period, including: performing a short-time Fourier transform on the target time series to determine the dominant period of each channel of the target time series; clustering channels with the same dominant period to determine multiple groups of channels according to the dominant period of each channel; reshaping the one-dimensional time series in each group of channels into a two-dimensional tensor, and processing all two-dimensional tensors according to a two-dimensional patch strategy to obtain multiple two-dimensional patches.
[0015] Optionally, reshaping the one-dimensional time series in each group of channels into a two-dimensional tensor includes: performing periodic interpolation on each group of channels to process the one-dimensional time series in each group of channels into a one-dimensional interpolated time series; and reshaping the one-dimensional interpolated time series in each group of channels into multiple two-dimensional tensors according to the period length corresponding to each group of channels.
[0016] Optionally, all two-dimensional tensors are processed according to a two-dimensional patch strategy to obtain multiple two-dimensional patches, including: setting a target size and a target stride of the two-dimensional patch; for each two-dimensional tensor, dividing the two-dimensional tensor according to the target size and the target stride on two dimensions of the two-dimensional tensor to obtain multiple two-dimensional patches.
[0017] In some embodiments, a prediction device for time series includes: a denoising module, configured to process received multivariate time series data and determine reference noise data corresponding to the multivariate time series data; the denoising module is also configured to denoise the multivariate time series according to the reference noise data and an adaptive noise elimination strategy to obtain target time series data; a patch partitioning module, configured to identify the dominant period of each channel in the target time series data, and determine multiple two-dimensional patches corresponding to the target time series data according to the dominant period; a prediction module, configured to adopt a dual attention mechanism that aggregates patch attention and full attention, predict based on the target time series data and multiple two-dimensional patches, and determine the time series prediction result.
[0018] In some embodiments, a prediction device for time series includes a processor and a memory storing program instructions, and the processor is configured to execute the prediction method for time series as described above.
[0019] In some embodiments, an electronic device includes: a device body; and a prediction device for time series as described above, which is disposed in the device body.
[0020] The prediction method, prediction device, and electronic device for time series provided by the embodiments of the present disclosure can achieve the following technical effects:
[0021] Through research, the disclosed embodiments have found that the reason why the time series prediction results obtained by the prediction model in the related art based on multivariate time series data are less accurate is that: when performing noise reduction processing on the multivariate time series data, a unified noise reduction strategy is adopted, ignoring the differences in noise sources between different channels in the multivariate time series data, which results in ineffective noise suppression in certain channels, resulting in poor denoising effect on the multivariate time series data. And when making predictions based on the time series data after noise removal, only the global dependencies between different channels in the multivariate time series data are considered, and the fine-grained local changes of each channel are not considered, which ignores the differences in periodic characteristics of each channel in the multivariate time series data.
[0022] In the embodiment of the present disclosure, after receiving the multivariate time series data, the reference noise data corresponding to the multivariate time series data will be identified, and according to the reference noise data, the multivariate time series will be denoised according to the adaptive noise elimination strategy to obtain the target time series data after the noise is removed. In this way, when the multivariate time series data is subjected to noise reduction, the noise data of each channel can be better eliminated. After obtaining the target time series data after the noise is removed, the dominant period of each channel in the target time series data can be identified, and the multiple two-dimensional patches corresponding to the target time series data can be determined according to the dominant period. After determining the multiple two-dimensional patches, a dual attention mechanism with patch attention and full attention will be adopted to perform comprehensive prediction based on the target time series data and the multiple two-dimensional patches to determine the final time series prediction result. In this way, when performing time series prediction, the global dependency between different channels in the multivariate time series data and the fine-grained local changes of each channel can be comprehensively considered. Therefore, when performing subsequent time series prediction based on the multivariate time series data, the embodiment of the present disclosure can improve the accuracy of the obtained time series prediction result.
[0023] 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
[0024] 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:
[0025] Figure 1 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure;
[0026] Figure 2 is a schematic diagram of a prediction method for time series provided by an embodiment of the present disclosure;
[0027] Figure 3 is a schematic diagram of another prediction method for time series provided by an embodiment of the present disclosure;
[0028] Figure 4 is a schematic diagram of a multi-level prediction model provided by an embodiment of the present disclosure;
[0029] Figure 5 is a schematic diagram of a prediction device for time series provided by an embodiment of the present disclosure;
[0030] Figure 6 It is a schematic diagram of another prediction device for time series provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] 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.
[0032] 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 that 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.
[0033] Unless otherwise stated, the term "plurality" of a feature means two or more.
[0034] In the embodiment of the present disclosure, the character " / " feature indicates that the preceding and following objects are in an "or" relationship. For example, the A / B feature indicates: A or B.
[0035] The term "and / or" is a description of the association relationship between objects, and the characteristic indicates that there can be three relationships. For example, A and / or B, the characteristic indicates: A or B, or, A and B.
[0036] 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.
[0037] 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.
[0038] like Figure 1 As shown, the electronic device 100 provided by the embodiment of the present disclosure includes a device body 110 and a prediction device 500 (600) for time series.
[0039] Specifically, the prediction device 600 ( 600 ) for time series is set in the device body 110 .
[0040] Optionally, the prediction device 600 for time series includes a processor. After receiving the multivariate time series data, the processor can identify and determine the reference noise data corresponding to the multivariate time series data, and can perform denoising on the multivariate time series according to the reference noise data and the adaptive noise elimination strategy to obtain the target time series data. After obtaining the target time series data after denoising, the processor can determine the multiple two-dimensional patches corresponding to the target time series data according to the dominant period of each channel in the target time series data, and then use a dual attention mechanism that aggregates patch attention and full attention to perform prediction based on the target time series data and the multiple two-dimensional patches to obtain the final time series prediction result.
[0041] In combination with the above electronic device, the present disclosure provides a method for predicting time series, such as Figure 2 As shown, the prediction method includes:
[0042] S201, the processor processes the received multivariate time series data to determine reference noise data corresponding to the multivariate time series data.
[0043] Specifically, multivariate time series data is also called multivariate time series data, where one variable is one channel. Indicates that T is the number of time steps and C is the number of variables (i.e., the number of channels).
[0044] Specifically, reference noise data refers to the benchmark for identifying which data in multivariate time series data are noise. Specifically, noise is more obvious in the frequency domain. Therefore, the reference noise data corresponding to the multivariate time series data can be determined by converting the multivariate time series data into the frequency domain.
[0045] Optionally, the received multivariate time series data is processed to determine reference noise data corresponding to the multivariate time series data, including: performing a fast Fourier transform on the multivariate time series data to obtain a first time series; filtering the first time series to obtain a second time series; performing an inverse fast Fourier transform on the second time series, and removing the inverse fast Fourier transformed second time series from the multivariate time series data to obtain reference noise data.
[0046] Specifically, the multivariate time series data can be converted to the frequency domain by performing Fast Fourier Transform (FFT) on the multivariate time series data. Therefore, it is necessary to perform Fast Fourier Transform on the multivariate time series data to obtain the first time series.
[0047] Specifically, the multivariate time series data is subjected to fast Fourier transform according to the following expression to determine the first time series.
[0048] X′=FFT(X);
[0049] Among them, X′ is the first time series, and X is the multivariate time series data.
[0050] Specifically, some noise data in the first time series can be directly removed. Therefore, the first time series can be filtered to obtain the second time series. Specifically, a threshold α can be set, and the first time series can be filtered based on the threshold α.
[0051] Specifically, the first time series is filtered according to the following expression to determine the second time series.
[0052]
[0053] Wherein, X″ is the second time series, X′ is the first time series, and α is the threshold.
[0054] Specifically, the reference noise data is determined according to the second time series according to the following expression.
[0055] R = X-IFFT(X″);
[0056] Wherein, R is the reference noise data, X is the multivariate time series data, and IFFT(X″) is the second time series after inverse fast Fourier transform.
[0057] S202, the processor performs denoising on the multivariate time series according to the reference noise data and an adaptive noise elimination strategy to obtain target time series data.
[0058] Specifically, the adaptive noise cancellation strategy refers to the ANC (Active Noise Cancellation) algorithm. According to the reference noise data, the multivariate time series is denoised according to the adaptive noise cancellation strategy. When filtering the time series data of different channels in the multivariate time series, the filter weights can be adaptively adjusted so that the filter can accurately eliminate the noise data of each channel.
[0059] Optionally, based on the reference noise data, the multivariate time series is denoised according to an adaptive noise elimination strategy to obtain target time series data, including: determining a filter weight matrix corresponding to each time step in the multivariate time series data; calculating noise estimation data corresponding to each time step based on the filter weight matrix corresponding to each time step and the reference noise data corresponding to each time step; and based on the noise estimation data corresponding to each time step, denoising the time series data corresponding to each time step in the multivariate time series data to obtain the target time series data.
[0060] Specifically, the noise sources of different channels in multivariate time series data are different. When filtering multivariate time series data, in order to enable the filter to dynamically adapt to the changes in the signal, different filter weight matrices need to be used at different time steps. Therefore, it is necessary to determine the filter weight matrix corresponding to each time step in the multivariate time series data.
[0061] Specifically, according to the filter weight matrix corresponding to each time step and the reference noise data corresponding to each time step in the reference noise data, the noise estimation data corresponding to each time step is calculated according to the following expression.
[0062]
[0063] in, is the noise estimation data corresponding to time step t, is the transpose of the filter weight matrix corresponding to time step t, R t is the reference noise data corresponding to time step t.
[0064] Specifically, according to the noise estimation data corresponding to each time step, the time series data corresponding to each time step in the multivariate time series data is denoised according to the following expression to obtain the target time series data.
[0065]
[0066] Among them, Y t is the target sequence data corresponding to time step t, X t is the time series data corresponding to time step t in the multivariate time series data, Noise estimate data corresponding to time step t.
[0067] Specifically, the final target time series data is obtained through express.
[0068] Optionally, the filter weight matrix corresponding to each time step in the multivariate time series data is determined according to the following expression, including:
[0069] W t =W t-1 +2μY t-1 R t-1 ;
[0070] Among them, W t is the filter weight matrix corresponding to the time step t, W t-1 is the filter weight matrix corresponding to time step t-1, R t-1 is the reference noise data corresponding to time step t-1 in the reference noise data, Y t-1 It is the time series data obtained after denoising the time series data corresponding to time step t-1.
[0071] S203, the processor identifies the dominant period of each channel in the target time series data, and determines a plurality of two-dimensional patches corresponding to the target time series data according to the dominant period.
[0072] Specifically, the dominant cycle refers to the most significant and representative periodic component in the time series data, which can reflect the main change trend and periodic law of the time series data.
[0073] Specifically, the periodicity of each channel in the target time series data can be analyzed by short-time Fourier transform (STFT) to determine the main period of each channel.
[0074] Specifically, according to the dominant period of each channel, the main change trend and periodic law of the time series data corresponding to the channel can be clarified, and the columns and rows of the two-dimensional tensor are constructed based on the change trend and periodic law. The time series data corresponding to each channel is mapped into a two-dimensional tensor, and the obtained two-dimensional tensor is divided according to the set requirements to obtain multiple two-dimensional patches corresponding to the target time series data.
[0075] Specifically, according to the multiple two-dimensional patches corresponding to the target time series data, the fine-grained local changes of each channel can be better clarified. Therefore, it is necessary to determine the multiple two-dimensional patches corresponding to the target time series data according to the dominant period of each channel.
[0076] S204, the processor adopts a dual attention mechanism that aggregates patch attention and full attention, performs prediction based on the target time series data and multiple two-dimensional patches, and determines the time series prediction result.
[0077] Specifically, based on the full attention mechanism, a time series prediction result can be obtained from the perspective of considering the global dependencies between different channels in the multivariate time series data according to the target time series data. Based on the patch attention mechanism, a time series prediction result can be obtained from the perspective of considering the fine-grained local changes of each channel in the multivariate time series data according to multiple two-dimensional patches. Combining the two time prediction results, the final time series prediction result can be obtained.
[0078] Through research, the disclosed embodiments have found that the reason why the time series prediction results obtained by the prediction model in the related art based on multivariate time series data are less accurate is that: when performing noise reduction processing on the multivariate time series data, a unified noise reduction strategy is adopted, ignoring the differences in noise sources between different channels in the multivariate time series data, which results in ineffective noise suppression in certain channels, resulting in poor denoising effect on the multivariate time series data. And when making predictions based on the time series data after noise removal, only the global dependencies between different channels in the multivariate time series data are considered, and the fine-grained local changes of each channel are not considered, which ignores the differences in periodic characteristics of each channel in the multivariate time series data.
[0079] In the embodiment of the present disclosure, after receiving the multivariate time series data, the reference noise data corresponding to the multivariate time series data will be identified, and according to the reference noise data, the multivariate time series will be denoised according to the adaptive noise elimination strategy to obtain the target time series data after the noise is removed. In this way, when the multivariate time series data is subjected to noise reduction, the noise data of each channel can be better eliminated. After obtaining the target time series data after the noise is removed, the dominant period of each channel in the target time series data can be identified, and the multiple two-dimensional patches corresponding to the target time series data can be determined according to the dominant period. After determining the multiple two-dimensional patches, a dual attention mechanism with patch attention and full attention will be adopted to perform comprehensive prediction based on the target time series data and the multiple two-dimensional patches to determine the final time series prediction result. In this way, when performing time series prediction, the global dependency between different channels in the multivariate time series data and the fine-grained local changes of each channel can be comprehensively considered. Therefore, when performing subsequent time series prediction based on the multivariate time series data, the embodiment of the present disclosure can improve the accuracy of the obtained time series prediction result.
[0080] The present disclosure provides another method for predicting time series. Figure 3 As shown, the prediction method includes:
[0081] S301, the processor processes the received multivariate time series data to determine reference noise data corresponding to the multivariate time series data.
[0082] S302: The processor performs denoising on the multivariate time series according to the reference noise data and an adaptive noise elimination strategy to obtain target time series data.
[0083] S303: The processor performs short-time Fourier transform on the target time series to determine the dominant period of each channel of the target time series.
[0084] Specifically, a short-time Fourier transform is performed on the target time series according to the following formula to determine the dominant period of each channel of the target time series.
[0085] Period i =STFT(Y),i=1,…C;
[0086] Among them, Period i is the dominant period of the ith channel, Y is the target time series, and C is the total number of channels.
[0087] S304: The processor clusters channels having the same dominant period according to the dominant period of each channel to determine a plurality of groups of channels.
[0088] Specifically, by constructing a mapping from period to channel index, channels with the same dominant period are clustered to determine multiple groups of channels. Specifically, channels with the same dominant period are clustered according to the following expression.
[0089] Y (j) ={y i |Period i =p j}, j = 1, ... n;
[0090] Among them, Y (j) The jth group has the same dominant period p j The channel, Used to represent the time series data of the i-th channel. This clustering method can be used to divide the target time series data Y into n groups Y (1) ,…,Y (n) , the dominant periods of each group are p1,…,p n .
[0091] S305 , the processor reshapes the one-dimensional time series in each group of channels into a two-dimensional tensor, and processes all the two-dimensional tensors according to the two-dimensional patch strategy to obtain multiple two-dimensional patches.
[0092] Specifically, reshaping one-dimensional time series data into a two-dimensional tensor in two-dimensional form can break the lack of representation ability in the original one-dimensional space so as to better capture the complex temporal changes among multiple channels.
[0093] Specifically, the entire two-dimensional tensor is divided and processed according to the two-dimensional patch strategy to determine multiple two-dimensional patches. The periodic two-dimensional tensor can be redistributed so that each two-dimensional patch contains information within a time period and maintains continuity between different periods. In this way, it can help capture the dynamic and global information within the dominant period of each channel, so that fine-grained local changes in each channel can be determined.
[0094] Optionally, reshaping the one-dimensional time series in each group of channels into a two-dimensional tensor includes: performing periodic interpolation on each group of channels to process the one-dimensional time series in each group of channels into a one-dimensional interpolated time series; and reshaping the one-dimensional interpolated time series in each group of channels into multiple two-dimensional tensors according to the period length corresponding to each group of channels.
[0095] Specifically, by performing periodic interpolation on each group of channels, the length of the one-dimensional time series data of each group of channels can be made consistent and the length is an integer multiple of the period length, which facilitates the subsequent division of two-dimensional patches.
[0096] Specifically, periodic interpolation is performed on each group of channels according to the following expression.
[0097]
[0098] in, is the one-dimensional interpolation time series obtained by periodically interpolating the i-th one-dimensional time series in the current group channel, Y (i) is the i-th time series in the current group channel, p i It is the cycle length corresponding to the current group channel.
[0099] Specifically, the one-dimensional interpolated time series in each group of channels is reshaped into multiple two-dimensional tensors according to the following expression.
[0100]
[0101] in, is the two-dimensional tensor corresponding to the i-th one-dimensional interpolation time series, is the i-th one-dimensional interpolation time series, f i is the number of rows of the two-dimensional tensor, p i is the number of columns of the two-dimensional tensor, each row represents the number of periods of the interpolation time series of a group of channels, and each column represents the period length of the interpolation time series of a group of channels, that is, the two dimensions of the two-dimensional tensor are the number of periods of the interpolation time series and the period length of the interpolation time series.
[0102] Optionally, all two-dimensional tensors are processed according to a two-dimensional patch strategy to obtain multiple two-dimensional patches, including: setting a target size and a target stride of the two-dimensional patch; for each two-dimensional tensor, dividing the two-dimensional tensor according to the target size and the target stride on two dimensions of the two-dimensional tensor to obtain multiple two-dimensional patches.
[0103] Specifically, the target size of the two-dimensional patch can be represented by patchH×patchW, and the target stride of the two-dimensional patch can be represented by strideH×strideW. In this case, the two-dimensional patch can be represented by the following expression.
[0104]
[0105] in, is the j-th two-dimensional patch, N i is the number of 2D patches, each 2D patch contains P = patchH × patchW time steps.
[0106] S306, the processor adopts a dual attention mechanism that aggregates patch attention and full attention, performs prediction based on the target time series data and multiple two-dimensional patches, and determines the time series prediction result.
[0107] In the disclosed embodiment, the dominant period of each channel in the target time series data is determined by short-time Fourier transform, thereby improving the accuracy of the dominant period of each channel determined. Multiple groups of channels are determined by clustering channels with the same dominant period, and the one-dimensional time series in each group of channels are reshaped into a two-dimensional tensor, and then the two-dimensional tensor is divided to determine multiple two-dimensional patches, thereby improving the efficiency and accuracy of determining the two-dimensional patches.
[0108] In some embodiments, the prediction method for time series proposed in the embodiments of the present disclosure can be constructed as follows: Figure 4 The multi-level prediction model for time series prediction shown in FIG. The multi-level prediction model includes: an input unit layer, a channel independent denoising unit layer, a patch partitioning module layer and an encoder layer, a fully connected layer, and an output unit layer.
[0109] Specifically, the input unit layer is used to receive multivariate time series data input by the user.
[0110] Specifically, the channel independent denoising unit layer is used to independently denoise each channel of the multivariate time series to obtain the target time series data.
[0111] Specifically, the patch partitioning module layer is used to use short-time Fourier transform to identify the dominant period of each channel in the target time series data, cluster channels with the same dominant period according to the dominant period of each channel to determine multiple groups of channels; reshape the one-dimensional time series in each group of channels into a two-dimensional tensor, and process all two-dimensional tensors according to the two-dimensional patch strategy to obtain multiple two-dimensional patches. The encoder layer aggregates a dual attention mechanism of patch attention and full attention, which is used to make predictions based on the target time series data and multiple two-dimensional patches, and output the time series prediction results through the fully connected layer and the output unit layer.
[0112] Exemplarily, in order to verify the prediction effect of the multi-level prediction model constructed based on the above-mentioned prediction method for time series on time series, the embodiment of the present disclosure used 4 known data sets (including ECL, ETTm2, PEMS04 and Weather) to verify the multi-level prediction model.
[0113] Specifically, the disclosed embodiment inputs the above four data sets into the above multi-level analysis model (Ours), three Transformer-based models, two linear-based models, and one TCN-based model respectively.
[0114] Specifically, Transformer-based models include: Autoformer, PatchTST, and iTransformer.
[0115] Specifically, linear model-based models include: DLinear and HDMixer.
[0116] Specifically, the TCN-based TimesNet.
[0117] 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, where the bold ones are the best results and the underlined ones are the second best results.
[0118] Table 1
[0119]
[0120] It can be seen from Table 1 that the multi-level prediction model (Ours) achieves the best performance in most cases. This shows that the prediction method for time series proposed in the embodiment of the present disclosure can improve the accuracy of the obtained time series prediction results when performing subsequent time series prediction based on multivariate time series data.
[0121] Combination Figure 5As shown, the embodiment of the present disclosure provides a prediction device 500 for time series, including: a denoising module 501, a patch division module 502 and a prediction module 503. The denoising module 501 is configured to process the received multivariate time series data and determine the reference noise data corresponding to the multivariate time series data. The denoising module 501 is also configured to perform denoising on the multivariate time series according to the reference noise data and an adaptive noise elimination strategy to obtain target time series data. The patch division module 502 is configured to identify the dominant period of each channel in the target time series data, and determine multiple two-dimensional patches corresponding to the target time series data according to the dominant period. The prediction module 503 is configured to adopt a dual attention mechanism that aggregates patch attention and full attention, perform prediction based on the target time series data and multiple two-dimensional patches, and determine the time series prediction result.
[0122] Combination Figure 6 As shown, the embodiment of the present disclosure provides a prediction device 600 for time series, including: a processor (processor) 601 and a memory (memory) 602. Optionally, the device may also include a communication interface (Communication Interface) 603 and a bus 604. Among them, the processor 601, the communication interface 603, and the memory 602 can communicate with each other through the bus 604. The communication interface 603 can be used for information transmission. The processor 601 can call the logic instructions in the memory 602 to execute the prediction method for time series of the above embodiment.
[0123] In addition, the logic instructions in the memory 602 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.
[0124] The memory 602 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 601 executes the function application and data processing by running the program instructions / modules stored in the memory 602, that is, the prediction method for time series in the above embodiment is implemented.
[0125] The memory 602 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 602 may include a high-speed random access memory and may also include a non-volatile memory.
[0126] 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 prediction method for time series.
[0127] 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.
[0128] 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.
[0129] 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.
[0130] 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.
[0131] 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 prediction method for time series, characterized in that: include: Processing the received multivariate time series data to determine reference noise data corresponding to the multivariate time series data; According to the reference noise data, the multivariate time series is denoised according to the adaptive noise elimination strategy to obtain the target time series data; identifying a dominant period of each channel in the target time series data, and determining a plurality of two-dimensional patches corresponding to the target time series data according to the dominant period; A dual attention mechanism that aggregates patch attention and full attention is adopted to make predictions based on the target time series data and multiple two-dimensional patches to determine the time series prediction results.
2. The prediction method according to claim 1, characterized in that: The received multivariate time series data is processed to determine reference noise data corresponding to the multivariate time series data, including: Perform fast Fourier transform on multivariate time series data to obtain the first time series; Performing filtering on the first time series to obtain a second time series; An inverse fast Fourier transform is performed on the second time series, and the second time series after the inverse fast Fourier transform is removed from the multivariate time series data to obtain reference noise data.
3. The prediction method according to claim 1, characterized in that: According to the reference noise data, the multivariate time series is denoised according to the adaptive noise elimination strategy to obtain the target time series data, including: Determine the filter weight matrix corresponding to each time step in the multivariate time series data; Calculate the noise estimation data corresponding to each time step according to the filter weight matrix corresponding to each time step and the reference noise data corresponding to each time step; According to the noise estimation data corresponding to each time step, the time series data corresponding to each time step in the multivariate time series data is denoised to obtain the target time series data.
4. The prediction method according to claim 3, characterized in that: According to the following expression, the filter weight matrix corresponding to each time step in the multivariate time series data is determined, including: W t =W t-1 +2μY t-1 R t-1 ; Among them, W t is the filter weight matrix corresponding to the time step t, W t-1 is the filter weight matrix corresponding to time step t-1, R t-1 is the reference noise data corresponding to time step t-1 in the reference noise data, Y t-1 It is the time series data obtained after denoising the time series data corresponding to time step t-1.
5. The prediction method according to any one of claims 1 to 4, characterized in that: Identify the dominant period of each channel in the target time series data, and determine a plurality of two-dimensional patches corresponding to the target time series data according to the dominant period, including: Performing short-time Fourier transform on the target time series to determine the dominant period of each channel of the target time series; According to the dominant period of each channel, channels with the same dominant period are clustered to determine multiple groups of channels; The one-dimensional time series in each group of channels are reshaped into a two-dimensional tensor, and all the two-dimensional tensors are processed according to the two-dimensional patch strategy to obtain multiple two-dimensional patches.
6. The prediction method according to claim 5, characterized in that: Reshape the one-dimensional time series in each group of channels into a two-dimensional tensor, including: Perform periodic interpolation on each group of channels, and process the one-dimensional time series in each group of channels into a one-dimensional interpolation time series; According to the period length corresponding to each group of channels, the one-dimensional interpolated time series in each group of channels are reshaped into multiple two-dimensional tensors.
7. The prediction method according to claim 5, characterized in that: All two-dimensional tensors are processed according to the two-dimensional patch strategy to obtain multiple two-dimensional patches, including: Set the target size and target stride of the 2D patch; For each 2D tensor, the 2D tensor is partitioned along two dimensions of the 2D tensor according to a target size and a target stride to obtain a plurality of 2D patches.
8. A prediction device for time series, characterized in that: include: a denoising module configured to process the received multivariate time series data and determine reference noise data corresponding to the multivariate time series data; The denoising module is further configured to perform denoising on the multivariate time series according to the reference noise data and the adaptive noise elimination strategy to obtain target time series data; a patch partitioning module configured to identify a dominant period of each channel in the target time series data and determine a plurality of two-dimensional patches corresponding to the target time series data according to the dominant period; The prediction module is configured to adopt a dual attention mechanism that aggregates patch attention and full attention to make predictions based on the target time series data and multiple two-dimensional patches to determine the time series prediction results.
9. A prediction device for time series, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to be able to execute the prediction method for time series according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: Equipment body; The prediction device for time series as described in claim 8 or 9 is arranged in the device body.