Time sequence large model data processing method and system for realizing multivariable prediction
By processing and encoding multi-variable data and then inputting it into the Transformer network, the attention mechanism is used to capture different variable information, which solves the problem of insufficient capabilities of the Decoder-Only architecture in multi-variable time series data processing and improves the model's complex time series prediction ability. .
Patent Information
- Application Number
- CN202411251744.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-09-09
AI Technical Summary
Existing large models with Decoder-Only architecture have limited capabilities when processing multi-variable time series data, and are difficult to effectively capture the relevant information between different variables, limiting their performance in processing complex time series data.
By normalizing the multi-variable data, uniformly sampling and mixing it into uni-variable data, and dividing it into non-overlapping continuous segments, after adding position encoding, length encoding and resolution encoding information, it is input into the Transformer network for model training. Use the attention mechanism to capture relevant information between different variables for time series prediction.
It improves the model's ability to process complex time series data, achieves effective prediction of multiple variables, and enhances the model's generalization ability and performance.
Smart Images

Figure CN118779642A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a time series large model data processing method and system for realizing multivariate prediction. Background Art
[0002] The large language model uses large-scale self-supervised learning, pre-trains with a large amount of unlabeled data, and uses the Transformer structure and the core attention mechanism, so that the model can effectively capture contextual information, process multimodal data, and perform well in generation tasks. Inspired by the large language model, more and more researchers have begun to explore large-scale pre-trained time series models, and improve the generalization ability and performance of the model by pre-training on large-scale data sets. At present, the more representative model architectures include encoder-only, decoder-only, and encoder-decoder architectures.
[0003] However, in the field of time series data processing, especially in scenarios involving multivariate inputs, existing large models with Decoder-Only architecture mostly rely on single variable inputs, which limits the model's ability to process complex time series data. To overcome this limitation, researchers have begun to explore methods for processing multivariate data, but most methods focus on feature fusion or parallel processing. Summary of the invention
[0004] In response to the problems in the prior art, the present invention proposes a method for efficiently mixing multivariate data into a single variable based on the existing large time series model with a Decoder-Only architecture, and uses the mixed data to train or fine-tune the large time series model, so that the model can effectively capture and learn the relevant information between different variables through the attention mechanism, thereby realizing time series prediction of multiple variables.
[0005] In order to achieve the above purpose, the technical solution adopted in this application is: In a first aspect, the present invention provides a method for processing time series large model data for realizing multivariate prediction, comprising: Obtain time series data and perform normalization to obtain multivariate data; Evenly sample multivariate data and mix them into univariate data; Patch the univariate data into multiple non-overlapping continuous fragments; Convert each continuous patch into a fixed-size vector and add position encoding, length encoding, and resolution encoding information to obtain vector data. The vector data is input into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
[0006] Furthermore, the normalization process includes: scaling the time series data to a range with a mean of 0 and a variance of 1, so that the distribution of the time series data is close to a normal distribution.
[0007] Furthermore, the step of uniformly sampling and mixing into single variable data includes: sequentially taking a time point data of each variable of the multivariate data, and mixing the multivariate data into a single variable.
[0008] Furthermore, the patch division step includes: dividing the univariate data into a plurality of non-overlapping continuous fragment patches, determining the number of time points of each patch, traversing the entire time series, and taking out a fixed number of continuous time point data each time as a patch.
[0009] Furthermore, the position encoding uses a combination of sine and cosine functions to provide the model with information about the position of the data at each time point in the sequence.
[0010] Furthermore, the length encoding includes: randomly masking part or all of the input patches so that the model can adapt to different context lengths.
[0011] Furthermore, the resolution encoding includes: setting 0, 1, and 2 to represent high-frequency, medium-frequency, and low-frequency data respectively; randomly initializing a resolution sequence of patch length, and outputting a resolution encoding vector of dim dimension through a multi-layer perceptron.
[0012] In a second aspect, the present invention provides a time series large model data processing system for realizing multivariate prediction, comprising: The acquisition module is configured to: acquire time series data and perform normalization processing to obtain multivariate data; The data mixing module is configured to: uniformly sample the multivariate data and mix them into univariate data; The partitioning module is configured to: partition the univariate data into multiple non-overlapping continuous fragment patches; The vectorization module is configured to: convert each continuous fragment patch into a vector of a fixed size, and add position encoding, length encoding and resolution encoding information to obtain vector data; The training and prediction module is configured to: input vector data into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
[0013] In a third aspect, the present invention provides a computer-readable storage medium, the computer-readable storage medium including a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute a time series large model data processing method for realizing multivariate prediction as described in the first aspect.
[0014] In a fourth aspect, the present invention provides an electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute a time series large model data processing method for realizing multivariate prediction as described in the first aspect.
[0015] Compared with the prior art, the advantages and positive effects of the present invention are: The present invention provides a time series large model data processing method for realizing multivariate prediction, comprising: acquiring time series data, and performing normalization processing to obtain multivariate data; uniformly sampling the multivariate data to mix it into single variable data; patch dividing and vectorizing the single variable data; inputting vector data into a transformer network for model training and prediction, so as to realize multivariate time series prediction. The present invention is based on the existing decoder-only architecture time series large model, and uses the mixed data to train or fine-tune the time series large model, so that the model can effectively capture and learn the relevant information between different variables through the attention mechanism, so as to realize multivariate time series prediction, and improve the model's ability in processing complex time series data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 The present invention is a flowchart of a method for efficiently mixing multiple variables into a single variable in time series prediction. DETAILED DESCRIPTION
[0018] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways than those described herein. Therefore, the present invention is not limited to the specific embodiments of the following disclosure.
[0020] Embodiment 1, as Figure 1 As shown, the present application proposes a method for efficiently mixing multiple variables into a single variable in time series prediction. First, the time series data is normalized, the processed multivariate data is uniformly sampled and mixed into single variable data, the data is divided into patches according to fixed time points, and then each patch is vectorized, adding position coding, length coding, resolution coding and other information, and the vector is sent to the subsequent transformer network, and the model performs learning and prediction. The model effectively captures and learns the relevant information between different variables through the attention mechanism, and realizes the time series prediction of multiple variables.
[0021] The specific implementation steps are as follows: ① Time series data, such as weather temperature data, can be recorded once an hour. There are many variables related to weather temperature, such as humidity data, air pressure data, etc., which are also collected at a frequency of once an hour. Normalize the data and scale the data to a range of mean 0 and variance 1, so that the data distribution is close to a normal distribution. The specific normalization method is to calculate the mean and variance, and then use the formula Where z: standardized value; x: original value; μ: feature mean; σ: feature standard deviation ② Perform multivariate data mixing. Take the data values corresponding to the same time point of each variable in turn, and mix the multiple variables into a single variable.
[0022] ③ Perform patch division. Divide the one-dimensional time series in the previous step into multiple non-overlapping continuous segments (patches), determine the number of time points in each patch, traverse the entire time series, and take out the continuous fixed time point data each time as a patch. For time series whose length is not a multiple of the fixed number of time points, add zero values at the end to fill it to the multiple of the nearest fixed number of time points, or ignore the insufficient part when inputting.
[0023] ④The Embedding layer implements vectorization. Time series vectorization converts each patch into a fixed-size vector for input into the Transformer layer. Each patch outputs a vector through a multi-layer perceptron (MLP), whose dimension matches the input dimension (dim) specified by the model.
[0024] Position encoding, since the Transformer model itself does not have the ability to process sequence order, it is necessary to add position encoding to the vector of each patch. Position encoding can be a combination of sine and cosine functions to provide the model with information about the position of each data point in the sequence.
[0025] The position encoding formula is as follows: (1) (2) Among them: pos is the position index, i is the dimension index of the position encoding vector, is the dimension of the model (i.e. the dimension of the embedding vector).
[0026] Length encoding enables the model to adapt to different context lengths by randomly masking part or all of the input patches. Specifically, in each training batch, a starting point r is randomly selected, and the value of r is less than the number of patches, which means that the part from this point to the end of the patch is masked. This masking strategy ensures that the model can see all possible context lengths during training. Create a binary mask vector with the same length as the input time series, where 1 indicates that the corresponding time point data should be considered by the model, and 0 indicates that the corresponding time point data should be ignored.
[0027] Resolution encoding, set 0, 1, 2 to represent high frequency, medium frequency, and low frequency data respectively. High frequency represents data with a frequency of minutes, hours, and days, medium frequency represents data with a frequency of weeks and months, and low frequency represents data with a frequency of quarters and years. Randomly initialize the resolution sequence of the patch length, and output the resolution encoding vector of dim dimension after passing through the multi-layer perceptron (MLP).
[0028] ⑤ Input into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
[0029] Embodiment 2: This embodiment provides a time series large model data processing system for realizing multivariate prediction, including: The acquisition module is configured to: acquire time series data and perform normalization processing to obtain multivariate data; The data mixing module is configured to: uniformly sample the multivariate data and mix them into univariate data; The partitioning module is configured to: partition the univariate data into multiple non-overlapping continuous fragment patches; The vectorization module is configured to: convert each continuous fragment patch into a vector of a fixed size, and add position encoding, length encoding and resolution encoding information to obtain vector data; The training and prediction module is configured to: input vector data into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
[0030] Embodiment 3, this embodiment provides a computer-readable storage medium, the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute a time series large model data processing method for realizing multivariate prediction described in Embodiment 1.
[0031] Embodiment 4. This embodiment provides an electronic device, comprising a memory for storing computer program instructions and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute a time series large model data processing method for realizing multivariate prediction described in Embodiment 1.
[0032] The electronic device may include: a processor, a memory and a communication unit. These components communicate via one or more buses. Those skilled in the art will appreciate that the structure of the electronic device does not limit the embodiments of the present invention, and it may be a bus structure or a star structure, or a combination of certain components, or different component arrangements.
[0033] The communication unit is used to establish a communication channel so that the electronic device can communicate with other devices, receive user data sent by other devices or send user data to other devices.
[0034] The processor is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor can only include a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0035] The memory is used to store the execution instructions of the processor. The memory can be implemented by any type of volatile or non-volatile storage device or a combination of them, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0036] When the execution instructions in the memory are executed by the processor, the electronic device is enabled to execute part or all of the steps of Embodiment 1.
[0037] The above description is only a preferred embodiment of the present invention and does not limit the present invention in other forms. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.
Claims
1. A method for processing large time series model data for realizing multivariate prediction, characterized in that: include: Obtain time series data and perform normalization to obtain multivariate data; Evenly sample multivariate data and mix them into univariate data; Divide the univariate data into multiple non-overlapping continuous patches; Convert each continuous patch into a vector of fixed size, and add position encoding, length encoding, and resolution encoding information to obtain vector data; The vector data is input into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
2. A method for processing large time series model data for realizing multivariate prediction according to claim 1, characterized in that: The normalization process includes: scaling the time series data to a range with a mean of 0 and a variance of 1, so that the distribution of the time series data is close to a normal distribution.
3. The method for processing large-scale time series model data for realizing multivariate prediction according to claim 1, characterized in that: The step of uniformly sampling and mixing into single variable data includes: sequentially taking a time point data of each variable of the multivariate data, and mixing the multivariate data into a single variable.
4. The method for processing time series large model data for realizing multivariate prediction according to claim 1, characterized in that: The patch division step includes: dividing the univariate data into a plurality of non-overlapping continuous fragment patches, determining the number of time points of each patch, traversing the entire time series, and taking out a fixed number of continuous time point data each time as a patch.
5. The method for processing large-scale time series model data for realizing multivariate prediction according to claim 1, characterized in that: The position encoding uses a combination of sine and cosine functions to provide the model with information about the position of the data at each time point in the sequence.
6. A method for processing time series large model data for realizing multivariate prediction according to claim 1, characterized in that: The length encoding includes: randomly masking part or all of the input patches so that the model can adapt to different context lengths.
7. The method for processing large-scale time series model data for realizing multivariate prediction according to claim 1, characterized in that: The resolution encoding includes: setting 0, 1, and 2 to represent high-frequency, medium-frequency, and low-frequency data respectively; randomly initializing a resolution sequence of patch length, and outputting a resolution encoding vector of dim dimension through a multi-layer perceptron.
8. A time series large model data processing system for realizing multivariate prediction, characterized in that: include: The acquisition module is configured to: acquire time series data and perform normalization processing to obtain multivariate data; The data mixing module is configured to: uniformly sample the multivariate data and mix them into univariate data; The partitioning module is configured to: partition the univariate data into multiple non-overlapping continuous segments, patches; The vectorization module is configured to: convert each continuous fragment patch into a vector of a fixed size, and add position encoding, length encoding and resolution encoding information to obtain vector data; The training and prediction module is configured to: input vector data into the transformer network for model training and prediction. The model captures and learns the relevant information between different variables through the attention mechanism to achieve time series prediction of multiple variables.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute a time series large model data processing method for realizing multivariate prediction as described in any one of claims 1-7.
10. An electronic device, characterized in that: It includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute a time series large model data processing method for realizing multivariate prediction as described in any one of claims 1-7.
Citation Information
Patent Citations
Single-variable alarm threshold optimization method for non-stable operation of coal-fired power generation equipment
CN111814325A
Multivariable time series prediction method and system based on tensor decomposition, and storage medium
CN116882554A
Time sequence anomaly detection method and system based on time sequence and multiple variables
CN117313015A
Multivariable time sequence prediction method and system based on multi-axis fusion
CN118070214A
Internet of things system
WO2023030513A1
Cited By
Long-term time sequence prediction method of double-path Mama for data processing
CN119557605A
Sewage treatment process time sequence data prediction method, device, equipment and medium
CN119720043A
