Multivariate time series prediction method, device, electronic device and storage medium

By combining period coding and seasonal factor coding with fast Fourier transform, convolutional neural network and self-attention mechanism, local and global features of multivariate time series are extracted, which solves the problem of insufficient prediction accuracy in existing technologies and achieves more efficient traffic flow prediction.

CN120430475BActive Publication Date: 2025-09-05CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510933429.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-09-05
Estimated Expiration
2045-07-08

AI Technical Summary

Technical Problem

Existing time series forecasting methods are unable to effectively capture complex nonlinear relationships and long-term dependencies, resulting in insufficient forecasting accuracy, especially poor performance in multivariate situations.

Method used

The time series data are preprocessed using periodic encoding function and seasonal factor encoding function. Fast Fourier transform, convolutional neural network and self-attention mechanism are combined to extract local dependency and global dependency features, and prediction is performed by fusing multi-view features.

Benefits of technology

It improves the accuracy of time series prediction, optimizes road traffic arrangements, improves traffic conditions, and reduces computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120430475B_ABST
    Figure CN120430475B_ABST
Patent Text Reader

Abstract

The present invention provides a multivariate time series prediction method, device, electronic device, and storage medium, relating to the field of computer technology. The method comprises: processing time series data using a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data; performing periodic analysis on the preprocessed feature data using a fast Fourier transform to obtain two-dimensional time series data; obtaining local dependency features from the two-dimensional time series data based on a convolutional neural network; obtaining global dependency features from the preprocessed feature data based on a self-attention mechanism; obtaining fused multi-view features using the local dependency features and the global dependency features; and obtaining predicted time series data based on the fused multi-view features. The present invention improves the accuracy of time series prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a multivariate time series prediction method, device, electronic device and storage medium. Background Art

[0002] Time series forecasting refers to the analysis of data arranged in chronological order to predict future values. Time series forecasting is of great significance in many fields such as energy, meteorology, and transportation. Taking the transportation field as an example, by analyzing historical time series, future traffic flow can be predicted, helping to optimize the timing of traffic lights, reduce congestion, and improve road use efficiency.

[0003] Currently, ARIMA and exponential smoothing are commonly used for time series forecasting. The autoregressive moving average (ARIMA) model can handle linear trends, seasonal and non-seasonal components, but struggles to capture complex nonlinear relationships and long-term dependencies. It primarily focuses on short-term autoregressive and moving average characteristics. Exponential smoothing is simple and easy to use, suitable for processing data with trends or seasonal components. However, it is primarily used for short-term forecasting and has limited ability to capture complex patterns, especially long-term dependencies. Traditional time series forecasting methods typically focus on a specific type of pattern or relationship and cannot effectively capture all relevant information simultaneously, thus affecting the accuracy of time series forecasts. Summary of the Invention

[0004] The problem solved by the present invention is how to improve the accuracy of time series prediction.

[0005] To solve the above problems, the present invention provides a multivariate time series prediction method, device, electronic device and storage medium.

[0006] In a first aspect, the present invention provides a multivariate time series prediction method, comprising: processing time series data using a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series;

[0007] Performing periodic analysis on the pre-processed characteristic data by fast Fourier transform to obtain two-dimensional time series data;

[0008] Based on a convolutional neural network, a local dependency feature is obtained according to the two-dimensional time series data, wherein the local dependency feature is a feature used to represent short-term fluctuations and short-term trends;

[0009] Based on the self-attention mechanism, a global dependency feature is obtained according to the preprocessed feature data, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend;

[0010] Obtaining a fused multi-view feature through the local dependency feature and the global dependency feature;

[0011] The predicted time series data is obtained according to the fused multi-view features.

[0012] Optionally, performing periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data includes:

[0013] Extracting the periodic frequency of the pre-processed feature data by fast Fourier transform;

[0014] Wherein, the periodic frequency is:

[0015] ,

[0016] in, is the periodic frequency, Period() is the periodic analysis function, The preprocessing feature data;

[0017] Converting the one-dimensional matrix of the preprocessed feature data into a two-dimensional matrix according to the periodic frequency to obtain the two-dimensional time series data;

[0018] The two-dimensional time series data is:

[0019] ,

[0020] in, For the two-dimensional time series data, Reshape() is the reshaping function. is the subscript of the periodic frequency, Padding() is the length padding function, i is the index parameter, and k is the number of the periodic frequencies.

[0021] Optionally, obtaining the local dependency feature according to the two-dimensional time series data includes:

[0022] Performing a downsampling operation on the two-dimensional time series data to obtain downsampled time series features;

[0023] The down-sampling time series characteristics are:

[0024] ,

[0025] in, is the downsampled time series feature, DownSample() is the downsample function, and X is the two-dimensional time series data;

[0026] Performing an upsampling operation on the downsampled time series features to obtain upsampled time series features;

[0027] The up-sampled time series features are:

[0028] ,

[0029] in, is the upsampled time series feature, ConvTranspose() is the transposed convolution function;

[0030] The local dependency feature is obtained according to the upsampled time series feature.

[0031] Optionally, obtaining the global dependency feature according to the preprocessed feature data includes:

[0032] Obtaining an attention mechanism output result by the preprocessed feature data;

[0033] Among them, the output result of the attention mechanism is:

[0034] ,

[0035] Among them, MHA(X) is the output result of the attention mechanism, Attn1(X) is the output result of the first attention head, AttnH(X) is the output result of the Hth attention head, and H is the number of attention heads. To combine the trainable projection matrices of different attention heads, Concat() is the concatenation function;

[0036] The global dependency feature is obtained according to the output result of the attention mechanism.

[0037] Optionally, the processing of the time series data by using the period coding function and the seasonal factor coding function to obtain preprocessed feature data includes:

[0038] Processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result;

[0039] Obtaining the preprocessing characteristic data according to the period coding result and the seasonal factor coding result;

[0040] Wherein, the pre-processed feature data is:

[0041] ,

[0042] in, is the preprocessing characteristic data, PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result.

[0043] Optionally, the processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result includes:

[0044] Inputting the time series data into the periodic coding function to obtain the periodic coding result;

[0045] The cycle encoding result is:

[0046] ,

[0047] in, is the period encoding result, T is the time length of a complete cycle, t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions;

[0048] Inputting the time series data into the seasonal factor encoding function to obtain the seasonal factor encoding result;

[0049] The seasonal factor encoding result is:

[0050] ,

[0051] Among them, Seasonal(t) is the seasonal factor encoding result, Seasonal() is the seasonal factor encoding function, and the seasonal factor encoding function is used to mark the different current time points t of spring, summer, autumn and winter as 1, 2, 3, and 4 respectively.

[0052] Optionally, obtaining a fused multi-view feature through the local dependency feature and the global dependency feature includes:

[0053] Obtaining the fused multi-view feature through the local dependency feature and the global dependency feature;

[0054] The fusion multi-view features are:

[0055] ,

[0056] in, is the fused multi-view feature, G(X) is the local dependency feature, and K(X) is the global dependency feature.

[0057] In a second aspect, the present invention provides a multivariate time series prediction device, comprising: a coding function processing module, configured to process time series data using a period coding function and a seasonal factor coding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series;

[0058] A Fourier transform processing module, configured to perform periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data;

[0059] A convolutional neural network module, configured to obtain local dependency features based on the two-dimensional time series data using a convolutional neural network, wherein the local dependency features are features used to represent short-term fluctuations and short-term trends;

[0060] A self-attention mechanism module, configured to obtain a global dependency feature based on the preprocessed feature data based on a self-attention mechanism, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend;

[0061] A fused multi-view feature acquisition module, configured to obtain fused multi-view features using the local dependency features and the global dependency features;

[0062] The predicted time series data acquisition module is used to obtain the predicted time series data based on the fused multi-view features.

[0063] In a third aspect, the present invention provides an electronic device comprising a memory and a processor;

[0064] The memory is used to store computer programs;

[0065] The processor is configured to implement the multivariate time series prediction method as described in the first aspect when executing the computer program.

[0066] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the multivariate time series prediction method as described in the first aspect is implemented.

[0067] The multivariate time series prediction method, device, electronic device, and storage medium of the present invention have the following beneficial effects: A periodic encoding function and a seasonal factor encoding function are introduced to process time series data to obtain preprocessed feature data. By converting the periodic and seasonal characteristics of the time series into numerical codes, traffic flow time series can be better analyzed and processed, optimizing the learning process of repetitive patterns in traffic flow time series. Two-dimensional time series data is obtained by periodically analyzing the preprocessed feature data using a fast Fourier transform. Local dependency features are obtained using a convolutional neural network to effectively extract features of short-term fluctuations and trends, fully accounting for the complexities of road traffic. Global dependency features are obtained based on a self-attention mechanism to effectively extract features of long-term dependencies and trends. A fused multi-view feature is generated using the local and global dependency features, and multi-scale fusion is achieved by combining an improved convolutional neural network with a self-attention mechanism. Predicted time series data is obtained based on the fused multi-view feature, reducing computational complexity while improving the accuracy of time series predictions, helping to optimize road scheduling and improve traffic conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 A schematic flow chart of a multivariate time series prediction method according to an embodiment of the present invention;

[0069] Figure 2 Schematic diagram of another multivariate time series prediction method according to an embodiment of the present invention;

[0070] Figure 3 Schematic diagram of the structure of a multivariate time series prediction device according to an embodiment of the present invention;

[0071] Figure 4 The figure is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0072] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.

[0073] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0074] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to"; the term "based on" means "based at least in part on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0075] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0076] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0077] In related technologies, time series forecasting refers to the analysis of chronologically arranged data to predict future values. In today's information age, time series forecasting is of great significance in a variety of fields, including finance, meteorology, epidemic transmission, and transportation. It is a key technology for businesses and organizations to optimize resource allocation, reduce operational risks, and improve the scientific nature of decision-making. Traditional time series forecasting methods include statistical methods such as ARIMA and exponential smoothing, as well as early machine learning methods such as Markov chain methods (such as recurrent neural networks (RNNs) and long short-term memory (LSTMs)). The ARIMA model is suitable for linear and stationary time series, but has limitations when dealing with nonlinear and nonstationary data. RNNs and LSTMs improve forecasting accuracy to a certain extent by capturing nonlinear patterns and long-term dependencies in the data. However, when dealing with long time series, they often face the vanishing and exploding gradient problems, which reduces their ability to capture long-term dependencies and makes it difficult to model complex patterns and nonlinear features.

[0078] With the development of deep learning, Transformer-based models have been introduced to the field of time series forecasting. While Transformers can capture long-range dependencies, the original model has high computational complexity, and the attention mechanism struggles to capture temporal positional information when processing time series data, making it less than ideal for time series forecasting tasks that require handling causal relationships. Convolutional neural networks (CNNs) implicitly encode positional information during computation, capturing short-term patterns and trends through sliding windows. This can compensate for the shortcomings of self-attention in recognizing long-range time series features, but they fall short of recurrent neural networks in modeling long-range temporal dependencies.

[0079] Despite the numerous existing time series forecasting methods, numerous challenges remain. Many models struggle with complex time series fluctuations, long-term dependencies, and multivariate characteristics. Furthermore, the convolutional methods currently used in time series forecasting are all one-dimensional convolutions, which have limited receptive fields and poor performance, making them inadequate for long-term, multivariate forecasting. Existing models still need improvement in areas such as feature fusion, multi-scale feature modeling, and achieving high-precision and long-span forecasts with limited historical data.

[0080] In response to the problems existing in the above-mentioned related technologies, this embodiment provides a multivariate time series prediction method, device, electronic device and storage medium.

[0081] like Figure 1 As shown, an embodiment of the present invention provides a multivariate time series prediction method, including:

[0082] Step 110 : Processing the time series data using a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series.

[0083] Specifically, before the process of processing the time series data by the period coding function and the seasonal factor coding function to obtain the preprocessed feature data, the process further includes:

[0084] Initial data is obtained by collecting historical traffic flow time series through sensors and websites;

[0085] The initial data is de-noised, normalized, and missing value filled to obtain the time series data. Time information (e.g., hour, day, month) is converted into features through period coding and seasonal factor coding. A historical traffic flow time series represents observations within a specific road segment over a historical time period. The historical time period can be flexibly set as needed. A historical traffic flow time series contains continuous observations for that road segment over the historical time period. The types of observations include numerical information, categorical information, and text information. For example, traffic flow exhibits distinct periodicity, such as morning and evening peaks and weekend troughs. Therefore, a historical traffic flow time series may include traffic flow for that road segment over different historical time periods (i.e., temporal dimension variables). Traffic flow may also exhibit spatial correlation; congestion on one road segment may trigger a chain reaction on adjacent roads. Therefore, a historical traffic flow time series may also include traffic flow for adjacent roads over the corresponding historical time period, as well as road network topology (i.e., spatial dimension variables). Furthermore, traffic flow may be correlated with external environmental variables such as weather, traffic accidents, construction, and large-scale events. Therefore, data on external environmental variables for the corresponding historical time period may also be included. Therefore, the observation value at a historical moment may include the traffic flow of the road section at that historical moment, the traffic flow of other road sections adjacent to the road section at that historical moment, and the external environmental variable data at that historical moment. The observation values ​​of multiple historical moments constitute a historical traffic flow time series, wherein the historical traffic flow time series can be a multi-channel time series, where one channel corresponds to a historical time series of one variable.

[0086] Step 1211 , performing periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data.

[0087] Specifically, the periodicity analysis of the preprocessed feature data is performed through Fast Fourier Transform (FFT) to identify periodic patterns or frequency components in the time series.

[0088] Step 1212: Based on a convolutional neural network, obtain local dependency features according to the two-dimensional time series data, wherein the local dependency features are features used to represent short-term fluctuations and short-term trends.

[0089] Specifically, convolutional neural networks (CNNs) can be used to extract local dependency features from two-dimensional time series data, effectively capturing short-term fluctuations and trends. CNNs automatically learn local patterns in the input data through their convolutional layers, making them well-suited for time series analysis, especially when dealing with data with local correlations in space or time.

[0090] Step 122: Based on the self-attention mechanism, a global dependency feature is obtained according to the preprocessed feature data, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend.

[0091] Specifically, based on the self-attention mechanism, global dependency features can be extracted from preprocessed feature data. This method is particularly suitable for capturing long-term dependencies and long-term trends because it allows the model to dynamically focus on different parts of the input sequence when processing sequential data, thereby effectively capturing long-range dependencies.

[0092] Step 130: Obtain fused multi-view features through the local dependency features and the global dependency features.

[0093] Specifically, it fully integrates the advantages of CNN and self-attention mechanism, effectively integrates local and global features, enhances the modeling ability of complex temporal dynamics, realizes multi-scale feature fusion, and enhances the modeling ability of complex temporal dynamics.

[0094] Step 140: Obtain predicted time series data based on the fused multi-view features.

[0095] Specifically, based on the extracted features, the model predicts the time series data to obtain predicted time series data, and the prediction results are evaluated and optimized. Appropriate evaluation metrics, such as mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE), are selected to measure the model's predictive performance. To improve prediction accuracy, relevant road segment data features corresponding to spatial dimension variables and environmental features corresponding to external environmental variables are also obtained in real time. The relevant road segment data features, environmental features, and fused multi-view features are then combined for prediction to obtain predicted time series data, i.e., predicted traffic flow data.

[0096] In this embodiment, a periodic encoding function and a seasonal factor encoding function are introduced to process time series data to obtain preprocessed feature data. By converting the periodic and seasonal characteristics of the time series into numerical codes, the traffic flow time series can be better analyzed and processed, and the learning process of repetitive patterns in the traffic flow time series is optimized. The preprocessed feature data is periodically analyzed using a fast Fourier transform to obtain two-dimensional time series data. Local dependency features are obtained using a convolutional neural network, effectively extracting features of short-term fluctuations and short-term trends, and fully considering the complex conditions of road traffic. Global dependency features are obtained based on a self-attention mechanism, effectively extracting features of long-term dependencies and long-term trends. Fused multi-view features are obtained using the local dependency features and the global dependency features, and multi-scale fusion is achieved by combining an improved convolutional neural network with a self-attention mechanism. Predicted time series data is obtained based on the fused multi-view features, which reduces computational complexity while improving the accuracy of time series predictions, helping to optimize road arrangements and improve traffic conditions.

[0097] Optionally, performing periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data includes:

[0098] Extracting the periodic frequency of the pre-processed feature data by fast Fourier transform;

[0099] Wherein, the periodic frequency is:

[0100] ,

[0101] in, is the periodic frequency, Period() is the periodic analysis function, The preprocessing feature data;

[0102] Converting the one-dimensional matrix of the preprocessed feature data into a two-dimensional matrix according to the periodic frequency to obtain the two-dimensional time series data;

[0103] The two-dimensional time series data is:

[0104] ,

[0105] in, For the two-dimensional time series data, Reshape() is the reshaping function. is the subscript of the periodic frequency, Padding() is the length padding function, i is the index parameter, and k is the number of the periodic frequencies.

[0106] Specifically, the pre-processed input feature data is first analyzed for periodicity using a Fast Fourier Transform (FFT) to identify significant periodic frequencies. Based on these periodic frequencies, the one-dimensional time series data is reshaped into a two-dimensional tensor, where the Padding() function is used to pad any non-divisible sequence lengths.

[0107] In this optional embodiment, a fast Fourier transform can be used to extract significant periodic frequencies from the time series, reducing the computational burden in subsequent processing steps. Reshaping the one-dimensional time series data into a two-dimensional tensor can significantly improve computational efficiency and prepare for subsequent feature extraction.

[0108] Optionally, obtaining the local dependency feature according to the two-dimensional time series data includes:

[0109] Performing a downsampling operation on the two-dimensional time series data to obtain downsampled time series features;

[0110] Wherein, the down-sampling time series characteristics are:

[0111] ,

[0112] in, is the downsampled time series feature, DownSample() is the downsample function, and X is the two-dimensional time series data;

[0113] Performing an upsampling operation on the downsampled time series features to obtain upsampled time series features;

[0114] The up-sampled time series features are:

[0115] ,

[0116] in, is the upsampled time series feature, ConvTranspose() is the transposed convolution function;

[0117] The local dependency feature is obtained according to the upsampled time series feature.

[0118] Specifically, after obtaining the two-dimensional time series data, the model uses upsampling and downsampling operations to observe detailed information at different scales of receptive fields. The downsampling process reduces the dimension of the time series data through continuous convolution operations while increasing its feature depth. This helps the model capture more abstract time series feature representations and enhances the model's representation capabilities while maintaining low computational complexity. The upsampling process restores the feature dimension of the time series through transposed convolution (ConvTranspose), re-enlarges the size of the time series data, and reduces the depth of the feature map to help the model recover more detailed information. The model further processes the spliced ​​time series data through a series of convolution operations to extract more refined local features. The downsampling and upsampling structures not only enhance the model's ability to capture local features of time series data, but also improve the model's ability to model complex patterns in time series through multi-scale feature fusion.

[0119] Optionally, obtaining the global dependency feature according to the preprocessed feature data includes:

[0120] Obtaining an attention mechanism output result by the preprocessed feature data;

[0121] Among them, the output result of the attention mechanism is:

[0122] ,

[0123] Among them, MHA(X) is the output result of the attention mechanism, Attn1(X) is the output result of the first attention head, AttnH(X) is the output result of the Hth attention head, and H is the number of attention heads. To combine the trainable projection matrices of different attention heads, Concat() is the concatenation function;

[0124] The global dependency feature is obtained according to the output result of the attention mechanism.

[0125] Specifically, obtaining an attention mechanism output result through the preprocessing feature data;

[0126] Among them, the output result of the attention mechanism is:

[0127] ,

[0128] Among them, MHA(X) is the output result of the attention mechanism, Attn1(X) is the output result of the first attention head, AttnH(X) is the output result of the Hth attention head, and H is the number of attention heads. To combine the trainable projection matrices of different attention heads, Concat() is the concatenation function;

[0129] Among them, the output result of the attention mechanism is:

[0130] ,

[0131] Among them, Attn(X) is the output result of the Xth attention head, 、 、 They are respectively trainable query, key, and value matrices, is the dimension of the key matrix, and M is the mask matrix used to cover up redundant information. , .

[0132] This optional embodiment uses an improved self-attention mechanism, which significantly improves model training efficiency and parameter utilization by removing multiple complex components in the traditional Transformer block. By optimizing signal propagation and reducing unnecessary computation, it effectively extracts long-range dependencies in time series data.

[0133] Optionally, the processing of the time series data by using the period coding function and the seasonal factor coding function to obtain preprocessed feature data includes:

[0134] Processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result;

[0135] Obtaining the preprocessing characteristic data according to the period coding result and the seasonal factor coding result;

[0136] Wherein, the pre-processed feature data is:

[0137] ,

[0138] in, is the preprocessing characteristic data, PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result.

[0139] Optionally, the processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result includes:

[0140] Inputting the time series data into the periodic coding function to obtain the periodic coding result;

[0141] The cycle encoding result is:

[0142] ,

[0143] in, is the period encoding result, T is the time length of a complete cycle, t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions;

[0144] Inputting the time series data into the seasonal factor encoding function to obtain the seasonal factor encoding result;

[0145] ,

[0146] Among them, Seasonal(t) is the seasonal factor encoding result, Seasonal() is the seasonal factor encoding function, and the seasonal factor encoding function is used to mark the different current time points t of spring, summer, autumn and winter as 1, 2, 3, and 4 respectively.

[0147] Specifically, time series data exhibits significant causal relationships, and effectively capturing long-term dependencies in multivariate time series (MTS) data is crucial for achieving accurate and robust forecasts. Time series data can be decomposed into four components: a trend factor (T), a cycle factor (C), a seasonal factor (S), and a random factor (I), which better aligns with the fluctuation patterns of time series data. To enhance the model's predictive capabilities, the time series data is processed using the cycle encoding function and the seasonal factor encoding function to produce cycle encoding and seasonal factor encoding results.

[0148] Periodic encoding aims to capture cyclical patterns in data. For example, for daily, weekly, or monthly data, we can use sine and cosine functions to convert temporal information into periodic features. Let timestamp t represent the current moment, and we can use the function PE() to perform periodic encoding:

[0149] The cycle encoding result is:

[0150] ,

[0151] in, is the period encoding result, T is the time length of a complete cycle (for example, for daily data, T is 24 hours, for weekly data, T is 7 days), t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions.

[0152] Seasonal factor coding is used to capture potential seasonal changes in the data, such as temperature changes, sales fluctuations, etc. According to the seasonal characteristics of the data set, the corresponding seasonal factor is constructed. The seasonal factor coding result is:

[0153] ,

[0154] Here, Seasonal(t) is the seasonal factor encoding result. The Seasonal() seasonal factor encoding function converts the time point t, marking the different times belonging to spring, summer, autumn and winter as 1, 2, 3, and 4, respectively. It can learn the impact of different seasons on the target variable, thereby improving prediction accuracy.

[0155] The preprocessed feature data is obtained according to the period encoding result and the seasonal factor encoding result. The preprocessed feature data is obtained by Embedding:

[0156] ,

[0157] in, , PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result.

[0158] In this optional embodiment, the technical means of period coding and seasonal factor coding are introduced. By converting the periodic and seasonal characteristics of the time series into numerical codes, the model's learning process of repetitive patterns in time series data is optimized. The periodic coding function effectively captures periodic changes and avoids the linear relationship problem caused by directly using timestamps as features. The seasonal coding function can learn the impact of different seasons on the target variable, thereby improving the prediction accuracy. Ensuring that the model fully considers the periodic and seasonal information in the time series during learning significantly improves accuracy and lays a solid foundation for subsequent prediction tasks.

[0159] Optionally, obtaining a fused multi-view feature through the local dependency feature and the global dependency feature includes:

[0160] Obtaining the fused multi-view feature through the local dependency feature and the global dependency feature;

[0161] The fusion multi-view features are:

[0162] ,

[0163] in, is the fused multi-view feature, G(X) is the local dependency feature, and K(X) is the global dependency feature.

[0164] Specifically, the fusion multi-view features are:

[0165] ,

[0166] in, is the input feature matrix, that is, the original time series data, where T is the number of time steps and F is the number of features. is the feature representation of the observer output, where and are the number of output time steps and features, respectively. F(X) combines the local dependency features G(X) and the global dependency features K(X).

[0167] This optional embodiment combines a convolutional neural network (CNN) with a self-attention mechanism to simultaneously extract local features and global dependencies from time series data. This multi-perspective design effectively enhances the model's ability to capture multi-scale time series features, improving accuracy in long-range forecasting tasks. This allows for better integration of local and global information, enabling more accurate modeling of cyclical, trending, and nonlinear characteristics in complex time series data.

[0168] In some more specific embodiments, obtaining predicted time series data based on the fused multi-view features includes:

[0169] Based on the fully connected layer, the predicted time series data is obtained according to the fused multi-view features.

[0170] During prediction, the fully connected layer is primarily responsible for mapping previously extracted features to the final output space. To introduce nonlinearity and enhance the model's expressiveness, an activation function (such as ReLU, Sigmoid, or Tanh) is typically applied after the fully connected layer. This activation function helps the model capture more complex patterns and makes the decision boundary non-linear.

[0171] In some more specific embodiments, in combination Figure 2As shown in the figure, time series data is fed into a hybrid observer, which consists of two parallel structures: a self-attention mechanism and multi-layer convolution kernels. This architecture simultaneously captures local dependency features G(X) and global dependency features K(X). First, a fast Fourier transform is performed on the time series data to extract periodic information. This periodic information is then used to convert the matrix into a two-dimensional matrix based on the period length, facilitating subsequent data processing. This two-dimensional matrix is ​​then downsampled and upsampled to obtain local dependency features. Another branch uses a multi-head self-attention mechanism to capture global dependencies. The output of the self-attention mechanism is further processed through a nonlinear layer to ultimately obtain global dependency features. The local and global dependency features are then fused to form multi-view features.

[0172] like Figure 3 As shown, an embodiment of the present invention provides a multivariate time series prediction device, comprising:

[0173] A coding function processing module 10 is used to process time series data using a period coding function and a seasonal factor coding function to obtain pre-processed feature data, wherein the time series data is used to represent a historical traffic flow time series;

[0174] A Fourier transform processing module 20 is configured to perform periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data;

[0175] A convolutional neural network module 30 is configured to obtain local dependency features based on the two-dimensional time series data using a convolutional neural network, wherein the local dependency features are features used to represent short-term fluctuations and short-term trends;

[0176] A self-attention mechanism module 40 is configured to obtain a global dependency feature based on the preprocessed feature data based on a self-attention mechanism, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend;

[0177] A fused multi-view feature acquisition module 50 is configured to obtain a fused multi-view feature using the local dependency feature and the global dependency feature;

[0178] The predicted time series data acquisition module 60 is used to obtain the predicted time series data according to the fused multi-view features.

[0179] The multivariate time series prediction device of this embodiment is used to implement the multivariate time series prediction method described above. Its advantages over the existing technology are the same as the advantages of the multivariate time series prediction method described above over the existing technology, and will not be repeated here.

[0180] Optionally, the Fourier transform processing module 20 is specifically configured to: extract the periodic frequency of the pre-processed feature data by fast Fourier transform;

[0181] Wherein, the periodic frequency is:

[0182] ,

[0183] in, is the periodic frequency, Period() is the periodic analysis function, The preprocessing feature data;

[0184] Converting the one-dimensional matrix of the preprocessed feature data into a two-dimensional matrix according to the periodic frequency to obtain the two-dimensional time series data;

[0185] The two-dimensional time series data is:

[0186] ,

[0187] in, For the two-dimensional time series data, Reshape() is the reshaping function. is the subscript of the periodic frequency, Padding() is the length padding function, i is the index parameter, and k is the number of the periodic frequencies.

[0188] Optionally, the convolutional neural network module 30 is specifically configured to: perform a downsampling operation on the two-dimensional time series data to obtain downsampled time series features;

[0189] The down-sampling time series characteristics are:

[0190] ,

[0191] in, is the downsampled time series feature, DownSample() is the downsample function, and X is the two-dimensional time series data;

[0192] Performing an upsampling operation on the downsampled time series features to obtain upsampled time series features;

[0193] The up-sampled time series features are:

[0194] ,

[0195] in, is the upsampled time series feature, ConvTranspose() is the transposed convolution function;

[0196] The local dependency feature is obtained according to the upsampled time series feature.

[0197] Optionally, the self-attention mechanism module 40 is specifically configured to: obtain an attention mechanism output result through the preprocessed feature data;

[0198] Among them, the output result of the attention mechanism is:

[0199] ,

[0200] Among them, MHA(X) is the output result of the attention mechanism, Attn1(X) is the output result of the first attention head, AttnH(X) is the output result of the Hth attention head, and H is the number of attention heads. To combine the trainable projection matrices of different attention heads, Concat() is the concatenation function;

[0201] The global dependency feature is obtained according to the output result of the attention mechanism.

[0202] Optionally, the encoding function processing module 10 is specifically configured to: process the time series data according to the period encoding function and the seasonal factor encoding function to obtain a period encoding result and a seasonal factor encoding result;

[0203] Obtaining the preprocessing characteristic data according to the period coding result and the seasonal factor coding result;

[0204] Wherein, the pre-processed feature data is:

[0205] ,

[0206] in, is the preprocessing characteristic data, PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result.

[0207] Optionally, the encoding function processing module 10 is specifically configured to: input the time series data into the period encoding function to obtain the period encoding result;

[0208] The period encoding result is:

[0209] ,

[0210] in, is the period encoding result, T is the time length of a complete cycle, t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions;

[0211] Inputting the time series data into the seasonal factor encoding function to obtain the seasonal factor encoding result;

[0212] The seasonal factor encoding result is:

[0213] ,

[0214] Among them, Seasonal(t) is the seasonal factor encoding result, Seasonal() is the seasonal factor encoding function, and the seasonal factor encoding function is used to mark the different current time points t of spring, summer, autumn and winter as 1, 2, 3, and 4 respectively.

[0215] Optionally, the fused multi-view feature acquisition module 50 is specifically configured to: obtain the fused multi-view feature through the local dependency feature and the global dependency feature;

[0216] The fusion multi-view features are:

[0217] ,

[0218] in, is the fused multi-view feature, G(X) is the local dependency feature, and K(X) is the global dependency feature.

[0219] like Figure 4 As shown, an electronic device 400 provided by an embodiment of the present invention includes a memory 410 and a processor 420; the memory 410 is used to store computer programs; the processor 420 is used to implement the multivariate time series prediction method as described above when executing the computer program.

[0220] In other words, an electronic device 400 includes a memory 410 and a processor 420 coupled to the memory 410; the memory 410 is configured to store a computer program; and the processor 420 is configured to perform the following operations when executing the computer program:

[0221] Processing the time series data by a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series;

[0222] Performing periodic analysis on the pre-processed characteristic data by fast Fourier transform to obtain two-dimensional time series data;

[0223] Based on a convolutional neural network, a local dependency feature is obtained according to the two-dimensional time series data, wherein the local dependency feature is a feature used to represent short-term fluctuations and short-term trends;

[0224] Based on the self-attention mechanism, a global dependency feature is obtained according to the preprocessed feature data, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend;

[0225] Obtaining a fused multi-view feature through the local dependency feature and the global dependency feature;

[0226] The predicted time series data is obtained according to the fused multi-view features.

[0227] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the multivariate time series prediction method described above is implemented.

[0228] In other words, a non-volatile computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following operations:

[0229] Processing the time series data by a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series;

[0230] Performing periodic analysis on the pre-processed characteristic data by fast Fourier transform to obtain two-dimensional time series data;

[0231] Based on a convolutional neural network, a local dependency feature is obtained according to the two-dimensional time series data, wherein the local dependency feature is a feature used to represent short-term fluctuations and short-term trends;

[0232] Based on the self-attention mechanism, a global dependency feature is obtained according to the preprocessed feature data, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend;

[0233] Obtaining a fused multi-view feature through the local dependency feature and the global dependency feature;

[0234] The predicted time series data is obtained according to the fused multi-view features.

[0235] An electronic device 400 that can serve as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 400 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 400 can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0236] Electronic device 400 includes a computing unit that can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). The RAM can also store various programs and data required for device operation. The computing unit, ROM, and RAM are interconnected via a bus. An input / output (I / O) interface is also connected to the bus.

[0237] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0238] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.

Claims

1. A multivariate time series forecasting method, characterized in that: include: Processing the time series data by a period encoding function and a seasonal factor encoding function to obtain preprocessed feature data, wherein the time series data is used to represent a historical traffic flow time series; The process of processing the time series data by using the period coding function and the seasonal factor coding function to obtain preprocessed feature data includes: Processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result; Obtaining the preprocessing characteristic data according to the period coding result and the seasonal factor coding result; Wherein, the pre-processed feature data is: , in, is the preprocessing characteristic data, PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result; The step of processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result includes: Inputting the time series data into the periodic coding function to obtain the periodic coding result; The period encoding result is: , in, is the period encoding result, T is the time length of a complete cycle, t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions; Inputting the time series data into the seasonal factor encoding function to obtain the seasonal factor encoding result; The seasonal factor encoding result is: , Wherein, Seasonal(t) is the seasonal factor encoding result, Seasonal() is the seasonal factor encoding function, and the seasonal factor encoding function is used to mark the different current time points t of spring, summer, autumn and winter as 1, 2, 3, and 4 respectively; Performing periodic analysis on the pre-processed characteristic data by fast Fourier transform to obtain two-dimensional time series data; Based on a convolutional neural network, a local dependency feature is obtained according to the two-dimensional time series data, wherein the local dependency feature is a feature used to represent short-term fluctuations and short-term trends; Based on the self-attention mechanism, a global dependency feature is obtained according to the preprocessed feature data, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend; Obtaining a fused multi-view feature through the local dependency feature and the global dependency feature; The predicted time series data is obtained according to the fused multi-view features.

2. The multivariate time series prediction method according to claim 1, characterized in that: The process of performing periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data includes: Extracting the periodic frequency of the pre-processed feature data by fast Fourier transform; Wherein, the periodic frequency is: , in, is the periodic frequency, Period() is the periodic analysis function, The preprocessing feature data; Converting the one-dimensional matrix of the preprocessed feature data into a two-dimensional matrix according to the periodic frequency to obtain the two-dimensional time series data; The two-dimensional time series data is: , in, For the two-dimensional time series data, Reshape() is the reshaping function. is the subscript of the periodic frequency, Padding() is the length padding function, i is the index parameter, and k is the number of the periodic frequencies.

3. The multivariate time series prediction method according to claim 1, characterized in that: The obtaining of local dependency features according to the two-dimensional time series data includes: Performing a downsampling operation on the two-dimensional time series data to obtain downsampled time series features; The down-sampling time series characteristics are: , in, is the downsampled time series feature, DownSample() is the downsample function, and X is the two-dimensional time series data; Performing an upsampling operation on the downsampled time series features to obtain upsampled time series features; The up-sampled time series features are: , in, is the upsampled time series feature, ConvTranspose() is the transposed convolution function; The local dependency feature is obtained according to the upsampled time series feature.

4. The multivariate time series prediction method according to claim 1, characterized in that: The obtaining of the global dependency feature according to the preprocessed feature data includes: Obtaining an attention mechanism output result by the preprocessed feature data; Among them, the output result of the attention mechanism is: , Among them, MHA(X) is the output result of the attention mechanism, Attn1(X) is the output result of the first attention head, AttnH(X) is the output result of the Hth attention head, and H is the number of attention heads. To combine the trainable projection matrices of different attention heads, Concat() is the concatenation function; The global dependency feature is obtained according to the output result of the attention mechanism.

5. The multivariate time series prediction method according to claim 1, characterized in that: The obtaining of the fused multi-view features by using the local dependency features and the global dependency features includes: Obtaining the fused multi-view feature through the local dependency feature and the global dependency feature; The fusion multi-view features are: , in, is the fused multi-view feature, G(X) is the local dependency feature, and K(X) is the global dependency feature.

6. A multivariate time series prediction device, characterized in that: include: a coding function processing module, configured to process time series data using a period coding function and a seasonal factor coding function to obtain pre-processed feature data, wherein the time series data is used to represent a historical traffic flow time series; The process of processing the time series data by using the period coding function and the seasonal factor coding function to obtain preprocessed feature data includes: Processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result; Obtaining the preprocessing characteristic data according to the period coding result and the seasonal factor coding result; Wherein, the pre-processed feature data is: , in, is the preprocessing characteristic data, PE(t) is the period encoding result, and Seasonal(t) is the seasonal factor encoding result; The step of processing the time series data according to the period coding function and the seasonal factor coding function to obtain a period coding result and a seasonal factor coding result includes: Inputting the time series data into the periodic coding function to obtain the periodic coding result; The cycle encoding result is: , in, is the period encoding result, T is the time length of a complete cycle, t is the current time point, i is the position number of the time point in the entire time series, PE() is the period encoding function, and the period encoding function is used to convert time information into periodic features through sine and cosine functions; Inputting the time series data into the seasonal factor encoding function to obtain the seasonal factor encoding result; The seasonal factor encoding result is: , Wherein, Seasonal(t) is the seasonal factor encoding result, Seasonal() is the seasonal factor encoding function, and the seasonal factor encoding function is used to mark the different current time points t of spring, summer, autumn and winter as 1, 2, 3, and 4 respectively; A Fourier transform processing module, configured to perform periodic analysis on the pre-processed feature data by fast Fourier transform to obtain two-dimensional time series data; A convolutional neural network module, configured to obtain local dependency features based on the two-dimensional time series data using a convolutional neural network, wherein the local dependency features are features used to represent short-term fluctuations and short-term trends; A self-attention mechanism module, configured to obtain a global dependency feature based on the preprocessed feature data based on a self-attention mechanism, wherein the global dependency feature is a feature used to represent long-term dependency and long-term trend; A fused multi-view feature acquisition module, configured to obtain fused multi-view features using the local dependency features and the global dependency features; The predicted time series data acquisition module is used to obtain the predicted time series data based on the fused multi-view features.

7. An electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is configured to implement the multivariate time series prediction method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the multivariate time series prediction method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Transform and Bi-LSTM-based power load prediction method and system

    CN117638860A

  • Convolutional sparse self-attention-based irrigation area water demand estimation method, equipment and medium

    CN118395108A