MLP-based time series data long-term prediction method and device, and medium
Through the long-term prediction method of time series data based on MLP, the multi-scale decomposition and feature fusion modules are used to solve the problems of insufficient versatility and high consumption of computing resources in the existing technology, achieving fast and accurate long-term prediction of time series data, and improving the model versatility and resource efficiency.
Patent Information
- Application Number
- CN202410919077.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-22
AI Technical Summary
Existing multi-step forecasting methods have shortcomings in versatility, seasonality and trend modeling, and consume huge computing resources, which limits the accuracy and timeliness of long-term forecasting of time series data.
A long-term forecasting method for time series data based on MLP is adopted, including a multi-scale decomposition module, a downsampling information fusion module, a local information extraction module and a covariate fusion module. The time series is decoupled through a channel independent strategy, seasonal items and trend items are extracted, and Multi-layer perceptron performs feature fusion and fine-tuning to achieve long-term prediction of time series data.
It improves the versatility and prediction performance of the model, enhances the adaptability to different data sets, reduces computational complexity and resource consumption, alleviates the problem of distribution offset, and achieves fast and accurate long-term prediction of time series data.
Smart Images

Figure CN118820784A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of long-term prediction of time series, and in particular relates to a method, device and medium for long-term prediction of time series data based on MLP. Background Art
[0002] Time series refers to a series of values collected according to the same statistical indicator arranged in the order of their occurrence. With the increasing degree of digitization, the scenarios and number of time series are growing, such as traffic flow series, sales series, climate data series, etc. Forecasting, as an important direction in time series analysis, has been widely studied in the past few decades. With the continuous increase in computing power and data volume, people have also put forward higher and higher requirements for the accuracy and scope of time series prediction. In recent years, more and more studies have begun to focus on multi-step prediction of time series. Compared with one-step prediction, multi-step prediction provides users with an estimate of the entire future path, allowing decision makers to plan in advance, allocate resources in time, and dynamically adjust strategies, which is crucial for transportation, energy, climate and other fields. In multi-step prediction, compared with short-term prediction, long-term prediction is more difficult, but the benefits are greater, and it is backward compatible, which further enhances the advantages of the above aspects, can provide decision makers with more decision-making time and space, and further reduce decision-making pressure.
[0003] Currently, a lot of research is devoted to long-term prediction of time series data, but there are also a series of challenges:
[0004] 1. The versatility of existing multi-step forecasting methods needs to be improved. Traditional time series forecasting methods are often difficult to adapt to the needs of a variety of different business scenarios, and require a lot of manpower and material resources to design targeted algorithms for different business scenarios. Thanks to its powerful generalization ability, the deep learning algorithm has solved this pain point to a certain extent. Chinese patent application CN117713053A discloses a method for power load forecasting that integrates graph structure representation. The deep learning model that integrates graph structure representation is trained through historical power load time series data samples of multiple target customers in multiple target areas to obtain a power load forecasting model. However, this feature fusion strategy causes the structure of the model used in the method to be significantly dependent on the different characteristics of the specific business scenario. The designed model is difficult to train across many cross-domain data sets like the large models in NLP and CV, which limits the versatility of the model.
[0005] 2. Existing multi-step forecasting methods have an imbalanced modeling of seasonality and trend. Seasonality and trend are two basic characteristics that are widely present in time series. Recent studies usually use a sequence decomposition module to decompose time series into seasonal terms and trend terms, and then model and forecast the decomposed terms separately. However, most methods still focus on modeling seasonal terms, and the modeling of trend terms is relatively rough, which is obviously unreasonable and limits the versatility of the model.
[0006] 3. The existing multi-step prediction methods need to be made more lightweight. Recently, the general large model based on Transformer has shown strong generalization ability in the fields of NLP and CV, but Transformer consumes a lot of computing resources. In the time series field, there are many scenarios that have high requirements for timeliness. If Transformer is applied to the field of time series prediction, it will seriously hinder the timeliness and deployment of the method.
[0007] In summary, it is necessary to design a highly versatile long-term prediction method for time series data that can quickly and accurately perform long-term predictions on time series data. Summary of the invention
[0008] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and to provide a method, device and medium for long-term prediction of time series data based on MLP, which can quickly and accurately realize long-term prediction of time series data.
[0009] The purpose of the present invention can be achieved by the following technical solutions:
[0010] The present invention provides a method for long-term prediction of time series data based on MLP, comprising the following steps:
[0011] Obtain multidimensional time series data with a dimension of N, input the time series data long-term prediction model based on MLP, and obtain the time series data long-term prediction results;
[0012] The MLP-based time series data long-term prediction model includes a multi-scale decomposition module, a parallel downsampling information fusion module and a local information extraction module in sequence. The downsampling information fusion module and the local information extraction module are followed by a covariate fusion module. The MLP-based time series data long-term prediction model processes the input data as follows:
[0013] S1. Adopting the channel independence strategy, the N-dimensional time series is regarded as N one-dimensional time series, and each one-dimensional time series is decoupled by the multi-scale decomposition module to obtain the corresponding seasonal term and trend term;
[0014] S2, inputting the seasonal term into the downsampling information fusion module to extract and fuse periodic features at different granularities, and obtaining a preliminary prediction value of the seasonal term; inputting the trend term into the local information extraction module to further extract global information interaction and local features, and obtaining a preliminary prediction value of the trend term;
[0015] S3, the covariate fusion module fine-tunes the preliminary prediction value of the seasonal item and the preliminary prediction value of the trend item respectively by introducing the time covariate information, and then adds the fine-tuned preliminary prediction value of the seasonal item and the preliminary prediction value of the trend item to obtain the preliminary prediction value of the input time series;
[0016] S4. Input the preliminary prediction value of the input time series into the covariate fusion module for fine-tuning again, and then perform inverse normalization through RevIN to obtain the long-term prediction result of the time series data.
[0017] Furthermore, in step S1, each one-dimensional time series is normalized by RevIN and then input into the multi-scale decomposition module. The data processing process of the multi-scale decomposition module is as follows:
[0018] Perform padding and average pooling operations on the normalized one-dimensional time series to obtain trend items with different cycle lengths, and then decouple to obtain seasonal items with different cycle lengths;
[0019] The trend term and seasonal term under each cycle length are fused separately to obtain the seasonal term and trend term of each one-dimensional time series.
[0020] Further, in step S2, the downsampling information fusion module includes M layers of stacked downsampling fusion submodules, wherein the first M-1 layers of downsampling fusion submodules are used to fuse the periodic features of the downsampling sequences of different granularities, and generate the intermediate layer hidden states of the seasonal item prediction values layer by layer, and the last layer of downsampling fusion submodules are used to map the periodic features of the downsampling sequences of different granularities through a multilayer perceptron to obtain the preliminary prediction value of the seasonal item;
[0021] Among them, each layer of downsampling fusion submodule includes multiple parallel downsampling information extraction units, and each downsampling information extraction unit sequentially performs downsampling, dimension expansion and restoration operations on the input data at a certain granularity to obtain the periodic characteristics of a granular downsampling sequence.
[0022] Furthermore, the specific calculation process of the downsampling information extraction unit with a sampling granularity of A is as follows:
[0023]
[0024] (Used when M=1)
[0025] in, represents the input of layer l and the output of layer l-1, D s is the hidden layer dimension of the intermediate layer output item in the downsampling fusion submodule, sampling() is downsampling, Flatten() means expanding the time dimension and variable dimension of the input, MLP is a multi-layer perceptron, Resape() means restoring the input to the shape of the time dimension or variable dimension, merge() means restoring the downsampled sequence in the original time order, represents the seasonal item sequence predicted after downsampling operation with granularity A, L is the look-back window length, It represents the seasonal item sequence predicted after the downsampling operation with a granularity of A, and H is the length of the prediction window.
[0026] Further, in step S2, the local information extraction module includes a convolutional layer, a local enhancement layer and a fully connected layer in sequence;
[0027] Among them, the convolution layer is used to aggregate local features of the trend item, the local enhancement layer includes two multi-layer perceptrons, which act on the time dimension and the variable dimension respectively, and are used for global information interaction and further extraction of local information. The fully connected layer is used to obtain a preliminary prediction value of the trend item according to the output of the local enhancement layer.
[0028] Furthermore, the convolution layer is a group of one-dimensional convolutions, and its stride is set to half the size of the convolution kernel.
[0029] Furthermore, the specific calculation process of the local enhancement layer is as follows:
[0030]
[0031] in, To represent the input of the lth local enhancement layer and the output of the l-1th local enhancement layer, MLP T () represents a multi-layer perceptron, MLP, acting on the time dimension V () represents a multi-layer perceptron acting on the variable dimension, is the output of the lth local enhancement layer.
[0032] Furthermore, the specific calculation process of the covariate fusion module is as follows:
[0033] Y′ mark =Embedding(Y mark )
[0034] Y″=MLP V (concat(Y′,Y′ mark ))
[0035] Among them, Y mark represents the original time covariate, Y′ mark represents the embedded time covariate, Y′ represents the preliminary forecast value of the trend item, the preliminary forecast value of the seasonal item or the preliminary forecast value of the input time series of the module, concat() represents concatenation of the input in the variable dimension, MLP V () represents a multilayer perceptron acting on the variable dimension, and Y" is the output of this module.
[0036] The present invention also provides an electronic device, comprising a memory, a processor, and a program stored in the memory, wherein the processor implements the above method when executing the program.
[0037] The present invention also provides a computer-readable storage medium on which a computer program is stored, and the program implements the above method when executed by a processor.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] 1. The present invention designs a long-term prediction model for time series data based on MLP, which can obtain long-term prediction results of time series data according to multidimensional time series, wherein the long-term prediction model for time series data based on MLP includes a multi-scale decomposition module, a down-sampling information fusion module, a local information extraction module and a covariate fusion module, and its processing process for input data is as follows: First, a channel independence strategy is adopted to regard the N-dimensional time series as N one-dimensional time series, and each one-dimensional time series is decoupled by a multi-scale decomposition module to obtain corresponding seasonal terms and trend terms; then, the seasonal term is input into the down-sampling information fusion module to extract and fuse periodic features at different granularities to obtain a preliminary prediction value of the seasonal term, and the trend term is input into the local information extraction module to perform global information interaction and further extract local features to obtain a preliminary prediction value of the trend term; secondly, the covariate fusion module fine-tunes the preliminary prediction value of the seasonal term and the preliminary prediction value of the trend term by introducing time covariate information, and the fine-tuned preliminary prediction value of the seasonal term and the preliminary prediction value of the trend term are respectively used. The preliminary prediction values of the trend items are added to obtain the preliminary prediction values of the input time series; finally, the preliminary prediction values of the input time series are input into the covariate fusion module for fine-tuning again, and then inverse normalized through RevIN to obtain the long-term prediction results of the time series; the above scheme is based on the channel independence strategy, which can efficiently decouple the input sequence, realize cross-dataset training and prediction, and enhance the versatility of the model; at the same time, targeted modeling schemes are designed according to the characteristics of seasonal items and trend items, which improves the ability of the model to be applied to data sets with different characteristics and enhances the versatility of the model. Specifically, a downsampling information fusion module is designed for the seasonal item. While explicitly retaining the periodicity of the sequence, the hidden periodic features are mined from the perspective of the sequence as a whole. A local information extraction module is designed for the trend item to strengthen the connection between adjacent time steps in the trend item and capture its local features; finally, a covariate fusion module is designed to integrate the preliminary prediction value with the time information to improve the prediction performance and versatility of the model.
[0040] 2. In the present invention, the downsampling information fusion module includes M layers of stacked downsampling fusion submodules, wherein the first M-1 layers of downsampling fusion submodules are used to fuse the periodic features of downsampling sequences of different granularities, and generate the intermediate hidden states of seasonal item prediction values layer by layer, and the last layer of downsampling fusion submodules are used to map the periodic features of downsampling sequences of different granularities through a multi-layer perceptron to obtain preliminary prediction values of seasonal items; each layer of downsampling fusion submodule includes a plurality of parallel downsampling information extraction units, and each downsampling information extraction unit sequentially performs downsampling, dimensional expansion and restoration operations on the input data at a granularity to obtain the periodic features of a downsampling sequence of a granularity, which not only retains the characteristics of the time series, but also reduces the influence of redundant information and reduces the computational complexity.
[0041] 3. In the present invention, the local information extraction module includes a convolution layer, a local enhancement layer and a fully connected layer, wherein the convolution layer is used to aggregate local features of the trend item, and the convolution layer is a group of one-dimensional convolutions, and its stride is set to half the size of the convolution kernel, which can reduce redundant information and reduce the complexity of subsequent operations; the local enhancement layer includes two multi-layer perceptrons, one of which acts on the time dimension and can perform a global information interaction on the local information processed by the convolution layer to obtain effective information that may exist in the distance, and the other acts on the variable dimension and can perform further feature extraction on the local information of each time step. Therefore, the complex feature representation that can be learned by the local enhancement layer has good generalization ability for unseen data.
[0042] 4. In the present invention, the covariate fusion module can enable the model to effectively perceive the role of time covariates and avoid the loss of effective information; finally, by performing inverse normalization through RevIN, the long-term prediction results of the time series can alleviate the distribution offset problem of the time series.
[0043] 5. In the MLP-based time series data long-term prediction model proposed in the present invention, each module is mainly designed based on a multi-layer perceptron. Compared with previous long-term prediction methods, it has greatly improved the training and inference speed and GPU memory usage. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a schematic diagram of the structure of the long-term prediction model for time series data based on MLP.
[0045] Among them, X t is the input, X season and X trend are the seasonal term and the trend term, Y s ' eason and Y t ' rend are the preliminary forecast values of seasonal term and trend term, respectively, mark and Y m ' mark are the original time covariate and the embedded time covariate, Y″ season and Y" trend are the preliminary forecast values of the seasonal term and the trend term after fine-tuning, The final prediction result;
[0046] Figure 2 It is a structural diagram of the downsampling information fusion module.
[0047] in, is the input of the lth layer and the output of the l-1th layer. Flatten means expanding the time dimension and variable dimension of the input. Reshape means restoring the input to the shape of the time dimension or variable dimension. is the down-sampling sequence after multi-layer perceptron feature extraction in the lth layer, M is the total number of layers of down-sampling fusion modules stacked in the seasonal term, represents the set of prediction values obtained by |Σ| downsampling information extraction modules in the last layer, and A, B, ... represent different downsampling granularities;
[0048] Figure 3 It is a structural diagram of the local information extraction module.
[0049] in, is the trend term after one-dimensional convolution, and N is the dimension of the input time series;
[0050] Figure 4 It is a schematic diagram of the structure of the covariate fusion module.
[0051] Among them, concat means concatenating the input in the variable dimension;
[0052] Figure 5 Schematic diagram of downsampling a sequence at different granularities.
[0053] Among them, (5a) corresponds to the original sequence, (5b) corresponds to the downsampling with a granularity of 2, and (5c) corresponds to the downsampling with a granularity of 3. In (5a), (5b) and (5c), the horizontal axis represents time and the vertical axis represents the occupancy measure;
[0054] Figure 6 This is a schematic diagram of the weight distribution of seasonal items and trend items in the forecasting process.
[0055] Among them, (6a) is a schematic diagram of the weight distribution of the seasonal term in the prediction process, and (6b) is a schematic diagram of the weight distribution of the trend term in the prediction process. In (6a) and (6b), the horizontal axis represents the input time step, and the vertical axis represents the predicted future time step. The darker the color, the higher the weight of the corresponding time step.
[0056] Figure 7 This is the original input diagram of the power data set;
[0057] Figure 8 This is a schematic diagram of the seasonal items of the power data set;
[0058] Fig. 9 It is a schematic diagram of trend items of the power data set;
[0059] Fig.10 This is a schematic diagram of the result of downsampling information fusion of seasonal items in power data.
[0060] Among them, (10a) is the real future value of the seasonal term, (10b), (10c), (10d) and (10e) are the predicted values of the seasonal term at four sampling granularities of 2, 3, 4 and 6 respectively;
[0061] Fig.11 Schematic diagram of the results of local information extraction for power data trend items.
[0062] Among them, (11a) is the real future value of the trend item, and (11b) is the predicted value obtained after extracting the local information of the trend item;
[0063] Fig.12 This is a schematic diagram of the final prediction results. DETAILED DESCRIPTION
[0064] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0065] Example:
[0066] This embodiment provides a long-term prediction method for time series data based on MLP, including the following steps:
[0067] Obtain multidimensional time series data with dimension N, input the MLP-based time series data long-term prediction model, and obtain the long-term prediction results of the time series data.
[0068] The structural diagram of the long-term prediction model for time series data based on MLP is as follows: Figure 1 As shown in Figure 1, it includes a multi-scale decomposition module, a downsampling information fusion module, a local information extraction module, and a covariate fusion module. The MLP-based time series data long-term prediction model processes the input data as follows:
[0069] S1. Adopting the channel independence strategy, the N-dimensional time series is regarded as N one-dimensional time series. Each one-dimensional time series is decoupled through a multi-scale decomposition module to obtain the corresponding seasonal term and trend term.
[0070] In order to meet the input form of deep learning, it is necessary to construct a sliding window. In this embodiment, the length of the review window is set to L and the length of the prediction window is set to H. t-L+1:t ∈R L×N , this embodiment adopts the channel independence strategy and regards it as N one-dimensional sequences The true value of the i-th time series in the look-back window at time step t is Indicates that the true value in the predicted field of view is used Indicates that the temporal covariate information in the prediction horizon is used (r is the number of time covariates). The task of this embodiment is to predict the time step in the future field of view when the review window information and the time covariate information are known. Therefore, the problem can be expressed as formula (1):
[0071]
[0072] For the sake of convenience, X is used in the following text. t express use express Use Y t express Use Y mark express For input X t , firstly normalize it by applying RevIN, and then decompose it into seasonal terms X through the multi-scale sequence decomposition module season and trend term X trend ,The data processing process of the multi-scale decomposition module is as follows:
[0073] Perform padding and average pooling operations on each one-dimensional time series to obtain trend items with different cycle lengths, and then decouple to obtain seasonal items with different cycle lengths;
[0074] The trend term and seasonal term under each cycle length are fused separately to obtain the seasonal term and trend term of each one-dimensional time series.
[0075] The above process can be expressed by equations (2) to (6):
[0076]
[0077] X trend,i =AvgPool(Padding(X t )) i (3)
[0078] X season,i =XX trend,i (4)
[0079] X trend =mean(X trend,1 ,X trend,2 ,..,.X trend,n ) (5)
[0080] X season =mean(X season,1 ,X season,2 ,..,.X season,n ) (6)
[0081] Among them, X trend,i ∈R L×1 , X season,i ∈R L×1 represents the trend term and seasonal term obtained under the length of the i-th cycle, X trend ∈R L×1 , X season ∈R L×1 It represents the final trend term and seasonal term obtained after multi-period fusion. Avgpool and Padding are average pooling and padding operations respectively, which can keep the sequence length unchanged. concat() means concatenating the input in the time dimension, and linear() means concatenating the input in the time dimension. Map to P represents the length of the maximum decomposition period set for the current sequence.
[0082] S2. Input the seasonal item into the downsampling information fusion module to extract and fuse the periodic features at different granularities to obtain the preliminary prediction value of the seasonal item; input the trend item into the local information extraction module to further extract the global information interaction and local features to obtain the preliminary prediction value of the trend item.
[0083] For seasonal items X season Before processing, this embodiment first performs seasonal item X season This example uses a simple fully connected layer to analyze the seasonal term X season The prediction is performed with a look-back window length of 336 and a prediction length of 96. The weights of the trained fully connected layer are visualized, as shown in Figure 6 As shown in (6a), the horizontal axis represents the input time step, and the vertical axis represents the predicted future time step. The darker the color, the higher the weight of the corresponding time step. Figure 6 (6a) shows that the seasonal term X season When predicting, the weights are distributed throughout the time series along with the cycle length, so for the seasonal term X season While explicitly retaining the periodicity of the sequence, we should explore the hidden periodic features in the sequence from the perspective of the sequence as a whole.
[0084] Therefore, this embodiment designs a downsampling information fusion module for extracting the periodic characteristics of seasonal sequences, and its structure is as follows: Figure 2 shown. Figure 5 This is a schematic diagram of sampling a sequence at different granularities. It can be found that the time series has a certain redundancy in the time dimension. After the original sequence is downsampled, the downsampled sequence can still retain the periodic characteristics of the original sequence. Therefore, this embodiment downsamples the seasonal term X seasonDownsampling is performed to extract periodic features from the downsampled sequence, which not only retains the sequence features, but also reduces the impact of redundant information and reduces computational complexity. In addition, considering that downsampled sequences of different granularities can provide periodic features at different resolutions, the original sequence is downsampled at different granularities, and the information extracted at different granularities is fused to further improve the ability to extract periodic features.
[0085] The above process can be expressed by equations (7) to (9):
[0086] When M>1:
[0087]
[0088] Else:
[0089]
[0090] Among them, M represents the total number of layers of downsampling fusion modules stacked in the seasonal term, l represents the current layer number, represents the input of layer l and the output of layer l-1, D s represents the hidden layer dimension of the intermediate layer output item in the downsampling fusion module. When l = 1, D s =1, represents the set of prediction values obtained by |∑| downsampling information extraction modules in the last layer, where A, B, …∈Σ, A, B, … represent different downsampling granularities.
[0091] multi-downsasmplint() consists of a series of parallel downsampling information extraction modules, which are used to obtain the periodic characteristics of downsampling sequences of different granularities. fusion () contains multi-downsasmpling() and an MLP (multi-layer perceptron) acting on the variable dimension. The MLP is used to fuse the periodic features of the downsampled sequences of different granularities.
[0092] In multi-downsasmpling(), the specific calculation process of the downsampling information extraction module with a sampling granularity of A is shown in equations (10) to (13):
[0093]
[0094]
[0095] Among them, sampling() A Indicates a downsampling operation with a granularity of A, generating a total of A groups of downsampling sequences (When l=1, D s =1). represents the downsampled sequence after MLP feature extraction in the lth layer, i∈[1,A], Flatten() means expanding the time dimension and variable dimension of the input, Reshape() means restoring the input to the shape of the time dimension or variable dimension, merge() means restoring the downsampled sequence according to the original time order, represents the sequence restored after the downsampling information extraction with granularity A in the lth layer, Represents the seasonal term sequence predicted after downsampling with a granularity of A.
[0096] downsasmpling fusion The specific calculation process of () is shown in equations (14) to (15):
[0097]
[0098] Among them, MLP V () represents a multi-layer perceptron acting on the feature dimension, concat() represents concatenating the input in the variable dimension, It represents the sequence after the fusion of the downsampling results of different granularities. Figure 2 As shown, when located in the middle layer, use downsasmpling fusion () Downsampling results of different granularities Fusion As the input of the next layer; when it is in the last layer, directly multi-downsasmpling() through the MLP mapping to obtain the predicted sequence set Input to subsequent modules without fusion operation.
[0099] For trend item X trend Before processing, this embodiment first performs the trend item X trend The features in the prediction process are analyzed. This embodiment uses a simple fully connected layer to predict the trend item, where the length of the review window is 336 and the prediction length is 96. The weights of the trained fully connected layer are visualized, as shown in Figure 6 As shown in (6b), the horizontal axis represents the input time step, and the vertical axis represents the predicted future time step. The darker the color, the higher the weight of the corresponding time step. Figure 6 From (6b), we can find that the weight of the trend term is distributed in the entire time series along with the cycle length during prediction. Therefore, for the trend term, we should strengthen the connection between adjacent time steps as much as possible to capture its local characteristics.
[0100] Therefore, this embodiment designs a local information extraction module for extracting local features of trend sequences, and its structure is as follows: Figure 3 As shown in Figure 1, it includes convolutional layer, local enhancement layer and fully connected layer in sequence. The convolutional layer is a set of one-dimensional convolutions to trend To aggregate local features, this embodiment selects a larger convolution kernel, and considering the high similarity of local information obtained at adjacent time steps, the stride is set to half the size of the convolution kernel, which reduces redundant information and reduces the complexity of subsequent operations. The local enhancement layer includes two multi-layer perceptrons, one acting on the time dimension to perform a global information interaction on the local information after convolution processing to obtain valid information that may exist in the distance; the other acting on the variable dimension to perform further feature extraction on the local information of each time step. Finally, the obtained hidden state is expanded and processed through a fully connected layer to obtain the preliminary prediction value of the trend item.
[0101] The above process can be expressed by equations (16) to (18):
[0102]
[0103] Where N represents the total number of stacked layers of local information extraction modules in the trend item, l represents the current layer number, Represents the result of one-dimensional convolution processing, L t represents the number of time steps after convolution, D t represents the hidden layer dimension after convolution, represents the input of the lth layer and the output of the l-1th layer, Y′ trend ∈R H×1 It is the preliminary prediction result of the trend item. Conv1d() represents one-dimensional convolution, Flatten() represents expanding the input time dimension and variable dimension, and Linear() represents a single-layer fully connected layer.
[0104] The specific calculation steps of the local enhancement layer local-enhance() are shown in equations (19) to (20):
[0105]
[0106] Among them, MLP T () represents a multi-layer perceptron, MLP, acting on the time dimension V () represents a multilayer perceptron acting on the variable dimension.
[0107] S3, the covariate fusion module fine-tunes the preliminary prediction values of the seasonal item and the preliminary prediction values of the trend item by introducing the time covariate information, and then adds the fine-tuned preliminary prediction values of the seasonal item and the preliminary prediction values of the trend item to obtain the preliminary prediction value of the input time series.
[0108] S4. Input the preliminary prediction value of the input time series into the covariate fusion module for fine-tuning again, and then perform inverse normalization through RevIN to obtain the long-term prediction result of the time series.
[0109] The structure of the covariate fusion module is as follows Figure 4 As shown, the calculation process in this module is shown in equations (21) to (22):
[0110] Y′ mark =Embedding(Y mark ) (twenty one)
[0111] Y″=MLP V (concat(Y′,Y′ mark )) (twenty two)
[0112] in, represents the original time covariate, D m represents the number of original time covariates, represents the embedded time covariate, D′ m represents the embedding dimension of the temporal covariate, Y″ represents the output of the module, and Y′ represents Y′ season or Y′ trend or (Y" season +Y" trend ), MLP V () represents a multi-layer perceptron acting on the variable dimension, and concat() represents concatenating the input in the variable dimension. If some covariates have a strong influence on the actual value of a certain time step, this module can enable the model to effectively perceive the role of the relevant covariates and avoid the loss of effective information.
[0113] Taking the power data set as an example, the data set contains electricity consumption data recorded by 321 sensors from July 1, 2016 to July 1, 2019. The sensors collect data once an hour and generate 24 records per day. In the experiment, this embodiment uses z-score to normalize the data, and uses time information such as hours, weeks, years, months, and days as model inputs. Finally, the data set is divided into training set, validation set, and test set in a ratio of 7:1:2.
[0114] The first step is multi-scale sequence decomposition. Before algorithm processing, in order to alleviate the distribution shift problem between the training set and the test set, it is necessary to normalize the data of each window again so that the mean of the window input data is 0 and the standard deviation is 1. The results are as follows: Figure 7 Then, the normalized data is sequence decomposed to obtain seasonal items and trend items. This embodiment uses moving average to smooth seasonal fluctuations, highlight long-term trends, and fuses the seasonal items and trend items obtained under different cycle lengths to obtain the final seasonal pattern and trend pattern, respectively. Figure 8 and Fig. 9 shown.
[0115] The second step is to fuse the down-sampling information of the seasonal items. In the process of extracting features from the seasonal items of the power data set, this embodiment selects four sampling granularities of 2, 3, 4, and 6, and obtains the predicted values under different down-sampling granularities, as shown in the figure below. Fig.10 As shown in (10b), (10c), (10d) and (10e), the real future value is Fig.10 As shown in (10a), as the downsampling granularity increases, the sequence gradually becomes smoother and shows different features in details. Then a multi-layer perceptron is used to fuse the information of different downsampling results.
[0116] The third step is to extract local information from the trend item. In this embodiment, a set of one-dimensional convolutions are first used to extract local information from the trend item X. trend Aggregate local features. The convolution kernel size selected here is 16. Considering the high similarity of local information obtained from adjacent time steps, this embodiment sets the stride to half of the convolution kernel size. Then, a multilayer perceptron acting on the time dimension is introduced to perform a global information interaction on the local information after convolution processing to obtain valid information that may exist in the distance, and a multilayer perceptron acting on the variable dimension is used to further extract features from the local information of each time step. Finally, the hidden state is expanded and processed through a fully connected layer to obtain the preliminary prediction result of the trend item. The true future value is as follows: Fig.11 As shown in (1a), the prediction results are Fig.11 as shown in (11b).
[0117] The fourth step is to combine the preliminary prediction results of the seasonal term and the trend term through the covariate module. After obtaining the prediction values of the seasonal term and the trend term, this embodiment combines the time covariate information to perform a series of fine-tuning on the two again, and performs a reverse normalization on the prediction value according to the mean variance within the window, so as to finally obtain the prediction result, such as Fig.12 As shown, it can be seen that the predicted value is close to the true value.
[0118] To verify the effectiveness of the above method and compare it with other existing methods, the following experiments were also conducted in this embodiment:
[0119] A. Verify the versatility and predictive power of the above methods
[0120] This embodiment conducts experiments in seven single-domain datasets and one self-built cross-domain large dataset. The seven single-domain datasets are Weather (https: / / www.bgc-jena.mpg.de / wet ter / ), Traffic1 (https: / / pems.dot.ca.gov / ), Electricity (https: / / archive.ics.uci.edu / ml / datasets / ElectricityLoadDiagrams20112014), ETTh1, ETTh2, ETTm1, and ETTm2 (https: / / github.com / zhouhaoyi / ETDataset). The self-built cross-domain large dataset is expanded on the basis of the above seven datasets and Traffic2 (https: / / pems.dot.ca.gov / ) and Solar (http: / / www.nrel.gov / grid / sol ar-power-data.html).
[0121] Among these nine single-domain datasets, Weather is a weather dataset collected in the United States, which contains 21 climate indicators such as humidity and pressure; Traffic1 is a traffic dataset statistically collected by the California Department of Transportation, which contains lane occupancy data measured by 862 sensors; Traffic2 is a traffic dataset statistically collected by the California Department of Transportation, which records the speed and flow data of 7 sections on the SR99-S highway in District 10; Electricity is an electricity dataset that contains hourly electricity consumption data of 321 customers; ETTh1, ETTh2, ETTm1, and ETTm2 are datasets composed of power transformer data, which record 6 power load characteristics and 1 oil temperature data of power transformers; Solar is a solar energy dataset that records solar power generation data from 137 sensors. All data can be obtained from the provided website, and the details of the datasets are shown in Table 1.
[0122] Table 1 Details of nine single-domain datasets
[0123]
[0124]
[0125] In the cross-domain large-scale data set, this embodiment aggregates the time steps of Traffic2, Weather, ETTm1, ETTm2, and Solar data sets with higher sampling frequencies to obtain data with different sampling frequencies in the corresponding fields. Specifically, the Weather, ETTm1, ETTm2, and Solar data sets are aggregated into the time series WeatherA, ETTm1A, ETTm2A, and SolarA with a sampling frequency of 1h / time, and the Traffic2 data set is aggregated into Traffic2A with a sampling frequency of 10min / time and Traffic2B with a sampling frequency of 15min / time. The detailed information of each sub-data set contained in the final cross-domain data set is shown in Table 2.
[0126] Table 2 Details of large cross-domain datasets
[0127]
[0128]
[0129] This example selects a large number of Transformer-based SOTA models, including PatchTST, FEDformer, Autoformer, Informer, Pyraformer, LogTrans, and the recent Linear-based SOTA model LTSF-Linear as baselines. All models follow the same experimental settings, with a look-back window length of L = 336 and a prediction length of H∈{96,192,336,720}.
[0130] In order to fully evaluate the model performance, this application follows previous studies [1][2] In this method, experiments were first conducted in 7 sub-datasets (Weather, Traffic1, Electricity, ETTh1, ETTh2, ETTm1, and ETTm2). Weather, Traffic1, and Electricity were divided into training set, validation set, and test set according to the ratio of 7:1:2. ETTh1, ETTh2, ETTm1, and ETTm2 were divided into training set, validation set, and test set according to the ratio of 6:2:2. In this part, MSE was selected as the loss function, the ADAM optimizer was used, early stopping was set, and hyperparameters were selected by random search. The specific settings of the remaining hyperparameters can be obtained in the auxiliary materials. All experiments were repeated three times and the average value was taken as the final report result. In order to ensure the consistency of the result report, this embodiment starts from [1]Some evaluation results of the above baseline models are collected in . During the experiment, in each epoch, training is performed on the entire training set and evaluation is performed on the complete validation set and test set.
[0131] [1] Wu, H., Xu, J., Wang, J., & Long, M. (2021). Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. Advances in neural information processing systems, 34, 22419-22430.
[0132] [2]Zhou, T., Ma, Z., Wen, Q., Wang,
[0133] In order to further evaluate the versatility and generalization ability of the model, this embodiment further experiments the model and the baseline model that applies the channel independence strategy in a large cross-domain dataset. This embodiment divides the LTS dataset into training set, validation set, and test set from the perspective of sub-datasets, where Weather, Traffic1, Electricity and its derivative datasets are divided according to 7:1:2, and ETTh1, ETTh2, ETTm1, ETTm2 and its derivative datasets are divided according to 6:2:2. In this part, MAE is selected as the loss function, the ADAM optimizer is used, early stopping is set, and hyperparameters are selected by random search. The specific settings of the remaining hyperparameters can be obtained in the auxiliary materials. All experiments are repeated three times and the average value is taken as the final report result. In this part of the experiment, considering the large dataset, when training in each epoch, 20 sliding windows of data are randomly extracted from each sequence for training, and then evaluated in the complete validation set and test set.
[0134] Table 3 shows the long-term prediction results of the models trained on seven single-domain datasets, where the best results are in bold and the second best results are underlined. This example evaluates the MSE, MAE, and SMAPE indicators of ST-Mixer (Season-Trend Mixer, the method proposed in this example) and seven baseline models at 96, 192, 336, and 720 time steps, totaling 84 items. This example uses PatchTST [1] The article extracts the relevant results of MSE and MAE of the baseline model, and uses the code provided in PatchTST (see yuqinie98 / PatchTST:An offical implementation of PatchTST:"A Time Series isWorth 64Words:Long-term Forecasting with Transformers."ICLR 2023,https: / / arxiv.org / abs / 2211.14730(github.com)) to calculate the SMAPE of the better performing PatchTST and Dlinear. It can be observed that in all data sets, the effects of ST-Mixer and PatchTST are much better than other baselines. Among the 84 indicators in total, ST-Mixer of this embodiment won the first place in 47 of them and the second place in 32 of them, while PatchTST won the first place in 43 of them and the second place in 39 of them. It can be seen that the method of this embodiment is slightly better than PatchTST based on Transformer in accuracy. In addition, for Linear-based Dlinear, ST-Mixer outperforms it in almost all indicators, which shows the effectiveness of the targeted modeling of decomposition items and the covariate fusion module designed in the model of this embodiment.
[0135] Table 3 Long-term prediction results in seven sub-datasets
[0136]
[0137] Table 4 shows the long-term prediction results obtained by training the model in a large LTS dataset, where the best result is indicated by bold and the second result is indicated by underline. In this dataset, ST-Mixer (the method proposed in this embodiment) is compared with PatchTST and LTSF-Linear, which apply the channel independence strategy. This embodiment evaluates the MSE, MAE and SMAPE indicators of the three models at 96, 192, 336 and 720 prediction time steps, a total of 12 items. Among these 12 indicators, the method ST-Mixer proposed in this embodiment won the first place in 9 of them, and PatchTST won the first place in only 3 of them. The three models in LTSF-Linear have too simple structures, which makes it difficult to adapt to complex multi-scenario data, so their overall performance is poor. Compared with the situation in a single dataset, ST-Mixer has a significant improvement over PatchTST. This may be because ST-Mixer takes into account the modeling of seasonal terms and trend terms, allowing the model to make predictions based on the characteristics of various types of datasets. PatchTST directly models the entire sequence, which may make it difficult to identify hidden time patterns in different datasets, so the effect is slightly inferior to ST-Mixer.
[0138] Table 4. Long-term prediction results of LTS dataset
[0139]
[0140] B. Verify the advantages of the above method in lightweighting
[0141] This example compares the training time, inference time, and GPU memory usage of ST-Mixer and PatchTST in each epoch in a large cross-domain dataset with the same batch size. The training time refers to the time spent on randomly extracting 20 sliding windows of data from each sequence for training, the inference time refers to the time spent on testing in the entire test set, and the GPU memory usage refers to the maximum memory occupied during the entire training and inference process.
[0142] The specific results are shown in Table 5, where the running time is in seconds and the memory usage is in GB. It can be found that although PatchTST greatly reduces the number of tokens that the model needs to process by dividing the data into patches, due to the high complexity of the transformer structure, the method ST-Mixer proposed in this embodiment still shows an average lead of 78% and 46% in inference speed and GPU memory usage, respectively. In terms of training speed, since each epoch in the experimental setting only performs sampling training in a small range, the gap between ST-Mixer and PatchTST is not obvious, but it still maintains an average lead of 5%. It can be found that ST-Mixer can have higher computational and memory efficiency while achieving better or similar accuracy.
[0143] Table 5 Memory usage and training and inference time
[0144]
[0145] In summary, this embodiment proposes a long-term prediction method for time series data based on MLP. Based on the channel independence strategy, it can realize cross-dataset training and prediction, and enhance the versatility of the model. RevIN is applied to normalize and denormalize the input and predicted values according to the mean variance of the sequence in each input window, which can alleviate the distribution shift problem of the time series. An improved multi-scale sequence decomposition module is applied at the input of the model to convert the window input X t Decompose into seasonal terms X season and trend term X trend Then, the characteristics of seasonal and trend terms are analyzed, and targeted modeling schemes are designed to improve the ability of the model to be applied to data sets with different characteristics. Specifically, a downsampling information fusion module is designed for seasonal terms. While explicitly retaining the periodicity of the sequence, the hidden periodic features are mined from the perspective of the sequence as a whole, and the preliminary prediction value Y′ of the seasonal term is obtained. season , a local information extraction module is designed for the trend item to strengthen the connection between adjacent time steps in the trend item, capture its local features, and obtain the preliminary prediction value Y′ of the trend item trend . A covariate fusion module is designed to integrate time information and fine-tune the preliminary prediction values of each decomposition item, improving the model's ability to handle data of different sampling granularities. The fine-tuned values are then added together to obtain the overall preliminary prediction value, and finally the covariate fusion module is used again for fine-tuning to obtain the final time series long-term prediction result. In addition, the model is mainly built based on MLP, which has greatly improved the training inference speed and GPU memory usage compared to previous long-term prediction methods.
[0146] If the above method is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0147] The above description of the embodiments is to facilitate the understanding and use of the invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present invention without departing from the scope of the present invention should be within the scope of protection of the present invention.
Claims
1. A long-term prediction method for time series data based on MLP, characterized in that: The following steps are involved: Obtain multidimensional time series data with a dimension of N, input the time series data long-term prediction model based on MLP, and obtain the time series data long-term prediction results; The MLP-based time series data long-term prediction model includes a multi-scale decomposition module, a parallel downsampling information fusion module and a local information extraction module in sequence. The downsampling information fusion module and the local information extraction module are followed by a covariate fusion module. The MLP-based time series data long-term prediction model processes the input data as follows: S1. Adopting the channel independence strategy, the N-dimensional time series is regarded as N one-dimensional time series, and each one-dimensional time series is decoupled by the multi-scale decomposition module to obtain the corresponding seasonal term and trend term; S2, inputting the seasonal term into the downsampling information fusion module to extract and fuse periodic features at different granularities, and obtaining a preliminary prediction value of the seasonal term; inputting the trend term into the local information extraction module to further extract global information interaction and local features, and obtaining a preliminary prediction value of the trend term; S3, the covariate fusion module fine-tunes the preliminary prediction value of the seasonal item and the preliminary prediction value of the trend item respectively by introducing the time covariate information, and then adds the fine-tuned preliminary prediction value of the seasonal item and the preliminary prediction value of the trend item to obtain the preliminary prediction value of the input time series; S4. Input the preliminary prediction value of the input time series into the covariate fusion module for fine-tuning again, and then perform inverse normalization through RevIN to obtain the long-term prediction result of the time series data.
2. The method for long-term prediction of time series data based on MLP according to claim 1, characterized in that: In step S1, each one-dimensional time series is normalized by RevIN and then input into the multi-scale decomposition module. The data processing process of the multi-scale decomposition module is as follows: Perform padding and average pooling operations on the normalized one-dimensional time series to obtain trend items with different cycle lengths, and then decouple to obtain seasonal items with different cycle lengths; The trend term and seasonal term under each cycle length are fused separately to obtain the seasonal term and trend term of each one-dimensional time series.
3. The method for long-term prediction of time series data based on MLP according to claim 1, characterized in that: In step S2, the downsampling information fusion module includes M layers of stacked downsampling fusion submodules, wherein the first M-1 layers of downsampling fusion submodules are used to fuse the periodic features of the downsampling sequences of different granularities, and generate the intermediate hidden states of the seasonal item prediction values layer by layer, and the last layer of downsampling fusion submodules are used to map the periodic features of the downsampling sequences of different granularities through a multilayer perceptron to obtain the preliminary prediction value of the seasonal item; Among them, each layer of downsampling fusion submodule includes multiple parallel downsampling information extraction units, and each downsampling information extraction unit sequentially performs downsampling, dimension expansion and restoration operations on the input data at a certain granularity to obtain the periodic characteristics of a granular downsampling sequence.
4. The method for long-term prediction of time series data based on MLP according to claim 3, characterized in that: The specific calculation process of the downsampling information extraction unit with sampling granularity A is as follows: in, represents the input of layer l and the output of layer l-1, D s is the hidden layer dimension of the intermediate layer output item in the downsampling fusion submodule, sampling() is downsampling, Flatten() means expanding the time dimension and variable dimension of the input, MLP is a multi-layer perceptron, Reshape() means restoring the input to the shape of the time dimension or variable dimension, merge() means restoring the downsampled sequence in the original time order, represents the seasonal item sequence predicted after downsampling operation with granularity A, L is the look-back window length, It represents the seasonal item sequence predicted after the downsampling operation with a granularity of A, and H is the length of the prediction window.
5. The method for long-term prediction of time series data based on MLP according to claim 1, characterized in that: In step S2, the local information extraction module includes a convolutional layer, a local enhancement layer and a fully connected layer in sequence; Among them, the convolution layer is used to aggregate local features of the trend item, the local enhancement layer includes two multi-layer perceptrons, which act on the time dimension and the variable dimension respectively, and are used for global information interaction and further extraction of local information. The fully connected layer is used to obtain a preliminary prediction value of the trend item according to the output of the local enhancement layer.
6. The method for long-term prediction of time series data based on MLP according to claim 5, characterized in that: The convolutional layer is a set of one-dimensional convolutions with a stride set to half the size of the convolution kernel.
7. The method for long-term prediction of time series data based on MLP according to claim 5, characterized in that: The specific calculation process of the local enhancement layer is as follows: in, To represent the input of the lth local enhancement layer and the output of the l-1th local enhancement layer, MLP T () represents a multi-layer perceptron, MLP, acting on the time dimension V () represents a multi-layer perceptron acting on the variable dimension, is the output of the lth local enhancement layer.
8. The method for long-term prediction of time series data based on MLP according to claim 1, characterized in that: The specific calculation process of the covariate fusion module is as follows: AND' mark =Embedding(Y mark ) And MLP V (concat(Y′,Y′ mark )) Among them, Y mark represents the original time covariate, Y′ mark represents the embedded time covariate, Y′ represents the preliminary forecast value of the trend item, the preliminary forecast value of the seasonal item or the preliminary forecast value of the input time series of the module, concat() represents concatenation of the input in the variable dimension, MLP V () represents a multilayer perceptron acting on the variable dimension, and Y′′ is the output of the module.
9. An electronic device comprising a memory, a processor, and a program stored in the memory, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Operation and maintenance data prediction method and system based on position information adaptive adjustment
CN119961724A
An operation and maintenance data prediction method and system based on adaptive adjustment of location information
CN119961724B
Covariant time sequence prediction method based on multi-scale decoupling
CN120105070A
