A method for improving the time series prediction effect of time series prediction system
By modeling concept drift and using an end-to-end training framework in a time series prediction system, the problem of predicting future data changes is solved, the prediction accuracy and efficiency are improved, and the problem of poor future data prediction results in the existing technology is solved.
Patent Information
- Application Number
- CN202111387699.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-11-22
AI Technical Summary
Existing time series forecasting systems cannot accurately model data changes at future time points, resulting in poor forecasting results. The main reason is the distribution difference between future data and past data (concept drift) and the vanishing gradient problem of recurrent neural networks.
By dividing past data into historical data and new data, modeling concept drift in historical data and new data, and using an end-to-end training framework and time series classification model to improve the forecast accuracy of time series forecasting systems.
It improves the prediction accuracy of the time series prediction system at future time points, alleviates the problem of model aging, and significantly improves the prediction accuracy and efficiency.
Smart Images

Figure CN114091752B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of artificial intelligence time series prediction, and specifically relates to a method for improving the prediction effect of a time series prediction system at a future time point. Background Art
[0002] With the development of time series information technology, time series information has been widely used in various Internet services. How to predict future data change trends for users based on existing time series has gradually become a focus of research in the industry. To this end, a large number of time series prediction technologies have been proposed. However, existing technologies cannot accurately model data at future times, so the prediction effect at these future time points is very poor. The main reason is that the sequence data at future time points may not be distributed in the same way as the existing data, that is, there may be a trend change that is not remembered, which leads to a tendency for future data to change more slowly. On the other hand, recurrent neural networks have the problem of vanishing gradients, which makes it difficult for common recurrent neural networks to accurately model sequences. Considering that existing methods use common recurrent neural networks and other methods to model time series, they lack the ability to accurately predict sequences at future time points. Summary of the invention
[0003] The purpose of the present invention is to provide a method for improving the effect of predicting time series in a time series prediction system in artificial intelligence technology.
[0004] The time series prediction system usually includes a time series prediction model and time series data; here, the time series data is a sequence of data points arranged in chronological order, where each data point is represented as a real number. The basic process of prediction by the prediction system is: the time series prediction model takes a set of time series with a fixed length as input and outputs the predicted value of the data point at the next time point or several time points; wherein the fixed-length time series as input is called past data; the real value at the next time point or several time points is called future data; the data point at the next time point or several time points output by the time series prediction system based on the past data is called the prediction result. The goal of the time series prediction system is to make the gap between the prediction result and the future data as small as possible. In order to achieve this goal, the time series prediction system needs to first train the parameters of the time series prediction model based on the existing time series data, that is, the past data, and the time series prediction model can be used to predict future data.
[0005] The method for improving the prediction effect of a time series prediction system based on concept drift modeling provided by the present invention. First, based on past related work and empirical experiments, it is found that the prediction results obtained by the existing time series prediction system are quite different from the future data. The reason is that there is a big difference between the past data and the future data as the input of the time series model. This difference is called concept drift, and the existing time series model cannot predict these differences and apply them to the prediction of future data. Therefore, the present invention proposes to divide the past data into historical data and new data (wherein the total length of the historical data and the new data is the same as the total length of the past data), and then enable the time series prediction model to model the concept drift in the historical data and the new data, so that the time series prediction model can also have the ability to model the concept drift between the past data and the future data when predicting, and finally output a more accurate prediction result. Secondly, since there is a lot of noise in the time series data, we use more time series data to help model more accurate concept drift, so as to further improve the accuracy of the time series prediction system. Finally, in order to make the training and deployment of the system more convenient, the present invention uses an end-to-end training framework to finally train and deploy the above time series prediction system.
[0006] Correspondingly, the time series prediction system in the present invention includes: a plurality of time series prediction models with the same architecture, a time series classification model for evaluating the similarity of time series data, and a plurality of time series data with the same length; here, the time series data is a set of data point sequences arranged in chronological order, wherein each data point is represented as a real number; the basic process of prediction by the time series prediction system is: the time series prediction model takes a set of time series with a fixed length as input, and outputs the predicted value of the data point at the next time point or several time points; wherein the fixed-length time series as input is called past data; the real value at the next time point or several time points is called future data; the data point at the next time point or several time points output by the time series prediction system based on the past data is called the prediction result; the goal of the time series prediction system is to make the gap between the prediction result and the future data as small as possible;
[0007] Among them, the several different time series prediction models are used for concept drift modeling and future data prediction of time series belonging to different classes; the time series classification model is a recurrent neural network model, the output of the last time node of the recurrent neural network is used to calculate the probability that a time series belongs to a certain class, and is used to classify all time series in the time series prediction system; the several time series of the same length are used for classification, and then the time series prediction model is used to fit historical data and model concept drift on the time series data of the same class; all time series prediction models and time series classification models are learned using an end-to-end training framework based on REINFORCE rules;
[0008] The specific steps of the method include:
[0009] First, there is a difference between the past data and future data as the input of the time series model, and this difference is defined as concept drift; the past data of each time series is divided into historical data and new data; the total length of the historical data and the new data is the same as the total length of the past data; and the past data of each time series data is input into the time series classification model to obtain the class label of the time series;
[0010] Then, the time series data with the same label share the same time series prediction model, and the time series prediction model is used to fit the data on all the historical data belonging to the class, and the parameters of each intermediate time series prediction model are calculated through the fitting error (recorded as the historical data loss function);
[0011] Then, the intermediate parameter is used to fit the new data of the time series data in the corresponding class, and the fitting error is calculated, which is recorded as the new data loss function; if the fitting error is large, it means that concept drift has occurred between the historical data and the new data;
[0012] Then, the historical data loss function and the new data loss function are used to jointly update the corresponding time series prediction model parameters;
[0013] Finally, the time series prediction model is updated using the class probability weighted sum of the historical data loss function and the new data loss function of each time series. The training of the time series prediction model and the classification model is an end-to-end training process, that is, the process does not need to be carried out in stages. After all time series prediction models and classification models have converged, the corresponding time series prediction model can be used to predict each time series in the system.
[0014] Since the classification model and prediction model of the present invention need to be trained before they can be used, the specific operation steps of the present invention are divided into: system training step and system testing step. Among them, the system training step is to learn all the parameters in the time series prediction system; the system testing step is to use the time series prediction system to output the continuous output of future data. The details are as follows:
[0015] 1. Systematic training:
[0016] Step 1: Divide the training data set: Divide the time series data in the training set into historical data and new data along the time axis;
[0017] In the present invention, it is assumed that there are N time series in the time series prediction system. For any time series data (x1, x2, ..., x t ), where t>T, parameters T and K are selected, where the subsequence consisting of the first T data of the sequence is the historical data, and the subsequence consisting of T+1 to T+K data is the new data, denoted as (x T+1 , x2, ..., x T+K ). The total number of categories of all time series data is selected as C. (Note: any time series mentioned in all the steps of the subsequent system training are from the training data set).
[0018] Step 2: Initialize the model: Before system training begins, initialize the prediction model and classification model required by the model:
[0019] (2.1) Initialize the prediction model: Select C prediction models, each time series prediction model is defined as where c∈{1,...,C},φ c represents the parameters to be solved for the cth prediction model. At each time point t, the input of the model is The output is The output represents the prediction of the model based on the data at time point t+1. Use Gaussian random values to initialize φ c Here, the prediction model can be any existing time series prediction model, such as recurrent gated unit neural network (GRU[2]), long short-term memory recurrent neural network (LSTM[3]) and temporal convolutional network (TCN[4]). In the present invention, based on the accuracy of time prediction, the recurrent gated unit neural network (GRU[2]) is finally selected as the prediction model.
[0020] (2.2) Initialize the classification model: The selected time series classification model consists of two parts: a recurrent gated unit neural network model (GRU[2]) and a single-layer fully connected network. The computational unit of the recurrent neural network model is a multi-layer fully connected neural network with the Relu function as the activation function. At each time point t, the input layer dimension of the recurrent neural network is Its output dimension is a vector The output vector represents the compression of the data information of the previous t time points by the recurrent neural network. In addition, the single-layer fully connected neural network with the Relu function as the activation function has the output vector of the recurrent neural network at the Tth time point as input. Output vector dimensions Each dimension of the vector represents the probability that the current time series belongs to the class c represented by the dimension. The time classification model composed of these two modules is denoted as g θ , where θ is all the parameters to be solved in the above two modules, and the final output is recorded as: g θ (x 1:T ). Use Gaussian random values to initialize all the parameters to be solved in θ.
[0021] Step 3: Fitting historical data:
[0022] (3.1) Obtain the classification information of each time series: The historical data of each time series in the training data set (x1, x2, ..., x T ) is input to the time series classification model g θ In the above example, we obtain the output g of the classification model. θ (x 1:T ), and take the dimension c with the largest probability value as the category of the time series, that is,
[0023] c = argmax 1,...,C h C ,
[0024] (3.2) Fit each time series historical data: According to each time series category c obtained in (3.1), select the prediction model φ corresponding to the cth category c As the prediction model of this time series, the historical data of each time series (x1, x2, ..., x T ) is input into the prediction model to obtain the prediction results (o1, o2, ..., o T ).
[0025] Step 4: Identify whether concept drift has occurred. Specifically, use the loss function gap between the new and old model parameters on the new data to identify whether concept drift has occurred:
[0026] (4.1) Obtaining intermediate model parameters: Based on the historical data fitted in step 3, calculate the historical data fitting error (also called historical data loss function) of the time series in all training data sets, denoted as
[0027]
[0028] Among them, y t =x t+1 .
[0029] According to the fitting loss function Use gradient descent to update all prediction models φ c , recorded as:
[0030]
[0031] Among them, α is the learning rate when updating parameters, which is set manually in advance. Definition φ′ c is a history matching model.
[0032] (4.2) Identify whether concept drift has occurred based on the fitting effect of the model's intermediate parameters on the new data:
[0033] Based on the previous definition of concept drift, concept drift can be reflected by the model's fitting effect on new data. If the model that fits the historical data has a large error in fitting the new data, it is considered that concept drift has occurred. Given new data (x T+1 , x2, ..., x T+K ), using the history matching model φ′ c The fitting loss function is Also known as the new data loss function:
[0034]
[0035] in,
[0036] That is, if If the value of is large, it means that concept drift has occurred. Then the model fitted on the historical data will not be suitable for predicting new data, nor for predicting future data, because the distribution of future data is likely to have changed.
[0037] Step 5: Update all parameters of the time series prediction system based on the loss of the fitted historical data and the loss function of the fitted new data:
[0038] (5.1) In step 4, if the loss function value of fitting the new data is large, it means that the data is likely to have a concept drift. Due to the complexity of time series concept drift, it is difficult to use a specific mathematical model to model it. However, since the purpose of establishing concept drift is actually to minimize the fitting loss function of the model on new data, based on this purpose we propose to minimize the loss function of fitting new data. In addition, in order to prevent the prediction model from forgetting the fitting of historical data, the loss function of fitting historical data is also minimized. Finally, two loss functions are used to update the prediction model parameters.
[0039] (5.2) Update the prediction model parameters: Use the loss function that fits historical data and the loss function of the history matching model on new data To update the corresponding prediction model parameters φ c The update method is gradient descent, recorded as:
[0040]
[0041] Among them, β is the learning rate when updating parameters, which is set manually in advance.
[0042] (5.3) Update the classification model parameters: Since there is no real label of which class the time series belongs to in the training data set, in order to update the classification model parameters, the objective function is calculated for the classification model using the REINFORCE rule [1]. This objective function is used to calculate the gradient of updating the classification model parameters. The objective function calculated based on the REINFORCE rule is:
[0043]
[0044] in, is the (i)th time series in the training set.
[0045] The way to update the classification model parameters θ is gradient descent, recorded as:
[0046]
[0047] Among them, β is the learning rate when updating parameters, which is set manually in advance.
[0048] Step 6: After completing the update of all parameters in the above steps, continue to execute steps 3 to 5 for a total of E rounds (the training rounds are manually set in advance), or when the parameters of all prediction models have hardly changed, the training step ends. When the training step ends, record the classification results of the classification model of all time series in the training set, recorded as c (i) .
[0049] (ii) System testing: Given any 1 or N time series in the training set, predict 1 or K future data.
[0050] Step 1: According to the label c obtained in step 6 of the system training step (i) , select the corresponding prediction model
[0051] Step 2: Given time series data Input them into the prediction model in sequence
[0052] (2.1) If you only need the prediction result at time t+1, you only need to take out the prediction model The output at the tth moment.
[0053] (2.2) If the prediction results from time points t+2 to t+K are needed, t+1 needs to be used as input again. Get the prediction result for the next moment.
[0054] Technical Effects
[0055] The present invention solves the problem of model aging at future time points by modeling concept drift in the time series prediction system, thereby improving the prediction effect of the system at future time points. The root mean square error (RMSE) and mean absolute error (MAE) are used to evaluate the accuracy of time series prediction. The smaller the RMSE and MAE, the higher the prediction accuracy. During the system testing phase, three time series data sets were used: Stock, Climate, and Synthetic, and RMSE and MAE were calculated on these data sets. Input a sequence of 1 to T+K, and output a prediction sequence of 1 to T+K′. represents the output of the i-th sequence at time point t, represents the original value of the ith sequence at the tth time point, then RMSE and MAE can be expressed as:
[0056]
[0057]
[0058] Based on the theoretical analysis of time series prediction loss, the present invention designs a new time series prediction algorithm, which models the difference between historical data patterns and future data patterns, and proposes a two-step training method, which ensures that the model's memory of historical data will not disappear easily on the one hand, and ensures better prediction results on future data on the other hand. Through theoretical analysis and experimental verification, it is shown that in the time series prediction task, the prediction method of the present invention can effectively alleviate the model aging problem caused by the change of data over time, that is, concept drift, compared with other methods; the present invention proposes to implement a cluster-based prediction algorithm on data containing multiple time series, and use the information of other similar data to further improve the prediction accuracy of the model. The present invention can be widely used in various time series prediction tasks based on real values to improve the prediction accuracy of the task on future data points.
[0059] The technical effects of the present invention are mainly reflected in the following three aspects:
[0060] (1) The prediction model of the time series prediction system of the present invention can use different existing time series prediction models. Compared with these time series prediction models, the time prediction accuracy of the present invention is significantly improved;
[0061] (2) Based on concept drift modeling, the present invention can handle future data changes. Compared with the existing methods of handling future data changes through online updating and retraining, the present invention has significant improvements in accuracy and time efficiency;
[0062] (3) Since the time series prediction system in the present invention introduces a time series classification model and classifies the data series based on the results of time series prediction, it is equivalent to clustering the time series in the training data. By observing the classification results of the classifier after the training, it can be found that the time series classifier of the present invention can classify data with similar time series features such as linearity and frequency into the same class. Therefore, the time series prediction system in the present invention can be considered as a system that can perform multiple tasks (clustering and time series prediction). BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a schematic diagram of the process of the present invention.
[0064] Figure 2 A diagram illustrating the training process of the classifier and predictor.
[0065] Figure 3 4 is a comparison chart of the prediction accuracy of the time prediction system of the present invention and the existing retraining (fine-tuning strategy).
[0066] Figure 4 Graph comparing the training time of the time prediction system of the present invention and the existing retraining (fine-tuning strategy).
[0067] Figure 5 This is a classification effect diagram of the classifier of the present invention. The points in the figure are the output values of the classifier visualized by t-SNE. DETAILED DESCRIPTION
[0068] like Figure 1 As shown, this implementation uses Stock, Climate and Synthetic data sets, and improves the prediction accuracy of the time series prediction system at future time points through this implementation method. This embodiment specifically includes:
[0069] (I) System training steps:
[0070] Step 1: Divide the training data set: (divide the time series data in the training set along the time axis according to historical data and new data)
[0071] There are N time series in the time series prediction system of the present invention. For any time series data (x1, x2, ..., x t ), where t>T, parameters T and K are selected, where the subsequence consisting of the first T data of the sequence is the historical data, and the subsequence consisting of T+1 to T+K data is the new data, denoted as (x T+1 , x2, ..., x T+K ). For all three data sets, the past data and future data are divided along the time axis in a ratio of 4:1, and the past data are divided into historical data and new data in a ratio of 3:2. The total number of categories of all time series data is selected as C. For three different data sets, we set different total numbers of categories, namely: 3, 3, and 5. The total number of categories is selected by pre-training a recurrent gated unit neural network (GRU[2]) on the past data, and then taking the last layer of latent vectors of each time series for visualization, and determining the total number of different categories based on the number of clusters of the visualized latent vectors. The pre-trained recurrent gated unit neural network has nothing to do with the prediction model used in this system. (Note: Any time series mentioned in all the steps of the subsequent system training are from the training data set)
[0072] Step 2: Initialize the model: Before system training begins, initialize the prediction model and classification model required by the model:
[0073] (2.1) Initialize the prediction model: Select C prediction models, each time series prediction model is defined as where c∈{1,...,C},φ c represents the parameters to be solved for the cth prediction model. At each time point t, the input of the model is The output is The output represents the prediction of the model based on the data at time point t+1. Use Gaussian random values to initialize φ c All parameters to be solved in . The prediction model of the present invention can be any existing time series prediction model, such as recurrent gated unit neural network (GRU[2]), long short-term memory recurrent neural network (LSTM[3]) and temporal convolutional network (TCN[4]). In the present invention, based on the accuracy of time prediction, the recurrent gated unit neural network (GRU[2]) is finally selected as the prediction model. For the specific output mechanism of GRU, that is, The calculation function of is,
[0074] z t =sigmoid(W xz x t +W hz h t-1 ),
[0075] r t =sigmoid(W xr x t +W hr h t-1 ),
[0076]
[0077]
[0078] o t =W o h t +b o .
[0079] where {W.., b o} are all the parameters to be learned for GRU; sigmoid represents the sigmoid activation function[7], and tanh represents the tanh activation function[8].
[0080] (2.2) Initialize the classification model: The selected time series classification model consists of two modules: a recurrent neural network model and a single-layer fully connected network. Among them, the computational unit of the recurrent neural network model is a multi-layer fully connected neural network with the Relu function as the activation function. At each time point t, the input layer dimension of the recurrent neural network is Its output dimension is a vector The output vector represents the compression of the data information of the previous t time points by the recurrent neural network. In addition, a single-layer fully connected neural network with a softmax function as the activation function, the input of which is the output vector of the recurrent neural network at the Tth time point The output vector dimension is Each dimension of the vector represents the probability that the current time series belongs to the class c represented by the dimension. The time classification model composed of these two modules is denoted as g θ , where θ is all the parameters to be solved in the above two modules, and the final output is recorded as: g θ (x 1:T ). Use Gaussian random values to initialize all the parameters to be solved in θ. Unlike using GRU for prediction, using GRU for time series classification only requires taking the output vector h at the last time point. T , and input it into a fully connected neural network for classification.
[0081] h C =softmax(W c h T +b c ).
[0082] Where {W c , b c} is the fully connected neural network parameter. Since the time series classification model also uses the recurrent gated neural network model, its calculation mechanism is similar to the prediction model, and the main parameters are also the same.
[0083] Step 3: Fit historical data: Use the full data update method, that is, each parameter update is based on all time series data in the system.
[0084] (3.1) Obtain the classification information of each time series: The historical data of each time series in the training data set (x1, x2, ..., x T ) is input into the time series classification model θ to obtain the output g of the classification model θ (x 1:T ), and take the dimension c with the largest probability value as the category of the time series.
[0085] (3.2) Fit each time series historical data: According to each time series category c obtained in (3.1), select the prediction model φ corresponding to the cth category c As the prediction model of this time series, the historical data of each time series (x1, x2, ..., x T ) is input into the prediction model to obtain the prediction results (o1, o2, ..., o T ).
[0086] Step 4: Identify whether concept drift occurs:
[0087] (4.1) Obtaining intermediate model parameters: Based on the historical data fitted in step 3, calculate the historical data fitting error (also called loss function) of the time series in all training data sets, denoted as
[0088]
[0089] where y t =x t+1 .
[0090] According to the fitting loss function Use gradient descent to update all prediction models φ c , recorded as,
[0091]
[0092] Where α is the learning rate when updating parameters, which is generally set to 0.005. Define φ′ c is a history matching model.
[0093] (4.2) Modeling concept drift on new data based on model intermediate parameters:
[0094] Based on the previous definition of concept drift, concept drift can be reflected by the model's fitting effect on new data. If the model that fits the historical data has a large error in fitting the new data, it is considered that concept drift has occurred. Given new data (x T+1 , x2, ..., x T+K ), using the history matching model φ′ c The fitting loss function is
[0095]
[0096] in
[0097] That is, if If the value of is large, it means that concept drift has occurred. Then the model fitted on the historical data will not be suitable for predicting new data, nor for predicting future data, because the distribution of future data is likely to change.
[0098] Step 5: Update all parameters of the time series prediction system based on the loss and concept drift of fitting historical data:
[0099] (5.1) Update the prediction model parameters: Use the loss function that fits historical data and the loss function of the history matching model on new data To update the corresponding prediction model parameters φ c The update method is gradient descent, denoted as,
[0100]
[0101] Where β is the learning rate when updating parameters, which is generally set to 0.001. Compared with α, the value of β is usually set smaller, because historical data is longer than new data (3:2), so its gradient ratio should be set larger; in addition, since the addition of new data loss function will make the training process unstable, reducing the training ratio of new data loss function can prevent huge changes in the parameters of the prediction model, thereby making the training process more stable.
[0102] (5.2) Update the classification model parameters: Since there is no real label of which class the time series belongs to in the training data set, in order to update the classification model parameters, the REINFORCE rule [1] is used to calculate the objective function for the classification model. The objective function is used to calculate the gradient of updating the classification model parameters. The objective function calculated based on the REINFORCE rule is:
[0103]
[0104] in, is the (i)th time series in the training set, Indicates that the current time series belongs to class c k The probability of k is The dimension with the largest value, c k The class represented by this dimension.
[0105] The way to update the classification model parameters θ is gradient descent, denoted as,
[0106]
[0107] Step 6: After completing the update of all parameters in the above steps, continue to use all time series in the training set to execute steps 3 to 5 for a total of 1000 rounds, and end the training step. When the training step ends, record the classification results of the classification model of all time series in the training set, recorded as c (i) .
[0108] (ii) System testing steps: Given any N time series in the training set, predict K future data and calculate the accuracy of time series prediction on the divided future data.
[0109] Step 1: According to the label c obtained in step 6 of the system training step (i) , select the corresponding prediction model
[0110] Step 2: Given time series data Input them into the prediction model in sequence Get the output at each time point, and use t+1 as input again, and input it to Get the prediction result for the next moment until K prediction results are obtained.
[0111] Step 3: Calculate the corresponding indicators MAE and RMSE based on the K prediction results and future data.
[0112] The prediction model deployed in the time series prediction system of the present invention can be any existing time series prediction model. In the process of testing the system, several time series prediction models with the best existing effects were selected as prediction models in the system: recurrent gated unit neural network (GRU[2]), long short-term memory recurrent neural network (LSTM[3]) and temporal convolutional network (TCN[4]). Based on the test results, the time series prediction accuracy of the prediction models deployed in the system of the present invention is significantly improved compared with the corresponding prediction models and the existing time series prediction system. Among them, the best prediction accuracy is GRU deployed as a prediction model in the system of the present invention, especially on the Stock data set, the prediction accuracy can be improved by 33%. On three identical data sets, when GRU is used as the structure of the predictor in the time series prediction module, the RMSE and MAE predicted by other time series prediction models on each data set are compared:
[0113] Climate dataset:
[0114] ARIMA: RMSE1.0644, MAE0.8485
[0115] GRU: RMSE 0.84, MAE 0.60
[0116] LSTM: RMSE 0.86, MAE 0.82
[0117] TCN: RMSE 0.86, MAE 0.82
[0118] Timed-LSTM: RMSE0.79, MAE0.61
[0119] DARNN: RMSE 0.79, MAE 0.53
[0120] LSTNet: RMSE 0.75, MAE 0.57
[0121] LLF(GRU): RMSE0.69, MAE0.51
[0122] Stock Dataset:
[0123] ARIMA: RMSE1.0080, MAE0.5553
[0124] GRU: RMSE 0.87, MAE 0.52
[0125] LSTM: RMSE 0.97, MAE 0.63
[0126] TCN: RMSE 0.97, MAE 0.63
[0127] Timed-LSTM: RMSE0.97, MAE0.53
[0128] DARNN: RMSE 0.85, MAE 0.74
[0129] LSTNet: RMSE 0.79, MAE 0.61
[0130] LLF(GRU): RMSE 0.58, MAE 0.51
[0131] Synthetic Dataset:
[0132] ARIMA: RMSE0.0224, MAE0.0201
[0133] GRU: RMSE 0.02, MAE 0.02
[0134] LSTM: RMSE 0.03, MAE 0.02
[0135] TCN: RMSE 0.03, MAE 0.02
[0136] Timed-LSTM: RMSE0.05, MAE0.03
[0137] DARNN: RMSE 0.02, MAE 0.01
[0138] LSTNet: RMSE 0.03, MAE 0.02
[0139] LLF(GRU): RMSE0.0077, MAE0.0046
[0140] The present invention can be widely applied to a time series prediction system based on a neural network to improve the prediction effect of the system at a future time point.
[0141] Existing strategies for dealing with future data changes include fine-tuning the model based on new data and retraining the model based on new data and historical data [5]. Compared with these two strategies, the time series prediction system of the present invention achieves the highest time series prediction accuracy while ensuring that the time complexity of retraining and the training time of the model fine-tuning method are lower. Figure 3 and Figure 4 First, Figure 3In Figure 1, we compared the prediction accuracy of the ARIMA model [6] and the recurrent gated neural network model (GRU [2]) using two strategies with the time series prediction system of the present invention. The vertical axis of the figure represents RMSE. It can be seen that the time series prediction system of the present invention (data represented by the red line) achieves more accurate prediction results on all three data sets than the two compared models and corresponding strategies, especially on the Stock data set, where it has achieved an improvement of nearly 50%. In addition, since the strategy for handling future data changes and the method proposed in the present invention both aim to make the prediction model fit the past data accurately, Figure 3 It can be seen that the method proposed in the present invention can accurately fit past data and new data at the same time (the distance between the red dotted line and the green dotted line is smaller than the distance between the same color columns on the three data sets). This shows that the method in the present invention can accurately capture the occurrence of probability drift while maintaining historical information, and minimize the historical data fitting error and the new data fitting error through the update method in the present invention. This is something that the two existing strategies for dealing with future data changes cannot do. Secondly, Figure 4 The training time of the recurrent gating neural network model on three data sets using two strategies of fine-tuning the model based on new data and retraining the model based on new data and historical data and the method of the present invention is shown. It can be seen that the training time required by the present method is the least on the three data sets.
[0142] Since the time series prediction system in the present invention introduces a time series classification model and classifies the data series based on the results of time series prediction, it is equivalent to clustering the time series in the training data. By observing the classification results of the classifier after the training, it can be found that the time series classifier of the present invention can classify data with similar time series features such as linearity and frequency into the same class. Therefore, the time series prediction system in the present invention can be considered as a system that can perform multiple tasks (clustering and time series prediction). The effect of clustering the data in the training data set is as follows: Figure 5 As shown. Figure 5 In the figure, each point represents a time series, and points of the same color are classified into the same category by the classification model. From the example in the figure, we can see that time series from different categories have different frequencies (different frequencies). The sequences that are clustered into the same category (the two red time series) have certain similarities in period and frequency.
[0143] References
[0144] [1]Williams R J.Simple statistical gradient-following algorithms forconnectionist reinforcement learning[J].Machine learning,1992,8(3):229-256.
[0145] [2]Chung J,Gulcehre C,Cho K H,et al.Empirical evaluation of gatedrecurrent neural networks on sequence modeling[J].arXiv preprint arXiv:1412.3555,2014.
[0146] [3]Hochreiter S,Schmidhuber J.Long short-term memory[J].Neuralcomputation,1997,9(8):1735-1780.
[0147] [4]Bai S,Kolter J Z,Koltun V.An empirical evaluation of genericconvolutional and recurrent networks for sequence modeling[J].arXiv preprintarXiv:1803.01271,2018.
[0148] [5]Zhang Y,Feng F,Wang C,et al.How to retrain recommender system?Asequential meta-learning method[C] / / Proceedings of the 43rd International ACMSIGIR Conference on Research and Development in Information Retrieval.2020:1479-1488.
[0149] [6]Hillmer S C,Tiao G C.An ARIMA-model-based approach to seasonaladjustment[J].Journal of the American Statistical Association,1982,77(377):63-70.
[0150] [7]Yin X,Goudriaan J A N,Lantinga E A,et al.A flexible sigmoidfunction of determinate growth[J].Annals of botany,2003,91(3):361-371.
[0151] [8]Karlik B,Olgac A V.Performance analysis of various activationfunctions in generalized MLP architectures of neural networks[J].International Journal of Artificial Intelligence and Expert Systems,2011,1(4):111-122。
Claims
1. A method for improving the time series prediction performance of a time series prediction system is based on concept drift modeling technology; wherein, The time series prediction system includes: several time series prediction models with the same architecture, a time series classification model for time series data similarity assessment, and several time series data of the same length; here, the time series data is a sequence of data points arranged in chronological order of occurrence, wherein each data point is represented by a real number; the basic prediction process of the time series prediction system is as follows: the time series prediction model takes a set of time series of fixed length as input and outputs predicted values of data points at the next time point or several time points; wherein the fixed-length time series as input is called past data; the real value at the next time point or several time points is called future data; the data points at the next time point or several time points output by the time series prediction system based on the past data are called prediction results; the goal of the time series prediction system is to minimize the gap between the prediction results and the future data; Among them, the several time series prediction models with the same architecture are used to model concept drift and predict future data for time series belonging to different classes; the time series classification model is a recurrent neural network model, and the output of the last time node of the recurrent neural network is used to calculate the probability that a time series belongs to a certain class, which is used to classify all time series in the time series prediction system; the several time series with the same length are used for classification, and then the time series prediction model is used to fit historical data and model concept drift on time series data of the same class; all time series prediction models and time series classification models are learned using an end-to-end training framework based on REINFORCE rules; The method specifically includes: (1) First, there is a difference between the past data and future data as inputs to the time series model, and this difference is defined as concept drift; the past data of each time series is divided into historical data and new data; the total length of the historical data and the new data is the same as the total length of the past data; and the past data of each time series data is input into the time series classification model to obtain the class label of the time series; (2) Then, the time series data with the same label share the same time series prediction model, and the time series prediction model is used to fit the data on all historical data belonging to the class, and the parameters of each intermediate time series prediction model are obtained by calculating the fitting error; here, the fitting error is also the historical data loss function; (3) Use the parameters of the intermediate time series prediction model to fit the new data of the time series data in the corresponding class, calculate the fitting error, and record it as the new data loss function; if the fitting error is large, it means that concept drift has occurred between the historical data and the new data; (4) Use the historical data loss function and the new data loss function to jointly update the corresponding time series prediction model parameters; (5) Finally, the time series prediction model is updated using the class probability weighted sum of the historical data loss function and the new data loss function of each time series. The training of the time series prediction model and the classification model is an end-to-end training process, that is, the process does not need to be carried out in stages. After all the time series prediction models and classification models have converged, each time series in the system can be predicted using the corresponding time series prediction model. Since the classification model and the prediction model can only be used after training, the specific operation steps of the method are divided into: a system training step and a system testing step; wherein the system training step is to learn all the parameters in the time series prediction system; the system testing step is to use the time series prediction system to output future data continuously; (1) Systematic training: Step 1: Divide the training data set: Divide the time series data in the training set into historical data and new data along the time axis; Assume that there are N time series in the time series prediction system. For any time series data (x1, x2, ..., x t ), where t>T, parameters T and K are selected, where the subsequence consisting of the first T data of the sequence is the historical data, and the subsequence consisting of T+1 to T+K data is the new data, recorded as (x T+1 ,x2,…,x T+K ); The total number of categories of all time series data is selected as C; Step 2: Initialize the model: Before system training begins, initialize the prediction model and classification model: (2.1) Initialize the prediction model: select C prediction models, each time series prediction model is defined as Where c∈{1,…,C}, φ c Represents the parameters to be solved for the c-th prediction model; at each time point t, the input of the model is The output is Among them, the output represents the model's prediction of the data at time point t+1 based on t time points; Gaussian random values are used to initialize φ c All parameters to be solved in ; (2.2) Initialize the classification model: The selected time series classification model consists of two parts: a recurrent neural network model and a single-layer fully connected network. The computational unit of the recurrent neural network model is a multi-layer fully connected neural network with the Relu function as the activation function. At each time point t, the input layer dimension of the recurrent neural network is Its output dimension is a vector The output vector represents the compression of the data information of the first t time points by the recurrent neural network; the single-layer fully connected neural network with the Relu function as the activation function has the output vector of the recurrent neural network at the Tth time point as input. Output vector dimensions Each dimension of the vector represents the probability that the current time series belongs to the class c represented by the dimension; the time classification model composed of these two modules is denoted as g θ , where θ is all the parameters to be solved in the above two modules, and the final output is recorded as: g θ (x 1:T ) ; Use Gaussian random values to initialize all parameters to be solved in θ; Step 3: Fitting historical data: (3.1) Obtain the classification information of each time series: The historical data of each time series in the training data set (x1, x2, ..., x T ) is input to the time series classification model g θ In the classification model, we get the output g θ (x 1:T ), and take the dimension c with the largest probability value as the category of the time series, that is, c=argmax 1,..,C h C , (3.2) Fit each time series historical data: According to each time series category c obtained in (3.1), select the prediction model φ corresponding to the cth category c For the prediction model of this time series, the historical data of each time series (x1, x2, ..., x T ) is input into the prediction model to obtain the prediction results (o1, o2,…, o T ); Step 4: Identify whether concept drift has occurred. Specifically, use the loss function gap between the new and old model parameters on the new data to identify whether concept drift has occurred: (4.1) Obtaining intermediate model parameters: Based on the historical data fitted in step 3, calculate the historical data fitting error of the time series in all training datasets, also known as the historical data loss function, denoted as Among them, y t =x t+1 ; According to the fitting loss function Update all prediction models φ using the gradient descent method c , recorded as: Among them, α is the learning rate when updating parameters, which is set manually in advance; define φ c ′ is a history matching model; (4.2) Identify whether concept drift has occurred based on the fitting effect of the intermediate parameters of the model on the new data: Based on the definition of concept drift, concept drift is reflected by the fitting effect of the model on the new data; if the model that fits the historical data has a large fitting error on the new data, it is considered that concept drift has occurred; given the new data (x T+1 ,x2,…,x T+K ), using the history matching model φ c ′ The fitting loss function is Also known as new data loss function: in, like If the value of is large, it means that concept drift has occurred, and the model fitted on the historical data will not be suitable for predicting new data; Step 5: Update all parameters of the time series prediction system based on the loss and concept drift of fitting historical data: (5.1) Given that the purpose of establishing concept drift is to minimize the model's fitting loss function on new data, we propose to minimize the loss function for fitting new data. In addition, to prevent the prediction model from forgetting its fitting of historical data, we also minimize the loss function for fitting historical data. Finally, we use these two loss functions to update the prediction model parameters. (5.2) Update the prediction model parameters: Use the loss function that fits historical data And the loss function of the history matching model on new data To update the corresponding prediction model parameters φ c , the update method is gradient descent, recorded as: Among them, β is the learning rate when updating parameters, which is set manually in advance; (5.3) Updating the classification model parameters: Since there is no real label of which class the time series belongs to in the training dataset, in order to update the classification model parameters, the objective function is calculated for the classification model using the REINFORCE rule. This objective function is used to calculate the gradient of the updated classification model parameters. The objective function calculated based on the REINFORCE rule is: in, is the (i)th time series in the training set; The way to update the classification model parameters θ is gradient descent, which is recorded as: Among them, β is the learning rate when updating parameters, which is set manually in advance; Step 6: After completing the update of all parameters in the above steps, continue to perform steps 3 to 5 for a total of E rounds. The training rounds are set manually in advance, or when the parameters of all prediction models hardly change, the training step ends. When the training step ends, the classification results of the classification model of all time series in the training set are recorded, which is recorded as c (i) ; (2) System testing: Given any 1 or N time series in the training set, predict 1 or K future data points; Step 1: According to the label c obtained in step 6 of the system training step (i) , select the corresponding prediction model Step 2: Given time series data Input them into the prediction model in sequence (2.1) If only the prediction result at time point t+1 is needed, then take out the prediction model The output at the tth moment; (2.2) If the prediction results from time points t+2 to t+K are needed, t+1 is used as input again and input to Get the prediction result for the next moment.
Citation Information
Cited By
Double-branch pyramid attention time sequence prediction method
CN120632352A
