CN115130584A - Time series prediction method, device, equipment and storage medium - Google Patents

Time series prediction method, device, equipment and storage medium Download PDF

Info

Publication number
CN115130584A
CN115130584A CN202210758221.XA CN202210758221A CN115130584A CN 115130584 A CN115130584 A CN 115130584A CN 202210758221 A CN202210758221 A CN 202210758221A CN 115130584 A CN115130584 A CN 115130584A
Authority
CN
China
Prior art keywords
prediction
training
sub
sequence data
time series
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210758221.XA
Other languages
Chinese (zh)
Inventor
李婉莹
胡要林
景世青
欧阳葆青
江开放
王国勋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Resources Cement Holdings Ltd
Runlian Software System Shenzhen Co Ltd
Original Assignee
China Resources Cement Holdings Ltd
Runlian Software System Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Resources Cement Holdings Ltd, Runlian Software System Shenzhen Co Ltd filed Critical China Resources Cement Holdings Ltd
Priority to CN202210758221.XA priority Critical patent/CN115130584A/en
Publication of CN115130584A publication Critical patent/CN115130584A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"

Abstract

The application relates to an artificial intelligence technology and discloses a time series prediction method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a time series data set; decomposing the time sequence data set through discrete wavelet transform to obtain a plurality of sub-sequence data; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors; inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained by training a meta-learning model. The application improves the accuracy of prediction.

Description

Time series prediction method, device, equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a time series prediction method, apparatus, device, and storage medium.
Background
The time series prediction model can show the development and change trend and rule of the object in a certain period, deepen the understanding of people on the system or the phenomenon, and provide decision guidance for related fields. However, because the time series have the characteristics of diversity, non-stationarity and the like, the prediction accuracy and stability of the universal time series prediction model are difficult to satisfy the user. In the prior art, the traditional time sequence prediction methods (ARMA and ARIMA) are suitable for short-term and stable time sequence data prediction, even if a plurality of differential transformations are performed to eliminate the periodic and seasonal characteristics of the sequence, the stability condition is difficult to meet, and the predicted sequence has larger errors, so that the problem that how to improve the prediction accuracy of the time sequence prediction method is needed to be solved urgently is solved.
Disclosure of Invention
The application provides a time series prediction method, a time series prediction device, time series prediction equipment and a storage medium, and aims to solve the problem that the existing time series prediction is low in accuracy.
In order to solve the above problem, the present application provides a time series prediction method, including:
acquiring a time series data set;
decomposing the time sequence data set through discrete wavelet transform to obtain a plurality of sub-sequence data;
respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors;
inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
and carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained by training a meta-learning model.
Further, the decomposing the time series data set by the discrete wavelet transform comprises:
and decomposing the time series data set through third-order decomposition of discrete wavelet transform, and taking low-frequency data obtained by each-order decomposition and high-frequency data obtained by third-order decomposition as the sub-sequence data.
Further, the performing feature extraction on the plurality of sub-sequence data to obtain a plurality of feature vectors includes:
according to a preset feature set, performing feature extraction on a sample in each piece of sub-sequence data to obtain each feature value of the sample;
and obtaining a feature vector corresponding to the sample based on each feature value of the sample.
Further, the performing feature extraction on the sample in each of the sub-sequence data according to a preset feature set to obtain each feature value of the sample includes:
decomposing the sample into a trend component, a periodic component and a remainder by a decomposition algorithm;
according to the trend intensity characteristics in the characteristic set, calculating the trend intensity characteristics of the sample by adopting the following formula:
Figure BDA0003720249190000021
according to the seasonal intensity characteristics in the characteristic set, calculating the seasonal intensity characteristics of the sample by adopting the following formula:
Figure BDA0003720249190000022
according to the first-order autocorrelation coefficient characteristics in the characteristic set, calculating the first-order autocorrelation coefficient characteristics of the sample by adopting the following formula: first order autocorrelation ═ Corr (R) t ,R t-1 )
Wherein R is t Represents the remainder, x t Representing the sample, S, in the sub-sequence data t Representing said periodic component, T t Representing the trend component, var () is a variance function, Corr () represents a correlation.
Further, before the acquiring the time-series data set, the method further includes:
acquiring a training data set;
decomposing the training data set through discrete wavelet transform to obtain a plurality of training sub-sequence data;
respectively extracting features of the training sub-sequence data to obtain a plurality of training vectors;
inputting the training vector into an alternative model for prediction to obtain a prediction training result, wherein the alternative model comprises ARIMA, SVR, LSTM, ETS, TBATS and
Figure BDA0003720249190000024
a model;
based on the training data set and the prediction training result, scoring by using a preset judgment condition;
and using the candidate model with the highest score corresponding to each training sub-sequence data as a prediction model of the training sub-sequence data.
Further, the scoring by using the preset judgment condition includes:
scoring the candidate models by:
Figure BDA0003720249190000023
wherein n represents the predicted length of the sequence, y represents the true value of the sequence, and h (x) i ) Representing the model prediction value and t representing the number of correct predictions.
Further, the training of the weight of each prediction result by the meta-learning model includes:
determining a prediction error based on the predicted training result and a training data set;
inputting the training vector into a meta-learning model for processing to obtain an output result, and performing Softmax transformation on the output result to obtain a processing result;
obtaining a loss function based on the processing result and the prediction error;
and performing gradient descent on the loss function by adopting a gradient algorithm to minimize the loss function to obtain the weight.
In order to solve the above problem, the present application further provides a time series prediction apparatus, including:
the acquisition module is used for acquiring a time series data set;
the decomposition module is used for decomposing the time series data set through discrete wavelet transformation to obtain a plurality of sub-sequence data;
the characteristic extraction module is used for respectively extracting the characteristics of the plurality of sub-sequence data to obtain a plurality of characteristic vectors;
the prediction module is used for inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
and the weighted output module is used for carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained by training a meta-learning model.
In order to solve the above problem, the present application also provides a computer device, including:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method of time series prediction as described above.
In order to solve the above problem, the present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon, which when executed by a processor implement the time series prediction method as described above.
Compared with the prior art, the time series prediction method, the time series prediction device, the time series prediction equipment and the storage medium provided by the embodiment of the application have at least the following beneficial effects:
obtaining a processing sample by obtaining a time series data set, and decomposing the time series data set by discrete wavelet transform to obtain a plurality of sub-series data; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors, realizing the representation of the data, realizing the expression of the implicit features of the data through the feature vectors, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and multiplying each prediction result by the weight occupied by the corresponding sub-sequence data to obtain a final result, wherein the weight of each sub-sequence data is obtained through meta-learning model training, and the accuracy of prediction is improved by respectively processing the feature vectors corresponding to each sub-sequence data and then performing weighted summation.
Drawings
In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for describing the embodiments of the present application, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without inventive effort.
Fig. 1 is a schematic flowchart of a time series prediction method according to an embodiment of the present application;
FIG. 2 is a tree structure diagram of a third order decomposition of a discrete wavelet transform according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating one embodiment of step S3 of FIG. 1;
FIG. 4 is a flowchart illustrating one embodiment of step S5 of FIG. 1;
fig. 5 is a block diagram of a time series prediction apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. One skilled in the art will explicitly or implicitly appreciate that the embodiments described herein can be combined with other embodiments.
The application provides a time series prediction method. Referring to fig. 1, fig. 1 is a schematic flow chart of a time series prediction method according to an embodiment of the present application.
In this embodiment, the time-series prediction method includes:
s1, acquiring a time series data set;
specifically, the time series set mainly includes high frequency data (weekly, daily, and hourly) and low frequency data (yearly, quarterly, and monthly) in the field of industrial production and the like; furthermore, the method can be used for specific application scenarios such as wind power generation prediction, production prediction and the like. The set of time-series may be represented as X ═ X 1 ,x 2 ,...,x m ]Where x represents a time series class and m represents the number of time series samples. By retrieving the time-series data from a databaseThe collection, or directly from the web, such as github, etc.
Further, before the acquiring the time-series data set, the method further includes:
acquiring a training data set;
decomposing the training data set through discrete wavelet transformation to obtain a plurality of training sub-sequence data;
respectively extracting features of the training sub-sequence data to obtain a plurality of training vectors;
inputting the training vector into an alternative model for prediction to obtain a prediction training result, wherein the alternative model comprises ARIMA, SVR, LSTM, ETS, TBATS and
Figure BDA0003720249190000051
a model;
based on the training data set and the prediction training result, scoring by using a preset judgment condition;
and using the candidate model with the highest score corresponding to each training sub-sequence data as a prediction model of the training sub-sequence data.
Specifically, before the time series data set is acquired, the prediction model corresponding to each sub-sequence is determined, and the prediction model corresponding to each sub-sequence is ensured to be better.
The method comprises the steps of obtaining a training data set from a database, decomposing the training data set through three-order decomposition of discrete wavelet transformation, and obtaining three low-frequency training sub-sequence data and one high-frequency training sub-sequence data. Forming a training vector based on the plurality of features of the training sub-sequence data by extracting the plurality of features of each training sub-sequence data; sequentially inputting the training vectors corresponding to the training sub-training data into an alternative model for prediction to obtain a prediction training result, namely sequentially inputting three low-frequency training sub-sequence data and one training vector corresponding to high-frequency training sub-sequence data into ARIMA, SVR, LSTM, ETS, TBATS and
Figure BDA0003720249190000052
model feedingAnd (5) performing training.
And according to the labels corresponding to the training samples in the training data set and the corresponding prediction training results, scoring by using preset judgment conditions, and taking the candidate model with the highest score corresponding to the training sub-sequence data as the prediction model of the training sub-sequence data. For example, when training sub-training data of high frequency is input into each alternative model for training to obtain a prediction training result, based on the training data set and the prediction training result, corresponding scores of 0.5, 0.6, 0.55, 0.7, 0.4 and 0.5 are obtained; at this time, a model corresponding to 0.7 with the highest score, namely ETS, is selected, and the ETS is used as a prediction model for predicting a vector corresponding to high-frequency data subsequently.
An ARIMA model (automated Integrated Moving Average model), a differential Integrated Moving Average Autoregressive model, also called an Integrated Moving Average Autoregressive model (Moving may also be called sliding), is one of the methods of time series prediction analysis. In ARIMA (p, d, q), AR is "autoregressive" and p is the number of autoregressive terms; MA is "moving average", q is the number of terms of the moving average, and d is the number of differences (order) made to make it a stationary sequence.
SVR (support vector regression) is a regression algorithm that applies similar techniques of Support Vector Machines (SVMs) to perform regression analysis.
The Long Short-Term Memory network (LSTM) is a time-cycle neural network, which is specially designed to solve the Long-Term dependence problem of the general RNN (cyclic neural network), and all RNNs have a chain form of repeated neural network modules.
The ETS model includes the following three components: the Error term (Error) may be an additive model or a multiplicative model; the Trend term (Trend) can be none, additive model, multiplicative model; the seasonal term (seaquality) may be none, additive model, multiplicative model; the random combination of the three parts forms an ETS model
TBATS (Trigonometric search, Box-Cox transformation, ARMA errors, Trend and search components) time series prediction model, using Seasonal features, Box-Cox transformation, ARMA errors, trends, and Seasonal components.
Bayesian model
Figure BDA0003720249190000062
Based on Bayesian principle, the sample data set is classified by using probability statistical knowledge.
And the accuracy of subsequent prediction is improved by determining the optimal prediction model for each sub-sequence data.
Still further, the scoring by using the preset judgment condition includes:
scoring the candidate models by:
Figure BDA0003720249190000061
wherein n represents the predicted length of the sequence, y represents the true value of the sequence, and h (x) i ) Representing the model prediction value and t representing the number of correct predictions.
Specifically, the prediction effect of the model is judged through the average absolute error and the prediction success rate of the two evaluation indexes, and the model with the optimal two evaluation indexes is selected as the prediction model corresponding to each sub-sequence data. If the two scores corresponding to the models are not greatly different, the prediction Success Rate (SR) score is considered preferentially.
And the data quantization is realized by determining the judgment condition of the alternative model, so that the corresponding prediction model can be conveniently determined from the alternative models of each training sub-sequence data.
S2, decomposing the time series data set through discrete wavelet transform to obtain a plurality of sub-series data;
specifically, the time-series data set is decomposed into four sub-series data, i.e., three low-frequency data and one high-frequency data, using a third-order decomposition of a discrete wavelet transform.
Further, the decomposing the time series data set by the discrete wavelet transform comprises:
and decomposing the time series data set through third-order decomposition of discrete wavelet transform, and taking low-frequency data obtained by each-order decomposition and high-frequency data obtained by third-order decomposition as the sub-sequence data.
Specifically, the low-frequency data y is obtained by performing convolution calculation on a low-pass filter and a high-pass filter which respectively have impulse responses in the time series data set low [k]And high frequency data y high [k]The invention adopts three-order decomposition of discrete wavelet transform, and takes low-frequency data obtained by each order decomposition and high-frequency data (namely y) obtained by the last order decomposition low1 、y low2 、y low3 And y high3 ) The sub-sequence constructed as the prediction model has the decomposed data set of
Figure BDA0003720249190000071
Wherein
Figure BDA0003720249190000072
Figure BDA0003720249190000073
As shown in FIG. 2, a tree structure diagram of the third order decomposition of the discrete wavelet transform is shown, by applying a low pass filter h [ n ]]And a high-pass filter g n]The down-sampling process is performed such that the sequence length of the filter after processing is one-half of that before processing. Wherein, the jth order low pass filter h j [n]And a high-pass filter g j [n]Expressed as: h is j [n]=Z -1 h j-1 [n]=Z -2 h j-2 [n]=...=Z -j+1 h 1 [n]
g j [n]=Z -1 g j-1 [n]=Z -2 g j-2 [n]=...=Z -j+1 g 1 [n]
The time series data set is subjected to three-order decomposition to obtain a plurality of low-frequency data and a high-frequency data, and the low-frequency data and the high-frequency data are respectively processed and subsequently predicted, so that the prediction accuracy is improved.
S3, respectively extracting the features of the sub-sequence data to obtain a plurality of feature vectors;
specifically, a preset feature set is adopted, multi-dimensional feature extraction is carried out on each sub-sequence data to obtain corresponding feature values, feature vectors are constructed and obtained on the basis of the feature values, each sub-sequence data corresponds to a plurality of feature vectors, and each sample in the sub-sequence data corresponds to the feature vectors one by one.
Further, as shown in fig. 3, the performing feature extraction on the plurality of sub-sequence data to obtain a plurality of feature vectors includes:
s31, extracting features of samples in the sub-sequence data according to a preset feature set to obtain feature values of the samples;
and S32, obtaining a feature vector corresponding to the sample based on each feature value of the sample.
Specifically, by selecting global measurement capable of capturing basic sequence features most as features, 30 features such as spectrum entropy, trend strength, seasonal strength, periodic strength, sequence correlation, skewness, kurtosis, a nonlinear autoregressive structure and Box-Cox transformation coefficients are preset in the method, wherein corresponding calculation methods are preset for each feature, feature extraction is performed on each sample in the sub-sequence data through the calculation method corresponding to each feature to obtain each feature value of the sample, feature vectors corresponding to the samples are constructed based on the feature values of each sample, and specifically, the feature vectors are obtained by sequentially arranging the feature values.
According to a preset feature set, feature extraction is carried out on each sub-sequence data, global measurement of basic features of the most expressive sequence can be obtained, and accuracy of subsequent prediction steps is improved.
Still further, the performing, according to a preset feature set, feature extraction on the sample in each of the sub-sequence data, to obtain each feature value of the sample includes:
decomposing the sample into a trend component, a periodic component and a remainder by a decomposition algorithm;
according to the trend intensity characteristics in the characteristic set, the following formula is adoptedCalculating the trend intensity characteristic of the sample according to the formula:
Figure BDA0003720249190000081
according to the seasonal intensity characteristics in the characteristic set, the seasonal intensity characteristics of the sample are calculated by adopting the following formula:
Figure BDA0003720249190000082
according to the first-order autocorrelation coefficient characteristics in the characteristic set, calculating the first-order autocorrelation coefficient characteristics of the sample by adopting the following formula: first order autocorrelation ═ Corr (R) t ,R t-1 )
Wherein R is t Represents the remainder, x t Representing the sample, S, in the sub-sequence data t Representing said periodic component, T t Representing the trend component, var () is a variance function, Corr () represents a correlation.
Decomposing the samples in each sub-sequence data into a Trend component T by an STL (Serial-Trend decoding procedure on Loess) time series decomposition algorithm t Periodic component S t And remainder R t I.e. x t =T t +S t +R t
Specifically, the trend intensity feature, the seasonal intensity feature, and the first-order autocorrelation coefficient feature in the feature set are specifically calculated, and feature values of the trend intensity feature, the seasonal intensity feature, and the first-order autocorrelation coefficient feature are respectively calculated according to the above calculation formulas, so that the subsequent feature vector can be conveniently constructed. Further, there is a spectral entropy feature, which is calculated by the following formula:
Figure BDA0003720249190000091
Figure BDA0003720249190000092
is an estimate of the time series spectrum.
Corresponding characteristics are calculated through the exemplified formula, so that more accurate characteristic values can be calculated, and the accuracy of subsequent prediction is improved.
S4, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
specifically, the feature vector corresponding to each sub-sequence data is input to the corresponding prediction model and processed, so as to obtain the prediction result corresponding to each sub-sequence data.
And S5, carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained through meta-learning model training.
Specifically, the final result is obtained by performing weighted summation on the prediction results of the feature vectors corresponding to the sub-sequence data, so that the prediction accuracy is further improved. The weight of each feature vector is the weight occupied by the corresponding sub-sequence data.
Further, as shown in fig. 4, the training of the meta-learning model to obtain the weight of each prediction result includes:
s51, determining a prediction error based on the prediction training result and the training data set;
s52, inputting the training vector into a meta-learning model for processing to obtain an output result, and performing Softmax transformation on the output result to obtain a processing result;
s53, obtaining a loss function based on the processing result and the prediction error;
and S54, performing gradient reduction on the loss function by adopting a gradient algorithm to minimize the loss function, and obtaining the weight.
Based on the predictive training result and the data set, determining a prediction error by:
Figure BDA0003720249190000093
Figure BDA0003720249190000101
the prediction training result obtained here is the result of the training vector corresponding to the training subsequence by the prediction model corresponding to each subsequence, that is, the result of the prediction training by the prediction model in the candidate model when the candidate model is determined.
Inputting the training vector corresponding to each training subsequence data into a meta learning model to obtain an output result p (f) ij ) Wherein f is ij Representing a training vector, i is 1,2,3, and m, j is 1,2,3,4, and then transforming the output result by softmax to obtain a processing result w (f) ij ) (ii) a Wherein the meta-learning model is XGboost model
Figure BDA0003720249190000102
Figure BDA0003720249190000103
Wherein f is ij Representing the training vector, K representing the number of trees, G representing all possible CART trees, G k (f ij ) Representing a training vector f ij Score at kth tree;
passing said prediction error by L from each of said training subsequence data ij Representing a prediction error, for the processing result w (f) ij ) And the prediction error L ij Carrying out weighted average to obtain a loss function
Figure BDA0003720249190000104
Figure BDA0003720249190000105
During training, gradient algorithm is adopted to carry out gradient descent on the loss function so as to minimize the loss function and obtain the weight
The specific gradient algorithm is
Figure BDA0003720249190000106
By minimizing a loss function
Figure BDA0003720249190000107
Final output weight w ij
The XGboost model trains the next tree to predict the difference between the XGboost model and the true distribution on the basis of training one tree. And (3) continuously training trees for making up the gap, and finally realizing true distribution simulation by using the combination of the trees.
The weight of each sub-sequence data is obtained through the meta-learning model, and the accuracy of the subsequent final result is improved.
In the time series prediction method of the embodiment, a time series data set is obtained to obtain a processing sample, and the time series data set is decomposed through discrete wavelet transform to obtain a plurality of sub-series data; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors, realizing the representation of the data, realizing the expression of the implicit features of the data through the feature vectors, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and multiplying each prediction result by the weight occupied by the corresponding sub-sequence data to obtain a final result, wherein the weight of each sub-sequence data is obtained through meta-learning model training, and the accuracy of prediction is improved by respectively processing the feature vectors corresponding to each sub-sequence data and then performing weighted summation.
The present embodiment further provides a time series prediction apparatus, as shown in fig. 5, which is a functional block diagram of the time series prediction apparatus of the present application.
The time-series prediction apparatus 100 may be installed in an electronic device. According to the implemented functions, the time series prediction apparatus 100 may include an acquisition module 101, a decomposition module 102, a feature extraction module 103, a prediction module 104, and a weighted output module 105. A module, which may also be referred to as a unit in this application, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
an obtaining module 101, configured to obtain a time series data set;
further, the time-series prediction apparatus 100 further includes: the system comprises a training set acquisition module, a training set decomposition module, a training set feature extraction module, a model training module, a scoring module and a selection module;
the training set acquisition module is used for acquiring a training data set;
the training set decomposition module is used for decomposing the training data set through discrete wavelet transform to obtain a plurality of training sub-sequence data;
the training set feature extraction module is used for respectively extracting features of the training sub-sequence data to obtain a plurality of training vectors;
a model training module for inputting the training vector into an alternative model for prediction to obtain a prediction training result, wherein the alternative model comprises ARIMA, SVR, LSTM, ETS, TBATS and
Figure BDA0003720249190000111
a model;
the scoring module is used for scoring by utilizing a preset judgment condition based on the training data set and the prediction training result;
and the selection module is used for taking the candidate model with the highest score corresponding to each training sub-sequence data as a prediction model of the training sub-sequence data.
Through the cooperation of the training set acquisition module, the training set decomposition module, the training set feature extraction module, the model training module, the scoring module and the selection module, the optimal prediction model is determined for each piece of sub-sequence data, and the accuracy in subsequent prediction is improved.
Still further, the scoring module comprises a corresponding scoring submodule;
the corresponding scoring submodule is used for scoring the alternative model according to the following formula:
Figure BDA0003720249190000121
wherein n represents the predicted length of the sequence, y represents the true value of the sequence, and h (x) i ) Representing the model prediction value and t representing the number of correct predictions.
And determining the judgment condition of the alternative model through the corresponding scoring submodule, realizing the quantification of data and facilitating the determination of the corresponding prediction model from the alternative models of each training subsequence data.
A decomposition module 102, configured to decompose the time series data set through discrete wavelet transform to obtain multiple sub-sequence data;
further, the decomposition module 102 includes a third-order decomposition sub-module;
and the third-order decomposition sub-module is used for decomposing the time sequence data set through third-order decomposition of discrete wavelet transformation, and taking low-frequency data obtained through decomposition of each order and high-frequency data obtained through third-order decomposition as the sub-sequence data.
And performing three-order decomposition on the time series data set through a three-order decomposition submodule to obtain a plurality of low-frequency data and a high-frequency data, and performing respective processing and subsequent prediction to improve the accuracy of prediction.
The feature extraction module 103 is configured to perform feature extraction on the plurality of sub-sequence data respectively to obtain a plurality of feature vectors;
further, the feature extraction module 103 includes a feature value calculation operator module and a vector construction sub-module;
the characteristic value operator module is used for extracting characteristics of samples in the sub-sequence data according to a preset characteristic set to obtain each characteristic value of the sample;
and the vector construction submodule is used for obtaining the characteristic vector corresponding to the sample based on each characteristic value of the sample.
Through the cooperation of the characteristic value calculating operator module and the vector construction submodule, the characteristic extraction is carried out on each sub-sequence data according to a preset characteristic set, the global measurement of the basic characteristic of the most expressive sequence can be obtained, and the accuracy of the subsequent prediction step is improved.
Still further, the eigenvalue operator module comprises a sample decomposition unit, a trend intensity calculation unit, a seasonal intensity calculation unit and a first-order autocorrelation coefficient calculation unit;
a sample decomposition unit for decomposing the sample into a trend component, a periodic component and a remainder by a decomposition algorithm;
the trend intensity calculating unit is used for calculating the trend intensity characteristic of the sample by adopting the following formula according to the trend intensity characteristic in the characteristic set:
Figure BDA0003720249190000131
a seasonal intensity calculation unit, configured to calculate, according to the seasonal intensity features in the feature set, the seasonal intensity features of the sample by using the following formula:
Figure BDA0003720249190000132
a first-order autocorrelation coefficient calculating unit, configured to calculate, according to the first-order autocorrelation coefficient features in the feature set, the first-order autocorrelation coefficient features of the sample by using the following formula:
First order autocorrelation=Corr(R t ,R t-1 )
wherein R is t Represents the remainder, x t Representing the sample, S, in the sub-sequence data t Representing the periodic component, T t Representing the trend component, var () is a variance function, Corr () represents a correlation.
Through the cooperation of the sample decomposition unit, the trend intensity calculation unit, the seasonal intensity calculation unit and the first-order autocorrelation coefficient calculation unit, the corresponding characteristics are calculated for the exemplified formulas, more accurate characteristic values can be calculated, and the accuracy of subsequent prediction is improved.
The prediction module 104 is configured to input each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
and a weighted output module 105, configured to multiply the weight occupied by each prediction result and the corresponding sub-sequence data, and sum the multiplication result to obtain a final result, where the weight of each prediction result is obtained through meta-learning model training.
Further, the weighted output module 105 includes an error calculation sub-module, a model processing sub-module, a loss function calculation sub-module, and a weight calculation sub-module;
an error calculation sub-module for determining a prediction error based on the prediction training result and a training data set;
the model processing submodule is used for inputting the training vector into a meta-learning model for processing to obtain an output result, and the output result is subjected to Softmax transformation to obtain a processing result;
a loss function calculation sub-module, configured to obtain a loss function based on the processing result and the prediction error;
and the weight calculation submodule is used for performing gradient reduction on the loss function by adopting a gradient algorithm so as to minimize the loss function and obtain the weight.
Through the cooperation of the error calculation submodule, the model processing submodule, the loss function calculation submodule and the weight calculation submodule, the weight of each sub-sequence data is obtained by using the meta-learning model, and the accuracy of the final result obtained subsequently is improved.
By adopting the device, the time series prediction device 100 obtains a processing sample by obtaining a time series data set through the matched use of the obtaining module 101, the decomposition module 102, the feature extraction module 103, the prediction module 104 and the weighting output module 105, and obtains a plurality of sub-series data by decomposing the time series data set through discrete wavelet transform; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors, realizing the representation of the data, realizing the expression of the implicit features of the data through the feature vectors, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and multiplying each prediction result by the weight occupied by the corresponding sub-sequence data to obtain a final result, wherein the weight of each sub-sequence data is obtained through meta-learning model training, and the accuracy of prediction is improved by respectively processing the feature vectors corresponding to each sub-sequence data and then performing weighted summation.
The embodiment of the application also provides computer equipment. Referring to fig. 6, fig. 6 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to instructions set or stored in advance, and the hardware thereof includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a time series prediction method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, such as computer readable instructions for executing the time series prediction method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
The present embodiment implements the steps of the time series prediction method according to the above embodiments when the processor executes the computer readable instructions stored in the memory, obtaining a processing sample by obtaining a time series data set, and obtaining a plurality of sub-sequence data by decomposing the time series data set through discrete wavelet transform; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors, realizing the representation of the data, realizing the expression of the implicit features of the data through the feature vectors, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and multiplying each prediction result by the weight occupied by the corresponding sub-sequence data to obtain a final result, wherein the weight of each sub-sequence data is obtained through meta-learning model training, and the accuracy of prediction is improved by respectively processing the feature vectors corresponding to each sub-sequence data and then performing weighted summation.
Embodiments of the present application also provide a computer-readable storage medium storing computer-readable instructions, which are executable by at least one processor, so as to cause the at least one processor to perform the steps of the time series prediction method as described above, obtain a processing sample by obtaining a time series data set, and obtain a plurality of sub-series data by decomposing the time series data set through discrete wavelet transform; respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors, realizing the representation of the data, realizing the expression of the implicit features of the data through the feature vectors, inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result; and multiplying each prediction result by the weight occupied by the corresponding sub-sequence data to obtain a final result, wherein the weight of each sub-sequence data is obtained through meta-learning model training, and the accuracy of prediction is improved by respectively processing the feature vectors corresponding to each sub-sequence data and then performing weighted summation.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
The time series prediction apparatus, the computer device, and the computer-readable storage medium according to the above embodiments of the present application have the same technical effects as the time series prediction method according to the above embodiments, and are not expanded herein.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A method for time series prediction, the method comprising:
acquiring a time series data set;
decomposing the time sequence data set through discrete wavelet transform to obtain a plurality of sub-sequence data;
respectively extracting the features of the plurality of sub-sequence data to obtain a plurality of feature vectors;
inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
and carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained by training a meta-learning model.
2. The method of time series prediction according to claim 1, wherein said decomposing the set of time series data by discrete wavelet transform comprises:
and decomposing the time series data set through third-order decomposition of discrete wavelet transform, and taking low-frequency data obtained by each-order decomposition and high-frequency data obtained by third-order decomposition as the sub-sequence data.
3. The method according to claim 1, wherein the extracting features from the plurality of pieces of sub-sequence data to obtain a plurality of feature vectors comprises:
according to a preset feature set, performing feature extraction on samples in the sub-sequence data to obtain feature values of the samples;
and obtaining a feature vector corresponding to the sample based on each feature value of the sample.
4. The method according to claim 3, wherein the performing feature extraction on the samples in each of the sub-sequence data according to a preset feature set to obtain feature values of the samples comprises:
decomposing the sample into a trend component, a periodic component and a remainder by a decomposition algorithm;
according to the trend intensity characteristics in the characteristic set, calculating the trend intensity characteristics of the sample by adopting the following formula:
Figure FDA0003720249180000011
according to the seasonal intensity characteristics in the characteristic set, the seasonal intensity characteristics of the sample are calculated by adopting the following formula:
Figure FDA0003720249180000012
according to the first-order autocorrelation coefficient characteristics in the characteristic set, calculating the first-order autocorrelation coefficient characteristics of the sample by adopting the following formula: first order autocorrelation ═ Corr (R) t ,R t-1 )
Wherein R is t Represents the remainder, x t Representing the sample, S, in the sub-sequence data t Representing said periodic component, T t Representing the trend component, var () is a variance function, Corr () represents a correlation.
5. The method of time series prediction according to claim 1, further comprising, before said acquiring a time series dataset:
acquiring a training data set;
decomposing the training data set through discrete wavelet transformation to obtain a plurality of training sub-sequence data;
respectively extracting features of the training sub-sequence data to obtain a plurality of training vectors;
inputting the training vector into an alternative model for prediction to obtain a prediction training result, wherein the alternative model comprises ARIMA, SVR, LSTM, ETS, TBATS and
Figure FDA0003720249180000022
a model;
based on the training data set and the prediction training result, scoring by using a preset judgment condition;
and using the candidate model with the highest score corresponding to each training sub-sequence data as a prediction model of the training sub-sequence data.
6. The method according to claim 5, wherein the scoring with the preset judgment condition comprises:
scoring the candidate models by:
Figure FDA0003720249180000021
wherein n represents the predicted length of the sequence, y represents the true value of the sequence, and h (x) i ) Representing the model prediction value and t representing the number of correct predictions.
7. The time-series prediction method according to claim 5 or 6, wherein the training of the weight of each prediction result by the meta-learning model comprises:
determining a prediction error based on the predicted training result and a training data set;
inputting the training vector into a meta-learning model for processing to obtain an output result, and performing Softmax transformation on the output result to obtain a processing result;
obtaining a loss function based on the processing result and the prediction error;
and performing gradient descent on the loss function by adopting a gradient algorithm to minimize the loss function to obtain the weight.
8. A time series prediction apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a time series data set;
the decomposition module is used for decomposing the time sequence data set through discrete wavelet transform to obtain a plurality of sub-sequence data;
the characteristic extraction module is used for respectively extracting the characteristics of the plurality of sub-sequence data to obtain a plurality of characteristic vectors;
the prediction module is used for inputting each feature vector into a corresponding prediction model for prediction to obtain a prediction result;
and the weighted output module is used for carrying out weighted summation on the prediction results to obtain a final result, wherein the weight of each prediction result is obtained by training a meta-learning model.
9. A computer device, characterized in that the computer device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores computer readable instructions which, when executed by the processor, implement the method of time series prediction of any of claims 1 to 7.
10. A computer-readable storage medium having computer-readable instructions stored thereon, which when executed by a processor implement the time series prediction method of any one of claims 1 to 7.
CN202210758221.XA 2022-06-29 2022-06-29 Time series prediction method, device, equipment and storage medium Pending CN115130584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210758221.XA CN115130584A (en) 2022-06-29 2022-06-29 Time series prediction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210758221.XA CN115130584A (en) 2022-06-29 2022-06-29 Time series prediction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115130584A true CN115130584A (en) 2022-09-30

Family

ID=83381670

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210758221.XA Pending CN115130584A (en) 2022-06-29 2022-06-29 Time series prediction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115130584A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117408364A (en) * 2023-08-08 2024-01-16 湖北泰跃卫星技术发展股份有限公司 Crop disease and pest index prediction method and device based on model fusion

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117408364A (en) * 2023-08-08 2024-01-16 湖北泰跃卫星技术发展股份有限公司 Crop disease and pest index prediction method and device based on model fusion

Similar Documents

Publication Publication Date Title
JP6815708B2 (en) Influenza prediction model generation method, equipment and computer readable storage medium
CN110909928B (en) Energy load short-term prediction method and device, computer equipment and storage medium
CN111950805B (en) Medium-and-long-term power load prediction method and device, computer equipment and storage medium
Su et al. Prediction model of permeability index for blast furnace based on the improved multi-layer extreme learning machine and wavelet transform
CN108830417B (en) ARMA (autoregressive moving average) and regression analysis based life energy consumption prediction method and system
Wang et al. Long time series deep forecasting with multiscale feature extraction and Seq2seq attention mechanism
WO2023159756A1 (en) Price data processing method and apparatus, electronic device, and storage medium
CN115130584A (en) Time series prediction method, device, equipment and storage medium
CN115099326A (en) Behavior prediction method, behavior prediction device, behavior prediction equipment and storage medium based on artificial intelligence
CN112381279B (en) Wind power prediction method based on VMD and BLS combined model
CN114219562A (en) Model training method, enterprise credit evaluation method and device, equipment and medium
CN116415990B (en) Cloud computing-based self-service data analysis method, system and storage medium
CN110222840B (en) Cluster resource prediction method and device based on attention mechanism
CN116703466A (en) System access quantity prediction method based on improved wolf algorithm and related equipment thereof
CN116244442A (en) Text classification method and device, storage medium and electronic equipment
CN115169747A (en) Method and device for predicting non-stationary time sequence of power load and related equipment
CN110298690B (en) Object class purpose period judging method, device, server and readable storage medium
CN114565196A (en) Multi-event trend prejudging method, device, equipment and medium based on government affair hotline
CN113010687A (en) Exercise label prediction method and device, storage medium and computer equipment
CN115630687B (en) Model training method, traffic flow prediction method and traffic flow prediction device
CN114066278B (en) Method, apparatus, medium, and program product for evaluating article recall
CN117473275B (en) Energy consumption detection method for data center
CN117272845B (en) Method, device and equipment for evaluating energy consumption level of air compression station
CN116596184A (en) Method and device for realizing economic forest carbon sink analysis based on deep learning
CN116842395A (en) Data matching method, device, equipment and storage medium based on artificial intelligence

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination