Runoff prediction method and device based on multi-step decomposition and long short-term memory network
Through multi-step decomposition and hyperparameter optimization methods, the problem of LSTM ignoring short-term features in runoff prediction is solved, the accuracy of runoff prediction and the learning ability of the model are improved, and the acceptability of the prediction error is ensured.
Patent Information
- Application Number
- CN202410754041.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-03
AI Technical Summary
Existing LSTM-based runoff prediction methods tend to ignore short-term features when processing complex runoff data, resulting in low accuracy of prediction results.
Using a multi-step decomposition method, the runoff data is initially decomposed using variational mode decomposition (VMD) to filter out noise, and then empirical mode decomposition (EMD) is used to perform a secondary decomposition of the main components to capture the nonlinear sum of the signal. Non-stationary characteristics, and combined with the Sparrow algorithm to optimize the hyperparameters of the long short-term memory network to improve the accuracy of the prediction model.
Through multi-step decomposition and hyper-parameter optimization, the accuracy of runoff prediction results is effectively improved, ensuring that the prediction error is within an acceptable range, and enhancing the learning and prediction capabilities of the model.
Smart Images

Figure HDA0004888930030000013 
Figure BDA0004888930020000071 
Figure HDA0004888930030000021
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of runoff prediction, and in particular to a runoff prediction method and device based on multi-step decomposition and long short-term memory network. Background Art
[0002] In the field of water resources management and ecological environment protection, accurate prediction of runoff changes is of great significance for rational planning of water resources utilization and flood prevention and disaster reduction. Therefore, runoff prediction methods based on machine learning have become one of the research hotspots.
[0003] The statistical model method is based on linear regression theory. When dealing with complex runoff information, the prediction accuracy still needs to be improved. Runoff prediction requires a more powerful model to handle nonlinear and complex runoff data. Deep learning networks such as recurrent neural networks (RNN) are used to predict runoff, but RNN will cause gradient explosion when processing too long time series.
[0004] In the related technology, an improved version of RNN, Long Short-Term Memory (LSTM), is proposed, which uses three gating units of LSTM to avoid gradient explosion.
[0005] However, during the research process, it was found that LSTM would ignore some important short-term features when memorizing long-term time series, and these short-term features may also have an impact on runoff, which will lead to the problem of low accuracy of runoff prediction results in related technologies. Summary of the invention
[0006] In order to help improve the accuracy of runoff prediction results, the present application provides a runoff prediction method and device based on multi-step decomposition and long short-term memory network.
[0007] In the first aspect, the present application provides a runoff prediction method based on multi-step decomposition and long short-term memory network, which adopts the following technical solutions: A runoff prediction method based on multi-step decomposition and long short-term memory network, the method comprising: The runoff data sequence is decomposed using the variational mode decomposition (VDM) algorithm to obtain the intermediate decomposition results. Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set, wherein the test data set includes more than two target components; Inputting the test data set into the runoff prediction model to obtain the predicted value of each target component; the runoff prediction model is obtained by training the long short-term memory network LSTM model; The predicted value of the runoff data series is determined based on the predicted values of each of the target components.
[0008] By adopting the above technical solution, a two-step decomposition method can be adopted. First, VMD is used for preliminary decomposition to effectively filter out some noise, extract the main components of the signal, and avoid the problem of modal aliasing. Then, EMD is used to further refine the decomposition of the extracted main components, which can more finely capture the nonlinear and non-stationary characteristics of the signal. This can help LSTM pay attention to some short-term features, which in turn can help improve the accuracy of runoff prediction results.
[0009] Optionally, the step of performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set further includes: Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a training data set and a test data set, wherein the training data set is different from the test data set; Before inputting the test data set into the runoff prediction model, the method further includes: The runoff prediction model is constructed based on the training data set.
[0010] By adopting the above technical solution and building a runoff prediction model based on the training data set, the runoff prediction model can better learn the characteristics of the data, so that in the actual runoff prediction process, the features in the test data set can be more accurately extracted and identified, which can help improve the accuracy of the prediction results of the runoff prediction model.
[0011] Optionally, constructing the runoff prediction model based on the training data set includes: Determine optimal hyperparameters based on the training data set using the Sparrow algorithm; Initializing the initial long short-term memory network LSTM model based on the optimal hyperparameter value to obtain the optimized model; The optimized model is trained using the training data set to obtain the runoff prediction model.
[0012] By adopting the above technical solution, the Sparrow algorithm can be used to determine the optimal hyperparameters according to the training data set, and the initial LSTM model can be initialized based on the optimal hyperparameters. This can help to accurately determine the initialization parameters of the model in combination with the training data, thereby helping to improve the accuracy of the prediction results of the trained runoff prediction model.
[0013] Optionally, the test data set includes a first sub-data set corresponding to a first time period and a second sub-data set corresponding to a second time period, and the second time period is located after the first time period; The step of training the optimized model using the training data set to obtain the runoff prediction model comprises: training the optimized model using the training data set to obtain a trained model; Inputting the first sub-dataset into the trained model to obtain a test runoff sequence; Determine the predicted value corresponding to the first data sub-data set based on the predicted value of each target component in the test runoff sequence; determine the relative error between the predicted value corresponding to the first sub-data set and the actual flow value corresponding to the second sub-data set; When the relative error exceeds a preset error range, the hyperparameters of the trained model are updated, and the trained model is re-determined as an optimized model, and the step of training the optimized model using the training data set is returned to be executed; When the relative error falls within the error range, the trained model is determined as a runoff prediction model.
[0014] By adopting the above technical scheme, the prediction accuracy of the trained model can be verified, and when it is determined that the relative error between the predicted value and the actual flow value exceeds the error range, the hyperparameters of the trained model can be updated. This can help ensure the model training effect, so that the prediction error of the runoff prediction model finally determined is within an acceptable range, which can help to further improve the accuracy of the runoff prediction results.
[0015] Optionally, the using the sparrow algorithm to determine the optimal hyperparameter according to the training data set includes: Initialize the algorithm parameters of the sparrow algorithm SSA according to the data in the training data set to obtain an initial sparrow population, wherein the algorithm parameters include population size, number of iterations, and search space range; Calculating the fitness value of each individual in the initial sparrow population using the data in the training data set; updating the positions of the discoverers, followers and scouts in the sparrow population according to the fitness value; When the fitness value tends to be stable or reaches a preset maximum number of iterations, the updated optimal hyperparameter value is obtained.
[0016] Optionally, the using of an empirical mode decomposition (EDM) algorithm to perform secondary decomposition on the intermediate decomposition result to obtain a test data set includes: Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a secondary decomposition result; The principal components of the secondary decomposition results are extracted using a kernel principal component analysis (KPCA) algorithm to obtain a test data set.
[0017] By adopting the above technical solution, the KPCA algorithm can be introduced to reduce the dimension of multiple IMFs in the secondary decomposition results, thereby achieving the purpose of reducing the amount of calculation and processing time.
[0018] Optionally, the secondary decomposition result is represented by a matrix vector, the matrix vector includes at least two intrinsic mode function IMF components, and each of the intrinsic mode function IMF components includes at least two sampling points; The kernel principal component analysis KPCA algorithm is used to extract the principal components of the secondary decomposition results to obtain a test data set, including: Standardize the secondary decomposition results; The secondary decomposition result is mapped to a nonlinear space using a Gaussian radial basis function to obtain a kernel matrix; Performing eigenvalue decomposition on the kernel matrix to obtain eigenvalues and eigenvectors corresponding to the eigenvalues; Calculate the variance contribution rate corresponding to each of the eigenvalues; Sorting the eigenvalues in descending order according to variance contribution rate, and determining the eigenvectors as main eigenvectors in sequence, until the cumulative contribution rate of the main eigenvectors is greater than a preset contribution rate threshold, and the number of the main eigenvectors is less than the number of the intrinsic mode function IMF components; The secondary decomposition result is mapped onto the main eigenvector to obtain a test data set.
[0019] By adopting the above technical solution, since the number of main eigenvectors finally determined is smaller than the number of IMF components, the dimension reduction of the secondary decomposition result can be achieved, thereby reducing the amount of calculation and processing time.
[0020] Optionally, the runoff data sequence is obtained by performing outlier processing on the original data sequence using the Lajda criterion.
[0021] By adopting the above technical solution, since the Lajda criterion uses the median and quartiles, it is less susceptible to the impact of extreme values than statistics such as the mean and variance. This can help to effectively exclude outliers in the original data sequence, thereby helping to avoid the impact of outliers on runoff prediction, and further help to improve the accuracy of runoff prediction results.
[0022] In a second aspect, the present application provides an electronic device, which adopts the following technical solution: An electronic device, comprising: at least one processor; Memory; At least one application, wherein at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute any one of the runoff prediction methods based on multi-step decomposition and long short-term memory networks provided in the first aspect.
[0023] In a third aspect, the present application provides an electronic device, which adopts the following technical solution: A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the runoff prediction methods based on multi-step decomposition and long short-term memory networks provided in the first aspect. In summary, the present application includes at least one of the following beneficial technical effects: 1. By adopting a two-step decomposition method, VMD is used for preliminary decomposition to effectively filter out some noise, extract the main components of the signal, and avoid the problem of modal aliasing. Then, EMD is used to further refine and decompose the extracted main components, which can capture the nonlinear and non-stationary characteristics of the signal more finely. This can help LSTM notice some short-term features, which in turn can help improve the accuracy of runoff prediction results.
[0024] 2. By verifying the prediction accuracy of the trained model and updating the hyperparameters of the trained model when it is determined that the relative error between the predicted value and the actual flow value exceeds the error range, this can help ensure the effectiveness of model training, so that the prediction error of the final runoff prediction model is within an acceptable range, which can help further improve the accuracy of runoff prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of a runoff prediction method based on multi-step decomposition and long short-term memory network provided in an embodiment of the present application; Figure 2 It is a schematic diagram of the structure of a runoff prediction model provided in an embodiment of the present application; Figure 3 It is a flowchart of a test data set generation method provided in an embodiment of the present application; Figure 4 It is a schematic diagram of a process of principal component analysis provided in an embodiment of the present application; Figure 5 It is a flow chart of another runoff prediction method based on multi-step decomposition and long short-term memory network provided in an embodiment of the present application; Figure 6 It is a flow chart of a method for constructing a runoff prediction model provided in an embodiment of the present application; Figure 7It is a flow chart of another method for constructing a runoff prediction model provided in an embodiment of the present application; Figure 8 It is a flowchart of an optimal hyperparameter determination method provided in an embodiment of the present application; Fig. 9 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-9 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0027] First, several terms involved in the embodiments of the present application are introduced.
[0028] The variational mode decomposition (VDM) algorithm is a signal processing technology that can decompose a complex signal into a series of modal components, each of which has a specific center frequency.
[0029] Empirical Mode Decomposition (EMD) algorithm, EMD is a technology used in signal processing, which can decompose complex signals into several Intrinsic Mode Functions (IMFs). IMFs are adaptively extracted based on the local characteristics of the data itself.
[0030] The present application embodiment discloses a runoff prediction method based on multi-step decomposition and long short-term memory network. Figure 1 , the runoff prediction method includes the following steps: Step 101, using a variational mode decomposition (VDM) algorithm to decompose the runoff data sequence to obtain an intermediate decomposition result.
[0031] The runoff data sequence includes river flow data recorded by time. In one example, the runoff data sequence is river flow data recorded by day.
[0032] The intermediate decomposition results include the modal components obtained by VDM decomposition of the runoff data series.
[0033] In one example, a runoff data sequence is decomposed using a VDM algorithm, including: decomposing the runoff sequence data into a series of modal components and finding a one-sided spectrum; converting the one-sided spectrum into a fundamental frequency and constructing a corresponding constrained variational problem by estimating the bandwidth; converting the constrained variational problem into an unconstrained variational problem, and finally obtaining the modal components and the corresponding center frequencies.
[0034] In one example, the intermediate result is calculated by: Among them, the loss function is the optimization objective of the model, including the modal component u k and the corresponding center frequency w k ; λ is the Lagrange multiplier used to introduce constraints; scalar is the weight coefficient used to balance the different terms in the formula; the offset δ (t) and the time derivative operator Used to indicate time Error terms and derivatives on ; imaginary units satisfy u k(t) It is variables in time Components on; complex exponential terms represents the transformation in time frequency, It's time The frequency of It's time The signal on represents the Lagrange multiplier With signal In time The product on is used to constrain the signal.
[0035] In one example, the runoff data sequence is obtained by processing the original data sequence for outliers using the Lajda criterion. Specifically, it is first assumed that the original data sequence contains only random errors, and the original data sequence is calculated to obtain the standard deviation. A preset interval is determined according to a certain probability, and the errors exceeding the preset interval are determined as gross errors, and the data containing gross errors are eliminated.
[0036] Since runoff data generally contain some extreme values, such as extreme runoff caused by sudden heavy rain, the Lajda criterion uses the median and quartiles, which are less susceptible to the impact of extreme values than statistics such as the mean and variance. This can help to effectively exclude outliers in the original data sequence, thereby helping to avoid the impact of outliers on runoff prediction, and thus help to improve the accuracy of runoff prediction results.
[0037] In one example, outliers in the raw data are determined by: |X j -μ|≥3σ Among them, μ is the mean of the original data sequence, σ is the standard deviation of the original data sequence, and X that satisfies the above formula j It is considered as an outlier.
[0038] Step 102: perform secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set, where the test data set includes more than two target components.
[0039] The test data is generated based on the intrinsic mode function IMF obtained by the secondary decomposition. In one example, the target component in the test data set is the IMF. In actual implementation, the test data set can also be obtained by further analyzing and processing the IMF, for example: the test data is obtained by reducing the dimension of the IMF.
[0040] Since there may be some potential features in the runoff data after being decomposed by the VDM algorithm, and it was found during the research process that the EDM algorithm can well mine the potential features of the residual sequence, the EDM algorithm is used in this embodiment to perform secondary decomposition on the modal component data (i.e., the intermediate decomposition result) after decomposition by the VDM algorithm, so that the potential features of the runoff data can be fully mined.
[0041] The data in the test dataset can be expressed as follows: Where x(t) is the data in the test data set, IMF(t) is the modal function component; r n (t) is the residual term.
[0042] Step 103: input the test data set into the runoff prediction model to obtain the predicted value of each target component.
[0043] Among them, the runoff prediction model is obtained by training the long short-term memory network LSTM model.
[0044] Optionally, the test data set is input into the runoff prediction model to obtain the predicted values of each target component, including: input gate (i t ) inputs new information into the memory cell, and the forget gate (f t ) determines whether to delete or reset the information in the memory cell, and the output gate (o t ) controls the output of information. Through the collaborative work of these gates, the runoff prediction model can effectively manage and update the information in memory cells.
[0045] In one example, reference Figure 2 , the three types of gate structures of the runoff prediction model and the specific functions and output calculation methods of cell state update are as follows: Input Gate i t :According to the input data, input gate i t The judgment data is used to update the memory status. The specific formula is as follows: i t =δ(w i [h t-1 ,x t ]+b i ) Among them, w i is the input gate i t The weight matrix of i is the input gate i t The bias vector of .
[0046] Forget Gate t :According to the input data, the forget gate f t Based on the activation function, the information required to determine the cell state is as follows: f t =δ(w f [h t-1 ,x t ]+b f ) Among them, w f is the forget gate f t The weight matrix and b f is the forget gate f t The bias vector of ; δ is the sigmoid activation function; h t-1 is the hidden state of the previous time step; x t is the input for the current time step.
[0047] Cell state update: determines how the cell state of the current time step is updated and how to combine the cell state of the previous time step with the input of the current time step.
[0048] The cell state logic unit consists of an input gate i t Decision Update: Output gate o t :According to the input data and the information stored in the current memory unit, the output information is determined. The specific formula is as follows: o t =δ(w o [h t-1 ,x t ]+b o ) Output informationt By output gate o t Decision Update: h t =o t *tanh(c t ) Among them, t is the output gate o t The output signal of o is the output gate o t The weight matrix of o is the output gate o t The bias vector of ; tanh represents the hyperbolic tangent activation function.
[0049] Step 104, determining the predicted value of the runoff data series based on the predicted values of each target component.
[0050] In one example, determining a predicted value of the runoff data sequence based on the predicted values of the respective target components includes: determining the sum of the predicted values of the respective target components as the predicted value of the runoff data sequence.
[0051] The implementation principle of a runoff prediction method based on multi-step decomposition and long short-term memory network in the embodiment of the present application is: use variational mode decomposition VDM algorithm to decompose the runoff data sequence to obtain an intermediate decomposition result; use empirical mode decomposition EDM algorithm to perform secondary decomposition on the intermediate decomposition result to obtain a test data set, the test data set includes more than two target components; input the test data set into the runoff prediction model to obtain the predicted value of each target component; the runoff prediction model is obtained by training the long short-term memory network LSTM model; the predicted value of the runoff data sequence is determined based on the predicted value of each target component. In the above technical scheme, by adopting a two-step decomposition method, VMD is first used for preliminary decomposition to effectively filter out some noise, extract the main components of the signal, and avoid the problem of modal aliasing, and then EMD is used to further refine the decomposition of the extracted main components, which can more finely capture the nonlinear and non-stationary characteristics of the signal, so that LSTM can pay attention to some short-term features, and thus can help improve the accuracy of the runoff prediction results.
[0052] In some embodiments, reference Figure 3 The above step 102, using the empirical mode decomposition (EDM) algorithm to perform secondary decomposition on the intermediate decomposition result to obtain a test data set, includes the following steps: Step 201 : perform secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a secondary decomposition result.
[0053] Among them, the result of the secondary decomposition is the IMF.
[0054] Step 202: Use the Kernel Principal Component Analysis (KPCA) algorithm to extract the principal components of the secondary decomposition result to obtain a test data set.
[0055] In this embodiment, the number of target components is less than the number of IMFs in the secondary decomposition result. For example, the secondary decomposition result includes 16 IMFs and the number of target components is 3, which can greatly reduce the dimension of the data input into the runoff prediction model, thereby helping to reduce the complexity of the model.
[0056] Since the two-step decomposition process will lead to an increase in data volume and data dimension, thereby affecting the computational complexity and computational time, in this implementation, the KPCA algorithm is introduced to reduce the dimensionality of multiple IMFs in the secondary decomposition results, thereby achieving the purpose of reducing the amount of computation and processing time.
[0057] Further, the secondary decomposition result is represented by a matrix vector, the matrix vector includes two IMF components, and each IMF component includes at least two sampling points. In an example, the secondary decomposition result includes n IMF components, each component includes m sampling points, and the secondary decomposition result X can be expressed as: Accordingly, reference Figure 4 , step 202, using the kernel principal component analysis KPCA algorithm to extract the principal components of the secondary decomposition result, to obtain a test data set, including: Step 301, standardize the secondary decomposition result.
[0058] In one example, the method of normalizing the data in the matrix vector is expressed as follows: in, is the data after standardization; x ij is the data of the matrix vector; The average value of the data in the matrix vector; s(x ij ) is the standard deviation of the data in the matrix vector.
[0059] Step 302: Use Gaussian radial basis function to map the secondary decomposition result to a nonlinear space to obtain a kernel matrix.
[0060] In one example, the kernel matrix is represented by the following formula: Where σ represents the range of the control function, and the kernel matrix K is calculated by the Gaussian kernel function.
[0061] Specifically, the Gaussian kernel function is calculated as follows: Step 303: perform eigenvalue decomposition on the kernel matrix to obtain eigenvalues and eigenvectors corresponding to the eigenvalues.
[0062] Among them, the eigenvalue represents the variance in the high-dimensional space, and the corresponding eigenvector machine represents the direction corresponding to the variance.
[0063] Step 304: Calculate the variance contribution rate corresponding to each eigenvalue.
[0064] In one example, the variance contribution rate corresponding to the eigenvalue is calculated by the following formula: Among them, α p is the variance contribution rate corresponding to the eigenvalue; p is the characteristic value; is the sum of the eigenvalues of all eigenvectors.
[0065] Step 305 , sorting the eigenvalues in descending order of variance contribution rate, and determining the eigenvectors as main eigenvectors in sequence, until the cumulative contribution rate of the main eigenvector is greater than a preset contribution rate threshold.
[0066] Among them, the number of principal eigenvectors is smaller than the number of intrinsic mode function IMF components.
[0067] In one example, the cumulative variance contribution is calculated as follows: Among them, L p is the cumulative variance contribution rate corresponding to the eigenvalue; is the sum of the eigenvalues of the principal eigenvectors; is the sum of the eigenvalues of all eigenvectors.
[0068] Step 306, mapping the secondary decomposition result to the main eigenvector to obtain a test data set.
[0069] In the above implementation, since the secondary decomposition result can be mapped to the nonlinear space through the Gaussian radial basis function to obtain the kernel matrix, and the main eigenvector whose cumulative contribution rate is greater than the contribution rate threshold is determined from the eigenvectors obtained by decomposing the kernel matrix, and since the number of main eigenvectors is smaller than the number of IMF components, the dimensionality reduction of the secondary decomposition result can be achieved, thereby reducing the amount of calculation and processing time.
[0070] In some embodiments, reference Figure 5 In step 102, the intermediate decomposition result is secondary decomposed using the empirical mode decomposition (EDM) algorithm to obtain a test data set, including the following steps: Step 401: Use an empirical mode decomposition (EDM) algorithm to perform secondary decomposition on the intermediate decomposition result to obtain a training data set and a test data set.
[0071] Among them, the training data set is different from the test data set.
[0072] Optionally, the training data set and the test data set are divided by time. For example, the time of the training data set is earlier than the time of the test data set.
[0073] In one example, the training data set and the test data set are obtained based on IMF partitioning obtained by quadratic decomposition.
[0074] In another example, the secondary decomposition results need to be processed after the secondary decomposition, for example, obtained through the above steps 201 and 202. At this time, the training data set and the test data set are obtained by dividing the data after the secondary decomposition results are processed, for example, by dividing the data after the principal component extraction is performed on the secondary decomposition results.
[0075] Accordingly, step 103, before inputting the test data set into the runoff prediction model to obtain the predicted values of each target component, also includes: Step 402: construct a runoff prediction model based on the training data set.
[0076] In one example, building a runoff prediction model based on a training data set includes: training an initial long short-term memory network based on the training data set to obtain a runoff prediction model.
[0077] In the above implementation, since both the training data set and the test data are obtained after secondary decomposition, constructing a runoff prediction model based on the training data set can enable the runoff prediction model to better learn the characteristics of the data, so that in the actual runoff prediction process, the features in the test data set can be more accurately extracted and identified, which can help improve the accuracy of the prediction results of the runoff prediction model.
[0078] For further reference, Figure 6 The above step 402, constructing a runoff prediction model based on the training data set, includes: Step 501, using the Sparrow algorithm to determine the optimal hyperparameters according to the training data set.
[0079] Step 502, initializing the initial long short-term memory network LSTM model based on the optimal hyperparameter value to obtain an optimized model.
[0080] Step 503: Use the training data set to train the optimized model to obtain a runoff prediction model.
[0081] In the above technical solution, since the Sparrow algorithm can be used to determine the optimal hyperparameters according to the training data set, and the initial LSTM model is initialized based on the optimal hyperparameters, this can help to accurately determine the initialization parameters of the model in combination with the training data, thereby helping to improve the accuracy of the prediction results of the trained runoff prediction model.
[0082] Furthermore, the test data set includes a first sub-data set corresponding to a first time period and a second sub-data set corresponding to a second time period, and the second time period is located after the first time period.
[0083] Accordingly, reference Figure 7 In the above step 503, the optimized model is trained using the training data set to obtain a runoff prediction model, including: The method of using the training data set to train the optimized model to obtain the runoff prediction model includes: step 601, using the training data set to train the optimized model to obtain the trained model.
[0084] Step 602: Input the first sub-dataset into the trained model to obtain a test runoff sequence.
[0085] Step 603: Determine the predicted value corresponding to the first data subset based on the predicted value of each target component in the test runoff sequence.
[0086] In this implementation, the predicted value corresponding to the first sub-data set is the traffic prediction value corresponding to the second time period, and the actual traffic value corresponding to the second time period is the actual traffic value corresponding to the second sub-data set. Therefore, the prediction accuracy corresponding to the trained model can be verified by the actual traffic value corresponding to the second sub-data set.
[0087] Step 604: determine the relative error between the predicted value corresponding to the first sub-data set and the actual flow value corresponding to the second sub-data set.
[0088] In one example, the relative error is the difference between the predicted value corresponding to the first sub-dataset and the actual flow value corresponding to the second sub-dataset.
[0089] Step 605, when the relative error exceeds the preset error range, the hyperparameters of the trained model are updated, and the trained model is re-determined as the optimized model, and the step of training the optimized model using the training data set to obtain the trained model is returned, that is, the step of returning to execute step 601.
[0090] When the relative error exceeds the error range, it means that the trained model cannot meet the accuracy requirements of runoff prediction. At this time, the hyperparameters of the trained model need to be adjusted and further trained to make it meet the accuracy requirements of runoff prediction.
[0091] In one example, the hyperparameters of the trained model are updated by reusing the Sparrow algorithm to determine the optimal hyperparameters.
[0092] In actual implementation, other methods can also be used to update the hyperparameters, for example, updating the hyperparameters based on the actual situation of the relative error.
[0093] Step 606: When the relative error falls within the error range, the trained model is determined as the runoff prediction model.
[0094] When the relative error is within the error range, it means that the trained model can meet the accuracy requirements of runoff prediction. At this time, it means that the runoff prediction model has been trained and the trained model can be determined as the runoff prediction model.
[0095] In the above implementation, after the model training is completed, the trained model will be used to predict the runoff of the data in the training data that comes before in time to obtain a predicted value, and based on the actual flow value indicated by the data in the training data that comes after in time, and when it is determined that the relative error between the predicted value and the actual flow value exceeds the error range, the hyperparameters of the trained model will be updated. This can help ensure the effect of model training, so that the prediction error of the runoff prediction model finally determined is within an acceptable range, which can help to further improve the accuracy of the runoff prediction results.
[0096] In some embodiments, reference Figure 8 In step 501, the optimal hyperparameters are determined according to the training data set using the sparrow algorithm, which specifically includes the following steps: Step 701, initializing algorithm parameters of the sparrow algorithm SSA according to the data in the training data set to obtain an initial sparrow population.
[0097] Among them, the algorithm parameters include population size, number of iterations, and search space range.
[0098] Step 702, using the data in the training data set to calculate the fitness value of each individual in the initial sparrow population.
[0099] Step 703, updating the positions of the discoverers, followers and scouts in the sparrow population according to the fitness values to find a better parameter combination.
[0100] Step 704, when the fitness value tends to be stable or reaches the preset maximum number of iterations, the updated optimal hyperparameter value is obtained.
[0101] Among them, the fitness is calculated using the adaptive function.
[0102] In one example, the fitness function selects the mean absolute percentage error function, which is specifically expressed by the following formula: Among them, F i is fitness; y i is the actual value; is the analog value.
[0103] In actual implementation, the fitness function can also use other error functions, such as the root mean square error function.
[0104] In the above implementation, since the sparrow population can be initialized according to the data in the training data set, and the positions of the discoverers, followers and scouts in the sparrow population are iteratively updated based on the data in the training data set, until the fitness value tends to be stable or reaches the preset maximum number of iterations, the updated optimal super parameter is obtained, which can help improve the speed and accuracy of parameter optimization.
[0105] The present application also provides an electronic device. Fig. 9 As shown, Fig. 9 The electronic device 800 shown includes: a processor 801 and a memory 803. The processor 801 and the memory 803 are connected, such as through a bus 802. Optionally, the electronic device 800 may also include a transceiver 804. It should be noted that in actual applications, the transceiver 804 is not limited to one, and the structure of the electronic device 800 does not constitute a limitation on the embodiments of the present application.
[0106] The processor 801 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 801 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0107] The bus 802 may include a path to transmit information between the above components. The bus 802 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 802 may be divided into an address bus, a data bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0108] The memory 803 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0109] The memory 803 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 801. The processor 801 is used to execute the application code stored in the memory 803 to implement the content shown in the above method embodiment.
[0110] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server terminal, etc. Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0111] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the runoff prediction method based on multi-step decomposition and long short-term memory network provided in the above embodiment.
[0112] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise clearly stated in this document, the execution of these steps is not strictly limited in order and can be performed in other orders.
[0113] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A runoff prediction method based on multi-step decomposition and long short-term memory network, characterized in that: The method comprises: The runoff data sequence is decomposed using the variational mode decomposition (VDM) algorithm to obtain the intermediate decomposition results. Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set, wherein the test data set includes more than two target components; Inputting the test data set into the runoff prediction model to obtain the predicted value of each target component; the runoff prediction model is obtained by training the long short-term memory network LSTM model; The predicted value of the runoff data series is determined based on the predicted values of each of the target components.
2. The method according to claim 1, characterized in that: The method further comprises: performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set; Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a training data set and a test data set, wherein the training data set is different from the test data set; Before inputting the test data set into the runoff prediction model, the method further includes: The runoff prediction model is constructed based on the training data set.
3. The method according to claim 2, characterized in that The step of constructing the runoff prediction model based on the training data set includes: Determine optimal hyperparameters based on the training data set using the Sparrow algorithm; Initializing the initial long short-term memory network LSTM model based on the optimal hyperparameter value to obtain the optimized model; The optimized model is trained using the training data set to obtain the runoff prediction model.
4. The method according to claim 3, characterized in that The test data set includes a first sub-data set corresponding to a first time period and a second sub-data set corresponding to a second time period, wherein the second time period is after the first time period; The step of training the optimized model using the training data set to obtain the runoff prediction model includes: Using the training data set to train the optimized model to obtain a trained model; Inputting the first sub-dataset into the trained model to obtain a test runoff sequence; Determining the predicted value corresponding to the first data sub-data set based on the predicted value of each target component in the test runoff sequence; Determine a relative error between a predicted value corresponding to the first sub-dataset and an actual flow value corresponding to the second sub-dataset; When the relative error exceeds a preset error range, the hyperparameters of the trained model are updated, and the trained model is re-determined as an optimized model, and the step of training the optimized model using the training data set is returned to be executed; When the relative error falls within the error range, the trained model is determined as a runoff prediction model.
5. The method according to claim 3, characterized in that: The method of using the sparrow algorithm to determine the optimal hyperparameter according to the training data set includes: Initialize the algorithm parameters of the sparrow algorithm SSA according to the data in the training data set to obtain an initial sparrow population, wherein the algorithm parameters include population size, number of iterations, and search space range; Calculating the fitness value of each individual in the initial sparrow population using the data in the training data set; updating the positions of the discoverers, followers and scouts in the sparrow population according to the fitness value; When the fitness value tends to be stable or reaches a preset maximum number of iterations, the updated optimal hyperparameter value is obtained.
6. The method according to claim 1, characterized in that The method of performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a test data set includes: Performing secondary decomposition on the intermediate decomposition result using an empirical mode decomposition (EDM) algorithm to obtain a secondary decomposition result; The principal components of the secondary decomposition results are extracted using a kernel principal component analysis (KPCA) algorithm to obtain a test data set.
7. The method according to claim 6, characterized in that The secondary decomposition result is represented by a matrix vector, the matrix vector includes at least two intrinsic mode function IMF components, and each of the intrinsic mode function IMF components includes at least two sampling points; The kernel principal component analysis KPCA algorithm is used to extract the principal components of the secondary decomposition results to obtain a test data set, including: Standardize the secondary decomposition results; The secondary decomposition result is mapped to a nonlinear space using a Gaussian radial basis function to obtain a kernel matrix; Performing eigenvalue decomposition on the kernel matrix to obtain eigenvalues and eigenvectors corresponding to the eigenvalues; Calculate the variance contribution rate corresponding to each of the eigenvalues; Sorting the eigenvalues in descending order according to variance contribution rate, and determining the eigenvectors as main eigenvectors in sequence, until the cumulative contribution rate of the main eigenvectors is greater than a preset contribution rate threshold, and the number of the main eigenvectors is less than the number of the intrinsic mode function IMF components; The secondary decomposition result is mapped onto the main eigenvector to obtain a test data set.
8. The method according to claim 1, characterized in that The runoff data sequence is obtained by processing the original data sequence for outliers using the Lajda criterion.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; Memory; At least one application, wherein at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the runoff prediction method based on multi-step decomposition and long short-term memory network as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the runoff prediction method based on multi-step decomposition and long short-term memory network as described in any one of claims 1 to 8.
