Multivariate time sequence long-term prediction method based on multi-scale time sequence feature enhancement

By using multi-branch structure and sequence-patch attention mechanism in the TFEformer model to extract multi-scale features, and combining adaptive fusion and gated feed-forward networks, the problem of insufficient accuracy of the Transformer model in long-term prediction of multivariate time series is solved, significantly. Improved prediction accuracy and robustness.

CN118657253APending Publication Date: 2024-09-17ZHEJIANG UNIV
View PDF 0 Cites 7 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing time series prediction models using Transformer and its improved architecture have poor time series prediction accuracy due to attention mechanism defects and multi-scale time series dependency perception defects, especially for long-term prediction tasks of multivariate time series.

Method used

This paper proposes a long-term prediction method for multivariate time series based on multi-scale time series feature enhancement, called TFEformer. It uses a multi-branch structure and a sequence-patch attention mechanism to extract global and local time series features at multiple time scales, and uses adaptive features to The fusion mechanism realizes adaptive fusion of multi-scale temporal features, and combines the inter-variable attention mechanism and the redesigned gated feed-forward network for feature fusion.

Benefits of technology

The prediction performance on long-term prediction tasks of multivariate time series has been greatly improved, the model's prediction ability and anti-interference ability for long-term time series trends have been enhanced, the prediction error of short-term local fluctuations has been reduced, and the prediction accuracy and robustness have been significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657253A
    Figure CN118657253A
Patent Text Reader

Abstract

The invention discloses a multivariate time sequence long-term prediction method based on multi-scale time sequence feature enhancement, and proposes a time sequence prediction model TFEform, and employs a multi-branch structure and a sequence-patch attention mechanism to extract global and local time sequence features under multiple time scales. A self-adaptive feature fusion mechanism is designed to realize self-adaptive fusion of the multi-scale time sequence features; and utilizing an attention mechanism between variables and a redesigned gating feedforward network to respectively carry out feature fusion between multivariate variables and feature fusion in a time sequence. According to the time sequence prediction model provided by the invention, the prediction effect on the long-term trend in the time sequence is remarkably improved, the fitting capability on short-term local fluctuation is enhanced, and the prediction precision of the model under different prediction time durations in a multivariate time sequence prediction task is comprehensively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of time series prediction, and in particular relates to a multivariate time series long-term prediction method based on multi-scale time series feature enhancement. Background Art

[0002] In many fields such as economy, finance, industry, energy, and environmental monitoring, the research and application of multivariate time series long-term prediction methods are increasingly gaining attention. Time series prediction methods predict possible time series development trends in the future by learning the underlying characteristic laws in historical time series. With the increasing complexity of the use scenarios of prediction models and higher requirements for prediction accuracy and prediction time length, time series prediction problems are gradually moving towards multivariate and long-term predictions for complex systems, which has also led to a gradual increase in the requirements for prediction models. With the increase in the number of variables involved in multivariate time series, the impact of the correlation between multivariate variables on the prediction results has increased. At the same time, long-term prediction tasks have greatly increased the prediction difficulty of the model, posing new challenges to the field of time series prediction.

[0003] In recent years, more and more new methods based on deep learning have been proposed to solve the above-mentioned multivariate time series long-term prediction tasks. However, due to the limitations of model structure and network depth, deep learning models are increasingly weak in extracting long-distance dependencies in time series and it is difficult to make further breakthroughs. Until the Transformer architecture based on the attention mechanism was recently proposed, its dependency extraction capability that is not affected by distance provides a powerful tool for long-term series prediction modeling. In recent years, more and more methods have built time series prediction models based on the Transformer method and have made great progress. However, with the deepening of research, some defects in the traditional Transformer structure have gradually emerged. The potential features in time series data are often contained in a time series, but the embedding layer of the Transformer only vectorizes the information of a single time step as the basic calculation unit, which cannot provide meaningful time series feature information for the attention mechanism to extract correlation, thereby limiting the performance of the attention mechanism; at the same time, the Transformer structure only focuses on the time series dependency at one time scale, and cannot perceive the diversity of time series dependencies at different scales, which also limits the ability of the prediction model to model global and local information at the same time.

[0004] Many existing prediction model methods attempt to solve the inherent defects of the Transformer architecture. The Sepformer model proposed in invention CN114239718B realizes hierarchical extraction of global and local time series features through a discrete network architecture, but is still limited by the defects of the traditional single-step attention mechanism and cannot achieve high-precision prediction; the iTransformer model proposed in the latest paper "iTransformer: Inverted Transformers Are Effective for Time Series Forecasting" published at the International Conference on Representation Learning ICLR2024 expands the computational unit of the attention mechanism to the global sequence through sequence embedding, solving the problem of insufficient time series information contained in the computational unit of the traditional attention mechanism, but is limited by the embedding method and cannot extract and model local information, affecting the model's short-term prediction and local fitting capabilities. Summary of the invention

[0005] The technical problem to be solved by the present invention is that the existing time series prediction model using Transformer and its improved architecture has two major defects, namely, attention mechanism defects and multi-scale time series dependency perception defects, resulting in poor time series prediction accuracy, especially poor accuracy of long-term prediction tasks of multivariate time series. To this end, the present invention proposes a multivariate time series long-term prediction method based on multi-scale temporal feature enhancements (Temporal Feature Enhancements, referred to as TFE), and names the architecture of the new method as the time series prediction model TFEformer, which solves the two major defects of the existing time series prediction model using Transformer and its improved architecture, and greatly improves the prediction performance on the long-term prediction task of multivariate time series.

[0006] The present invention adopts the following technical solutions:

[0007] A multivariate time series long-term prediction method based on multi-scale time series feature enhancement includes a time series prediction model TFEformer, which is composed of an embedding module, a multi-layer encoder Encoder and a decoder Decoder. The multi-branch structure and the sequence-patch attention mechanism are used to extract global and local time series features under multiple time scales, and the adaptive feature fusion mechanism is used to realize the adaptive fusion of multi-scale time series features. The inter-variable attention mechanism and the redesigned gated feedforward network are used to perform inter-variable feature fusion and internal feature fusion on the multivariate time series feature vector respectively, including the following steps:

[0008] Step (1): obtaining a multivariate time series data set, preprocessing the multivariate time series data set, and dividing the multivariate time series data set into a training data set and a validation data set according to a preset ratio according to the requirements of model training;

[0009] Step (2): Based on the training data set obtained in step (1), group reconstruction is performed to divide the continuous time series into multiple groups of data consisting of historical sequences and predicted sequences. N groups of data are randomly selected each time, and the historical sequences in each group of data are input into the embedding module Embedding in the time series prediction model TFEformer. The global and local patch features are vectorized and transformed in dimension using a multi-branch structure, and the transformed global sequence features and local patch features are paired and spliced;

[0010] Step (3): input the paired and concatenated global and local patch features into an encoder for further feature extraction and expression to obtain a temporal feature vector containing all feature information, wherein the encoder includes a patch-sequence attention layer, an adaptive fusion layer, an inter-variable attention layer, and a gated feedforward network layer;

[0011] Step (4): Input the time series feature vector obtained in step (3) into the decoder, reconstruct the feature vector using a linear mapping network and adjust the vector length, thereby obtaining a generated prediction sequence based on the training data set;

[0012] Step (5): Calculate the mean square error (MSE) between the prediction sequence in the training data set and the generated prediction sequence based on the training data set obtained in step (4), and minimize the mean square error (MSE) as the optimization goal. Back propagate through the Adam optimizer, update the network parameters, and train the time series prediction model TFEformer.

[0013] Step (6): The verification data set obtained in step (1) is grouped and reconstructed using the same method as step (2), and is input into the time series prediction model TFEformer trained in step (5) using the same data input method as step (2) to obtain a generated prediction sequence based on the verification data set;

[0014] Step (7): Calculate the mean square error (MSE) between the prediction sequence in the validation data set and the generated prediction sequence based on the validation data set obtained in step (6);

[0015] Step (8): Repeat steps (2) to (7) until the mean square error (MSE) obtained in step (7) no longer decreases, indicating that the model performance has reached the optimal level. The network parameters are updated, the time series prediction model TFEformer is trained, and the optimal time series prediction model TFEformer is obtained.

[0016] Step (9): Input the input sequence given by the prediction task into the optimal time series prediction model TFEformer obtained in step (8), perform sequence prediction, output the generated prediction sequence, and complete the prediction task.

[0017] Furthermore, the specific method steps for data group reconstruction in step (2) are as follows:

[0018] Step (2.1): for the training data set, set the historical sequence length and the predicted sequence length of the prediction task according to the prediction task requirements, corresponding to the two parts in each group of data: the historical sequence and the predicted sequence;

[0019] Step (2.2): Use the sliding window mechanism to group the data set. The window length is the sum of the historical sequence length and the predicted sequence length. Each time the window is moved back one bit, the data set is intercepted to obtain a series of continuous data with a length of the window length and only the first and last two bits are different. Each group of continuous data is divided into a historical sequence and a predicted sequence according to the length, and the two are encapsulated together as group data.

[0020] Step (2.3): N groups of data are randomly selected for each prediction and input into the time series prediction model TFEformer, where N is an integer greater than or equal to 16.

[0021] Furthermore, the embedding module in step (2) needs to input the historical sequence in each group of input data, and perform vectorized feature expression and dimension transformation on it; the vectorization of the input data is divided into two directions, namely, vectorization based on multi-scale patches and sequence vectorization, which are respectively implemented by the multi-scale patch embedding layer and the sequence embedding layer. The specific steps are as follows:

[0022] Step (2.4): Multi-scale sequence segmentation. The multi-scale patch embedding layer segments the input sequence into multiple time scales through a multi-branch structure. Each branch generates a set of patch blocks of different lengths and numbers, and maps them to the embedding vector dimension using a linear network. The calculation formula is:

[0023]

[0024] in, For b n The number of patches under a branch; X :,nis the historical sequence of the nth variable; Patched is the sequence segmentation operator; For b n The first branch split Patch vectors; PatchEmbed is the patch embedding operator; is the bth variable of the nth n The local patch feature vector group generated by the branches contains sub-vectors;

[0025] Step (2.5): Sequence vectorization: The sequence embedding layer vectorizes the time series of each variable separately through fully connected linear mapping. The calculation formula is:

[0026]

[0027] in, is the global sequence feature vector obtained after the nth variable is sequence vectorized; SeriesEmbed is the sequence embedding operator;

[0028] Step (2.6): Vectorization pairing: Pair the local patch feature vector group and the global sequence feature vector generated after multi-scale vectorization and sequence vectorization, and send them to the encoder module for fusion.

[0029] Furthermore, the patch-sequence attention layer in step (3) uses the attention between the local patch feature vector group and the global sequence feature vector to perform feature fusion, integrating the fine-grained local patch information into the global information of the global sequence feature vector to form an information-enriched temporal feature vector. The calculation formula is:

[0030]

[0031] Among them, l is the layer number of the current encoder; is the bth variable of the nth n The local patch feature vector group generated by the branches; is the global sequence feature vector generated for the nth variable; Norm is the layer normalization operator; Attn is the attention operator; Represents the refined local patch feature vector group, which is used as the input of the next layer encoder; It is the fused temporal enrichment feature vector, representing the temporal information after the fusion of local and global features at different time scales, and is used for multi-scale fusion in subsequent modules;

[0032] Furthermore, the adaptive fusion layer, inter-variable attention layer, and gated feedforward network layer in step (3) together constitute a self-learning weight allocation mechanism, which is used to automatically determine the contribution of the time series features of each scale to the final output prediction value and realize the fusion of multi-scale time series features. The specific steps are:

[0033] Step (3.1): Self-weight generation, the B generated in the patch-sequence attention layer n The time series enrichment feature vectors are flattened to form Flat vector Then use the gated feedforward network to compress the dimension to B n dimensional vector; then the weight is calculated through the Softmax exponential normalization layer to obtain the weight ratio that can be updated through training. The calculation formula is:

[0034]

[0035] in, is the weight matrix of the nth variable; Enrich feature vector for each time series The weights assigned; softmax is the exponential normalization operator; GFFN is the gated feedforward network layer; B n is the total number of branches;

[0036] Step (3.2): Feature vector modification, using a gated feedforward network to modify the B generated in the patch-sequence attention layer n The time series enriched feature vector is used for nonlinear control and further promoted for feature expression. The calculation formula is:

[0037]

[0038] in, is the bth variable generated in the patch-sequence attention layer n A time series enrichment feature vector; is the bth variable of the modified nth variable n A time series enrichment feature vector;

[0039] Step (3.3): Feature fusion, using self-learning weights After further modification, the feature vector Perform weight assignment and weighted summation to obtain the fused full-scale time series feature vector. The calculation formula is:

[0040]

[0041] in, is the fused full-scale time series feature vector.

[0042] Furthermore, the inter-variable attention layer utilizes the attention mechanism between multivariate variables for correlation fusion. The gated feedforward network layer introduces a gating mechanism based on the feedforward network, so that it has the ability to adaptively skip or limit unfavorable nonlinear activations and overly deep structures. The specific implementation can be expressed as the formula:

[0043]

[0044] h2=w2h1+b2

[0045] GLU(h2)=σ(w3h2+b3)⊙(w4h2+b4)

[0046]

[0047] in, represents the input data flow of the module; σ(·) and GELU(·) are activation functions; h1 and h2 are intermediate variables; w and b are learnable parameters; GLU is a gated linear unit; ⊙ is a matrix dot multiplication operator; is the output of the module.

[0048] Furthermore, in step (4), the linear mapping output layer is used as the decoder of the model to reconstruct the time series feature vector with highly enriched feature information generated in step (3) and adjust the vector length, and the feature vector is spatially mapped using a linear fully connected neural network to obtain a final prediction sequence of a specified length.

[0049] Furthermore, the calculation formula of the mean square error MSE in step (5) is:

[0050]

[0051] Among them, y is the predicted value; is the true value; n is the predicted sequence length.

[0052] Furthermore, the present invention adopts the following technical solutions:

[0053] A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the multivariate time series long-term prediction method based on multi-scale time series feature enhancement is implemented.

[0054] Furthermore, the present invention adopts the following technical solutions:

[0055] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the multivariate time series long-term prediction method based on multi-scale time series feature enhancement is implemented.

[0056] Beneficial effects of the present invention:

[0057] The present invention utilizes a multi-branch structure and a sequence-patch attention mechanism to extract global and local time series features at multiple time scales, and designs an adaptive feature fusion mechanism to achieve adaptive fusion of multi-scale time series features, thereby improving the model's ability to predict long-term time series trends, while also reducing the model's prediction error for short-term local fluctuations; utilizing an inter-variable attention fusion mechanism and a redesigned gated feedforward network to perform inter-variable feature fusion and intra-time series feature fusion, respectively, thereby improving the model's prediction accuracy for multivariate time series, and enhancing the model's anti-interference ability and robustness in coping with long-term time series prediction tasks, thereby greatly improving the prediction effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is a schematic diagram of the overall structure of an embodiment of the present invention;

[0059] Figure 2 A schematic diagram of a model structure framework of an embodiment of the present invention;

[0060] Figure 3 Schematic diagram of a multi-branch structure of a multi-scale patch embedding layer according to an embodiment of the present invention;

[0061] Figure 4 This is a network structure diagram of the patch-sequence attention layer of an embodiment of the present invention;

[0062] Figure 5 A network structure diagram of an adaptive fusion layer and a self-learning weight allocation mechanism according to an embodiment of the present invention;

[0063] Figure 6 This is a network structure diagram of a gated feedforward network layer according to an embodiment of the present invention;

[0064] Figure 7 The following is a comparison of the prediction performance of the embodiments of the present invention with four existing methods on five public datasets: ETTh1, ETTh2, ETTm1, Weather and ECL. DETAILED DESCRIPTION

[0065] The present invention is further described below in conjunction with the accompanying drawings and specific implementation steps:

[0066] A multivariate time series long-term prediction method based on multi-scale temporal feature enhancement (TFEformer) includes the following steps:

[0067] Step (1): Obtain a multivariate time series data set, preprocess the data set, and extract 70% of the data as a training data set and 30% of the data as a validation data set.

[0068] like Figure 1 The data processing and data set division part is in the front part of the structure diagram, which is responsible for the preliminary processing of the original data to form the data structure required by the prediction model.

[0069] Step (2): Based on the training data set obtained in step (1), group reconstruction is performed to divide the continuous time series into multiple groups of group data consisting of historical sequences and predicted sequences. 32 groups of training group data are randomly selected each time and input into the time series prediction model TFEformer.

[0070] The specific method of data group reconstruction is as follows:

[0071] Step (2.1): Set the historical sequence length and the predicted sequence length of the prediction task according to the prediction task requirements, corresponding to the two parts in each group of data: historical sequence and predicted sequence;

[0072] Step (2.2): Use the sliding window mechanism to group the data set. The window length is the sum of the historical sequence length and the predicted sequence length. Each time the window is moved back one bit, the data set is intercepted to obtain a series of continuous data with a length of the window length and only the first and last two bits are different. Each group of continuous data is divided into a historical sequence and a predicted sequence according to the length, and the two are encapsulated together as group data.

[0073] Step (2.3): N groups of data are randomly selected each time and input into the time series prediction model TFEformer, where N is an integer greater than or equal to 16.

[0074] like Figure 2 As shown, the time series prediction model TFEformer consists of three parts: an embedding module Embedding, a multi-layer encoder Encoder and a decoder Decoder.

[0075] The historical sequence in each group of data is input into the embedding module Embedding in the time series prediction model TFEformer. The multi-branch structure is used to vectorize the feature expression and dimension transformation of the global and local patch features, and the transformed global sequence features and local patch features are paired and spliced. The vectorization of the input data is divided into two directions, namely, vectorization based on multi-scale patches and sequence vectorization, which are respectively implemented by the multi-scale patch embedding layer and the sequence embedding layer. The specific steps are as follows:

[0076] Step (2.4): Multi-scale sequence segmentation,The multi-scale patch embedding layer segments the input sequence into different scales through a multi-branch structure, such as Figure 3As shown, each branch generates a set of patches of different lengths and numbers, and maps them to the embedding vector dimension using a linear network. The calculation formula is:

[0077]

[0078] in, For b n The number of patches under a branch; X :,n is the historical sequence of the nth variable, and Patched is the sequence segmentation operator; For b n The first branch split patch vectors; FatchEmbed is the patch embedding operator; is the bth variable of the nth n The local patch feature vector group generated by the branches contains sub-vectors;

[0079] Step (2.5): Sequence vectorization: The sequence embedding layer vectorizes the time series of each variable separately through fully connected linear mapping. The calculation formula is:

[0080]

[0081] in, is the global sequence feature vector obtained after the nth variable is sequence vectorized; SeriesEmbed is the sequence embedding operator;

[0082] Step (2.6): Vectorization pairing: Pair the local patch feature vector group and the global sequence feature vector generated after multi-scale vectorization and sequence vectorization, and send them to the subsequent network module for fusion.

[0083] Step (3): The paired and concatenated global and local patch features are input into the encoder for further feature extraction and expression to obtain a temporal feature vector containing all feature information.

[0084] like Figure 2 As shown, the encoder of the model in step (3) is mainly used to further extract and express the global sequence feature vector and local patch feature vector generated in step (2), and is composed of the following parts: patch-sequence attention layer, adaptive fusion layer, inter-variable attention layer, and gated feedforward network layer.

[0085] like Figure 4As shown in Figure 1, the patch-sequence attention layer uses the attention between the local patch feature vector group and the global sequence feature vector to perform feature fusion, integrating the fine-grained local patch information into the global information of the global sequence feature vector to form an information-enriched temporal feature vector. The calculation formula is:

[0086]

[0087] Among them, l is the layer number of the current encoder; is the bth variable of the nth n The local patch feature vector group generated by the branches; is the global sequence feature vector generated for the nth variable; Norm is the layer normalization operator; Attn is the attention operator; Represents the refined local patch feature vector group, which is used as the input of the next layer encoder; It is the fused temporal enrichment feature vector, representing the temporal information after the fusion of local and global features at different scales, and is used for multi-scale fusion in subsequent modules.

[0088] like Figure 5 As shown in the figure, the adaptive fusion layer, the inter-variable attention layer, and the gated feedforward network layer together constitute a self-learning weight allocation mechanism, which is used to automatically determine the contribution of the time series features of each scale to the final output prediction value and realize the fusion of multi-scale time series features. The specific steps are:

[0089] Step (3.1): Self-weight generation, the B generated in the patch-sequence attention layer n The time series enrichment feature vectors are flattened to form Flat vector Then use the gated feedforward network to compress the dimension to B n dimensional vector; then the weight is calculated through the Softmax exponential normalization layer to obtain the weight ratio that can be updated through training. The calculation formula is:

[0090]

[0091] in, is the weight matrix of the nth variable; Enrich feature vector for each time series The weights assigned; softmax is the exponential normalization operator; GFFN is the gated feedforward network layer; B n is the total number of branches;

[0092] Step (3.2): Feature vector modification, using a gated feedforward network to modify the B generated in the patch-sequence attention layer nThe time series enriched feature vector is used for nonlinear control and further promoted for feature expression. The calculation formula is:

[0093]

[0094] in, is the bth variable generated in the patch-sequence attention layer n A time series enrichment feature vector; is the bth variable of the modified nth variable n A time series enrichment feature vector;

[0095] Step (3.3): Feature fusion, using self-learning weights After further modification, the feature vector Perform weight assignment and weighted summation to obtain the fused full-scale time series feature vector. The calculation formula is:

[0096]

[0097] in, is the fused full-scale time series feature vector.

[0098] The inter-variable attention layer utilizes the attention mechanism between multiple variables to perform correlation fusion; Figure 6 As shown, the redesigned gated feedforward network layer introduces a gating mechanism based on the feedforward network, so that it has the ability to adaptively skip or limit unfavorable nonlinear activations and overly deep structures. The calculation formula is:

[0099]

[0100] h2=w2h1+b2

[0101] GLU(h2)=σ(w3h2+b1)⊙(w4h2+b4)

[0102]

[0103] in, represents the input data flow of the module; σ(·) and GELU(·) are activation functions; h1 and h2 are intermediate variables; w and b are learnable parameters; GLU is a gated linear unit; ⊙ is a matrix dot multiplication operator; is the output of the module; the gated linear unit is used to generate self-weights between 0 and 1. This layer structure can adaptively determine the degree of complex network and nonlinear effects based on training data, and the selection weight is completely generated through training.

[0104] Step (4): Input the time series feature vector obtained in step (3) into the decoder, reconstruct the feature vector using a linear mapping network and adjust the vector length, thereby obtaining a generated prediction sequence based on the training data set.

[0105] like Figure 2 As shown, in step (4), the linear mapping output layer is used as the decoder of the model to reconstruct the time series feature vector with highly enriched feature information generated in step (3) and adjust the vector length, and a linear fully connected neural network is used to spatially map the feature vector to obtain a final prediction sequence of a specified length.

[0106] Step (5): Calculate the mean square error (MSE) between the prediction sequence in the training data set and the generated prediction sequence based on the training data set obtained in step (4). Minimize the mean square error (MSE) as the optimization goal, perform back propagation through the Adam optimizer, update the network parameters, and train the time series prediction model TFEformer. The calculation formula of the mean square error (MSE) is:

[0107]

[0108] Among them, y is the predicted value; is the true value; n is the predicted sequence length.

[0109] Step (6): The verification data set obtained in step (1) is grouped and reconstructed using the same method as step (2), and is input into the time series prediction model TFEformer trained in step (5) using the same data input method as step (2) to obtain a generated prediction sequence based on the verification data set.

[0110] Step (7): Calculate the mean square error (MSE) between the prediction sequence in the validation data set and the generated prediction sequence based on the validation data set obtained in step (6).

[0111] Step (8): Repeat steps (2) to (7) until the mean square error (MSE) obtained in step (7) no longer decreases, indicating that the model performance has reached the optimal level. The network parameters are updated, the time series prediction model TFEformer is trained, and the optimal time series prediction model TFEformer is obtained.

[0112] Step (9): Input the input sequence given by the prediction task into the optimal time series prediction model TFEformer obtained in step (8), perform sequence prediction, output the generated prediction sequence, and complete the prediction task.

[0113] Figure 7The experimental results of five methods, TFEformer, iTransformer, Sepformer, Informer and Transformer, on five datasets, ETTh1, ETTh2, ETTm1, Weather and ECL, are shown under the same experimental conditions. The measurement criteria are mean square error (MSE) and square absolute value (MAE). Under each experimental condition, the experimental results of the best performing model are shown in bold in the table. Figure 7 It can be seen that the time series prediction model TFEformer proposed in the present invention performs optimally in all prediction tasks on all data sets compared with other models, and all have significant performance improvements. Compared with the iTransformer model with the best current performance, the time series prediction model TFEformer proposed in the present invention reduces the mean square error (MSE) by 3.1%, 2.5%, 3.5%, 4.6% and 5.7% on five data sets respectively; compared with the Sepformer model proposed in the invention CN114239718B, the mean square error (MSE) is reduced by 41.2%, 84.8%, 33.6%, 54.9% and 37.3% on five data sets respectively; compared with the baseline model Transformer, the mean square error (MSE) is reduced by 57.1%, 84.1%, 41.5%, 53.9% and 39.8% on five data sets respectively; the above reduction in prediction errors shows that the time series prediction model TFEformer proposed in the present invention achieves the best prediction performance in the long-term prediction task of multivariate time series, and achieves significant performance improvement compared with existing models.

[0114] Through the description of the above embodiments, it can be clearly understood by those skilled in the art that the implementation of the present invention can be implemented by means of software plus the necessary hardware platform. The embodiments of the present invention can be implemented using an existing processor, or by a dedicated processor used for this purpose or other purposes for an appropriate system, or by a hard-wired system. The embodiments of the present invention also include a non-transitory computer-readable storage medium, which includes a machine-readable medium for carrying or having a machine-executable instruction or data structure stored thereon; such a machine-readable medium can be any available medium that can be accessed by a general-purpose or special-purpose computer or other machine with a processor. For example, such a machine-readable medium can include RAM, ROM, EPROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the required program code in the form of machine-executable instructions or data structures, and can be accessed by a general-purpose or special-purpose computer or other machine with a processor. When information is transmitted or provided to a machine via a network or other communication connection (hard-wired, or wireless, or a combination of hard-wired and wireless), the connection is also considered a machine-readable medium.

[0115] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A multivariate time series long-term prediction method based on multi-scale time series feature enhancement, characterized in that: The invention comprises a time series prediction model TFEformer, which is composed of an embedding module, a multi-layer encoder Encoder and a decoder Decoder. The multi-branch structure and the sequence-patch attention mechanism are used to extract global and local time series features at multiple time scales. The adaptive feature fusion mechanism is used to realize the adaptive fusion of multi-scale time series features. The inter-variable attention mechanism and the redesigned gated feedforward network are used to perform inter-variable feature fusion and internal feature fusion on multi-variable time series feature vectors. The invention comprises the following steps: Step (1): obtaining a multivariate time series data set, preprocessing the multivariate time series data set, and dividing the multivariate time series data set into a training data set and a validation data set according to a preset ratio according to the requirements of model training; Step (2): Based on the training data set obtained in step (1), group reconstruction is performed to divide the continuous time series into multiple groups of data consisting of historical sequences and predicted sequences. N groups of data are randomly selected each time, and the historical sequences in each group of data are input into the embedding module Embedding in the time series prediction model TFEformer. The global and local patch features are vectorized and transformed in dimension using a multi-branch structure, and the transformed global sequence features and local patch features are paired and spliced; Step (3): input the paired and concatenated global and local patch features into an encoder for further feature extraction and expression to obtain a temporal feature vector containing all feature information, wherein the encoder includes a patch-sequence attention layer, an adaptive fusion layer, an inter-variable attention layer, and a gated feedforward network layer; Step (4): Input the time series feature vector obtained in step (3) into the decoder, reconstruct the feature vector using a linear mapping network and adjust the vector length, thereby obtaining a generated prediction sequence based on the training data set; Step (5): Calculate the mean square error (MSE) between the prediction sequence in the training data set and the generated prediction sequence based on the training data set obtained in step (4), and minimize the mean square error (MSE) as the optimization goal. Back propagate through the Adam optimizer, update the network parameters, and train the time series prediction model TFEformer. Step (6): The verification data set obtained in step (1) is grouped and reconstructed using the same method as step (2), and is input into the time series prediction model TFEformer trained in step (5) using the same data input method as step (2) to obtain a generated prediction sequence based on the verification data set; Step (7): Calculate the mean square error (MSE) between the prediction sequence in the validation data set and the generated prediction sequence based on the validation data set obtained in step (6); Step (8): Repeat steps (2) to (7) until the mean square error (MSE) obtained in step (7) no longer decreases, indicating that the model performance has reached the optimal level. The network parameters are updated, the time series prediction model TFEformer is trained, and the optimal time series prediction model TFEformer is obtained. Step (9): Input the input sequence given by the prediction task into the optimal time series prediction model TFEformer obtained in step (8), perform sequence prediction, output the generated prediction sequence, and complete the prediction task.

2. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: The specific steps of the data grouping reconstruction in step (2) are as follows: Step (2.1): for the training data set, set the historical sequence length and the predicted sequence length of the prediction task according to the prediction task requirements, corresponding to the two parts in each group of data: the historical sequence and the predicted sequence; Step (2.2): Use the sliding window mechanism to group the data set. The window length is the sum of the historical sequence length and the predicted sequence length. Each time the window is moved back one bit, the data set is intercepted to obtain a series of continuous data with a length of the window length and only the first and last two bits are different. Each group of continuous data is divided into a historical sequence and a predicted sequence according to the length, and the two are encapsulated together as group data. Step (2.3): N groups of data are randomly selected for each prediction and input into the time series prediction model TFEformer, where N is an integer greater than or equal to 16.

3. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: In step (2), the embedding module Embedding needs to input the historical sequence in each group of input data, and perform vectorized feature expression and dimension transformation on it. The vectorization of input data is divided into two directions, namely, vectorization based on multi-scale patches and sequence vectorization, which are respectively implemented by the multi-scale patch embedding layer and the sequence embedding layer. The specific steps are as follows: Step (2.4): Multi-scale sequence segmentation. The multi-scale patch embedding layer segments the input sequence into multiple time scales through a multi-branch structure. Each branch generates a set of patch blocks of different lengths and numbers, and maps them to the embedding vector dimension using a linear network. The calculation formula is: in, For b n The number of patches under a branch; X :,n is the historical sequence of the nth variable; Patched is the sequence segmentation operator; For b n The first branch split Patch vectors; PatchEmbed is the patch embedding operator; is the bth variable of the nth n The local patch feature vector group generated by the branches contains sub-vectors; Step (2.5): Sequence vectorization: The sequence embedding layer vectorizes the time series of each variable separately through fully connected linear mapping. The calculation formula is: in, is the global sequence feature vector obtained after the nth variable is sequence vectorized; SeriesEmbed is the sequence embedding operator; Step (2.6): Vectorization pairing: Pair the local patch feature vector group and the global sequence feature vector generated after multi-scale vectorization and sequence vectorization, and send them to the encoder module for fusion.

4. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: The patch-sequence attention layer in step (3) uses the attention between the local patch feature vector group and the global sequence feature vector to perform feature fusion, integrating the fine-grained local patch information into the global information of the global sequence feature vector to form an information-enriched temporal feature vector. The calculation formula is: Among them, l is the layer number of the current encoder; is the bth variable of the nth n The local patch feature vector group generated by the branches; is the global sequence feature vector generated for the nth variable; Norm is the layer normalization operator; Attn is the attention operator; Represents the refined local patch feature vector group, which is used as the input of the next layer encoder; It is the fused temporal enrichment feature vector, representing the temporal information after the fusion of local and global features at different time scales, and is used for multi-scale fusion in subsequent modules; 5. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: The adaptive fusion layer, inter-variable attention layer, and gated feedforward network layer in step (3) together constitute a self-learning weight allocation mechanism, which is used to automatically determine the contribution of time series features of each scale to the final output prediction value and realize the fusion of multi-scale time series features. The specific steps are: Step (3.1): Self-weight generation, the B generated in the patch-sequence attention layer n The time series enrichment feature vectors are flattened to form Flat vector Then use the gated feedforward network to compress the dimension to B n dimensional vector; then the weight is calculated through the Softmax exponential normalization layer to obtain the weight ratio that can be updated through training. The calculation formula is: in, is the weight matrix of the nth variable; Enrich feature vector for each time series The weights assigned; softmax is the exponential normalization operator; GFFN is the gated feedforward network layer; B n is the total number of branches; Step (3.2): Feature vector modification, using a gated feedforward network to modify the B generated in the patch-sequence attention layer n The time series enriched feature vector is used for nonlinear control and further promoted for feature expression. The calculation formula is: in, is the bth variable generated in the patch-sequence attention layer n A time series enrichment feature vector; is the bth variable of the modified nth variable n A time series enrichment feature vector; Step (3.3): Feature fusion, using self-learning weights After further modification, the feature vector Perform weight assignment and weighted summation to obtain the fused full-scale time series feature vector. The calculation formula is: in, is the fused full-scale time series feature vector.

6. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 5 is characterized in that: The inter-variable attention layer uses the attention mechanism between multivariate variables to fuse correlations; the gated feedforward network layer introduces a gating mechanism based on the feedforward network, so that it has the ability to adaptively skip or limit unfavorable nonlinear activations and overly deep structures. The calculation formula is: in, represents the input data flow of the module; σ(·) and GELU(·) are activation functions; h1 and h ' is an intermediate variable; w and b are learnable parameters; GLU is a gated linear unit; ⊙ is a matrix dot multiplication operator; is the output of the module.

7. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: In step (4), the linear mapping output layer is used as the decoder of the model to reconstruct the time series feature vector with highly enriched feature information generated in step (3) and adjust the vector length. The feature vector is spatially mapped using a linear fully connected neural network to obtain the final prediction sequence of the specified length.

8. The multivariate time series long-term prediction method based on multi-scale time series feature enhancement according to claim 1 is characterized in that: The calculation formula of the mean square error MSE described in step (5) is: Among them, y is the predicted value; is the true value; n is the predicted sequence length.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multivariate time series long-term prediction method based on multi-scale time series feature enhancement as described in any one of claims 1 to 8 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the multivariate time series long-term prediction method based on multi-scale time series feature enhancement as described in any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Method and device for constructing flow velocity prediction model based on improved gating circulation unit

    CN119378407A

  • Influenza incidence prediction method and system based on multi-scale multivariate time sequence feature fusion

    CN119400441A

  • Demand prediction method and device based on time sequence

    CN119721313A

  • Motor fault detection method and system based on multi-branch neural network

    CN119829931A

  • Method for measuring oil-water two-phase flow parameters of oil well

    CN119889513A