Multi-step runoff prediction method and device based on hydrological model and LSTM
By combining the hydrological model and the LSTM model and adopting a closed-loop optimization strategy, the problem that traditional hydrological models are difficult to achieve long-term runoff prediction is solved, and the accuracy and stability of prediction are improved.
Patent Information
- Application Number
- CN202411865236.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-29
AI Technical Summary
Traditional runoff prediction methods are based on hydrological models, and it is difficult to achieve long-term multi-step runoff prediction because the parameters of hydrological models are difficult to obtain and are uncertain.
Using a multi-step runoff prediction method based on hydrological model and LSTM, a prediction system combining hydrological model and LSTM model is constructed, and the hydrological model parameters are corrected using the output feedback of the LSTM model to achieve closed-loop optimization.
It improves the accuracy of the hydrological model, reduces the difficulty of parameter rate determination, and realizes long-term (such as one month or even six months) flow prediction, ensuring the accuracy of multi-step runoff prediction.
Smart Images

Figure CN119903725A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of runoff prediction, and in particular to a multi-step runoff prediction method and device based on a hydrological model and LSTM. Background Art
[0002] Runoff prediction is also called flow prediction, which affects the comprehensive benefits of water conservancy projects such as flood control, power generation, and water supply.
[0003] Traditional runoff prediction methods are usually based on hydrological models. However, hydrological models often require a lot of data, and it is difficult to obtain model parameters. The parameters of hydrological models themselves also have problems such as uncertainty and spatial heterogeneity. As a result, when using hydrological models for runoff prediction, only short-term predictions can be achieved, but long-term runoff predictions (that is, multi-step runoff predictions) cannot be achieved. Summary of the invention
[0004] The present disclosure provides a multi-step runoff prediction method, device, equipment and storage medium based on a hydrological model and LSTM, which can achieve long-term and accurate runoff prediction. The technical solution at least includes the following solutions: In a first aspect, a multi-step runoff prediction method based on a hydrological model and LSTM is provided, comprising: constructing a first hydrological model based on historical data of a first watershed, wherein the first hydrological model is used to simulate the first watershed; based on the output of the first hydrological model, using an LSTM model to predict the flow of the first watershed to obtain a first predicted flow; based on the difference between the first predicted flow and the output of the first hydrological model, correcting the parameters of the first hydrological model; based on the output of the corrected first hydrological model, using the LSTM model to predict the flow of the first watershed to obtain a second predicted flow.
[0005] Optionally, the modifying the parameters of the first hydrological model based on the difference between the first predicted flow and the output of the first hydrological model includes: when the difference between the first predicted flow and the output of the first hydrological model is greater than a first error threshold, adjusting the parameters of the first hydrological model using the following formula:
[0006] in, are the parameters of the first hydrological model after adjustment, is the adjustment factor, is the difference between the first predicted flow and the first hydrological model output, The parameters of the first hydrological model are adjusted before.
[0007] Optionally, the method further includes: when the difference between the first predicted flow and the actual flow is greater than a second error threshold, correcting the hyperparameters of the LSTM model using the following formula:
[0008] in, is the modified hyperparameter of the LSTM model, is the learning rate, is the loss function, is the gradient of the loss function with respect to the hyperparameters of the LSTM model described above.
[0009] Optionally, during the LSTM model training process, the Pearson correlation coefficient between each input feature at the t-th time step and the flow value at the t-th time step is calculated, and the input features whose Pearson correlation coefficient is greater than the correlation threshold are used to train the LSTM model.
[0010] Optionally, based on the output of the first hydrological model, an LSTM model is used to predict the flow of the first watershed to obtain a first predicted flow, including: normalizing the output of the first hydrological model and inputting the resultant into the LSTM model; calculating the attention weight of each input feature of the LSTM model at the tth time step; and based on the attention weight of each input feature of the tth time step, performing weighted summation on the input features of the tth time step to obtain fused input features of the tth time step.
[0011] Optionally, the attention weight of the i-th input feature at the t-th time step is calculated using the following formula:
[0012] in, is the i-th input feature at the t-th time step The attention weight, i is an integer, the value range of i is 1 to n, n is the number of input features of the LSTM model at the tth time step, is the hidden state of the LSTM model at the t-1th time step, Indicates that and to combine.
[0013] In the second aspect, a multi-step runoff prediction device based on a hydrological model and LSTM is also provided, including: a modeling module, used to construct a first hydrological model based on historical data of a first river basin, and the first hydrological model is used to simulate the first river basin; a first prediction module, used to use an LSTM model to predict the flow of the first river basin based on the output of the first hydrological model, and obtain a first predicted flow; a correction module, used to correct the parameters of the first hydrological model based on the difference between the first predicted flow and the output of the first hydrological model; a second prediction module, used to use the LSTM model to predict the flow of the first river basin based on the output of the corrected first hydrological model, and obtain a second predicted flow.
[0014] Optionally, the correction module is further configured to adjust the parameters of the first hydrological model using the following formula when the difference between the first predicted flow and the output of the first hydrological model is greater than a first error threshold:
[0015] in, are the parameters of the first hydrological model after adjustment, is the adjustment factor, is the difference between the first predicted flow and the first hydrological model output, The parameters of the first hydrological model are adjusted before.
[0016] Optionally, the correction module is further used to correct the hyperparameters of the LSTM model using the following formula when the difference between the first predicted flow and the actual flow is greater than a second error threshold:
[0017] in, is the modified hyperparameter of the LSTM model, is the learning rate, is the loss function, is the gradient of the loss function with respect to the hyperparameters of the LSTM model described above.
[0018] Optionally, the first prediction module is also used to predict the flow of the first watershed based on the output of the first hydrological model using an LSTM model to obtain a first predicted flow, including: normalizing the output of the first hydrological model and inputting it into the LSTM model; calculating the attention weight of each input feature of the LSTM model at the tth time step; and based on the attention weight of each input feature of the tth time step, performing weighted summation on the input features of the tth time step to obtain the fused input features of the tth time step.
[0019] Optionally, the first prediction module is further used to calculate the attention weight of the i-th input feature at the t-th time step using the following formula:
[0020] in, is the i-th input feature at the t-th time step The attention weight, i is an integer, the value range of i is 1 to n, n is the number of input features of the LSTM model at the tth time step, is the hidden state of the LSTM model at the t-1th time step, Indicates that and to combine.
[0021] In a third aspect, a computer device is also provided, comprising: a memory and a processor, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor, thereby executing the multi-step runoff prediction method based on the hydrological model and LSTM described in the above embodiment.
[0022] In a fourth aspect, a computer-readable storage medium is also provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to execute the multi-step runoff prediction method based on the hydrological model and LSTM described in the above embodiment.
[0023] In a fifth aspect, a computer program product is provided, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the method described in the first aspect is implemented.
[0024] The beneficial effects brought by the technical solution provided by the embodiments of the present disclosure include at least: In the disclosed embodiment, a closed-loop optimization strategy is adopted, that is, the first predicted flow output by the LSTM model is fed back to the first hydrological model. If there is a large difference between the first predicted flow output by the LSTM model and the output of the first hydrological model, the parameters of the first hydrological model will be corrected to make the first hydrological model more accurate in the next simulation. By using the output of the LSTM model to perform closed-loop optimization on the parameters of the first hydrological model, the accuracy of the hydrological model is effectively improved, and the difficulty of calibrating the parameters of the hydrological model is reduced, so that a good degree of accuracy can be guaranteed in long-term (for example, one month or even six months) flow prediction, thereby realizing multi-step flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 A flowchart of a multi-step runoff prediction method based on a hydrological model and LSTM provided by an exemplary embodiment of the present disclosure is shown; Figure 2 A flowchart of a multi-step runoff prediction method based on a hydrological model and LSTM provided by another exemplary embodiment of the present disclosure is shown; Figure 3 This is a schematic diagram of the training process of the first hydrological model and the LSTM model; Figure 4 A schematic diagram of the structure of a multi-step runoff prediction device based on a hydrological model and LSTM provided by an exemplary embodiment of the present disclosure is shown; Figure 5 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] Unless otherwise defined, the technical or scientific terms used herein shall have the usual meanings understood by persons of ordinary skill in the field to which the present disclosure belongs. The words "first", "second", "third" and similar words used in the patent application specification and claims of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one" or "one" do not indicate a quantitative limitation, but rather indicate the presence of at least one. Words such as "include" or "comprise" and similar words mean that the elements or objects appearing before "include" or "comprises" cover the elements or objects listed after "include" or "comprises" and their equivalents, and do not exclude other elements or objects.
[0028] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0029] Figure 1 A flowchart of a multi-step runoff prediction method based on a hydrological model and LSTM provided by an exemplary embodiment of the present disclosure is shown, and the method can be executed by a computer device. Figure 1 , the method comprising: In step 101, a first hydrological model is constructed based on historical data of a first watershed, and the first hydrological model is used to simulate the first watershed.
[0030] Here, the first hydrological model can be any hydrological model in the relevant technology, for example, it can be HEC-HMS (The Hydrologic Engineering Center's-Hydrologic Modelimng System), SWAT (Soil and Water Assessment Tool), HSPF (Hydrological Simulation Program Fortran), etc.
[0031] The following describes step 101 by taking the first hydrological model being HEC-HMS as an example.
[0032] Optionally, step 101 includes the following two steps: The first step is to obtain historical data of the first watershed.
[0033] The historical data of the first watershed include: historical meteorological data, historical flow data, digital elevation data, soil type data and hydrological parameters of the first watershed.
[0034] Historical meteorological data include precipitation, temperature, evaporation, etc.; flow data include daily flow, etc.; digital elevation data are used to construct a digital elevation model (DEM); the hydrological parameters of the first basin include curve number, unit flow function, etc.
[0035] Optionally, the collected historical data of the first watershed may be preprocessed, including data cleaning, removal of missing values and outliers, to ensure the integrity and quality of the historical data.
[0036] In the second step, the HEC-HMS hydrological model was constructed based on the historical data of the first basin.
[0037] Optionally, the second step includes: initializing the HEC-HMS model, setting the physical parameters of the first basin (such as topography, soil type, land use, etc.); then simulating the hydrological process of the first basin, outputting the flow prediction value of the first basin based on the meteorological data, flow data and hydrological parameters in the historical data, and generating multiple hydrological features related to flow prediction (groundwater data, soil water data, etc.). The parameters of the HEC-HMS model can also be calibrated through historical data to ensure that the flow simulation results of the HEC-HMS model are consistent with the actual flow data.
[0038] The traffic prediction values output by the HEC-HMS model are divided into mutually exclusive data sets of different proportions and standardized. The training set, validation set, and test set come from three different continuous mutually exclusive time periods (that is, the training set, validation set, and test set belong to different time periods).
[0039] The training set is used for training the LSTM (Long Short-Term Memory) model, the validation set is used to adjust the LSTM model hyperparameters, and the test set is used to evaluate the generalization performance of the LSTM model. The purpose of these three data sets is to ensure that the LSTM model has good generalization ability, that is, it can perform well on unseen data. It can effectively evaluate and optimize the LSTM model to ensure its robustness and effectiveness in different scenarios.
[0040] Optionally, the normalization process is represented by formula (1) and formula (2).
[0041] (1) (2) In formula (1) and formula (2), is the input data before standardization. The output data before standardization (the input data and output data are relative to the LSTM model, and are essentially the traffic prediction values output by the HEC-HMS model). is the input data after standardization. is the output data after standardization. is the mean of the input data before standardization, is the mean of the output data before standardization, is the standard deviation of the input data before normalization, is the standard deviation of the output data before normalization.
[0042] In step 102, based on the output of the first hydrological model, the LSTM model is used to predict the flow of the first watershed to obtain a first predicted flow.
[0043] The LSTM model can process time series data and learn complex nonlinear relationships in hydrological processes. When establishing an LSTM model, it is necessary to design a suitable network structure (such as the number of layers, the number of nodes, the activation function, etc.). The embodiments of this disclosure do not limit the network structure of the LSTM model.
[0044] The LSTM model is a type of time recursive neural network with a special structure that can store memory information: cell. The LSTM model uses forget gate, input gate, and output gate to control the change of cell state and the output of the current result.
[0045] The forget gate determines which information in the cell state needs to be discarded. The forget gate reads the output of the neuron at the t-1th time step. and the input at the tth time step , through the sigmoid function and Calculate and get the output matrix of the forget gate . The elements in are values between 0 and 1. and the cell state at the t-1th time step Multiplication determines the forgetting of certain information.
[0046] The input gate determines how the cell updates information. The input gate reads the output result of the neuron at the t-1th time step. and the input at the tth time step , the state information of the cell at the tth time step is obtained by calculation .
[0047] The output of the LSTM model is not only related to the input at the t-th time step, but also affected by the output at the t-1th time step. The output gate of the LSTM model reads the output result of the neuron at the t-1th time step. and the input at the tth time step , and the state information of the cell at the tth time step Perform joint calculation to get the output of the current neuron at the tth time step .
[0048] There are many methods for implementing the LSTM model in related technologies, so detailed description is omitted here.
[0049] In step 103, the parameters of the first hydrological model are modified based on the difference between the first predicted flow and the output of the first hydrological model.
[0050] In step 104, based on the output of the modified first hydrological model, the LSTM model is used to predict the flow of the first watershed to obtain a second predicted flow.
[0051] In the disclosed embodiment, a closed-loop optimization strategy is adopted, that is, the first predicted flow output by the LSTM model is fed back to the first hydrological model. If there is a large difference between the first predicted flow output by the LSTM model and the output of the first hydrological model, the parameters of the first hydrological model will be corrected to make the first hydrological model more accurate in the next simulation. By using the output of the LSTM model to perform closed-loop optimization on the parameters of the first hydrological model, the accuracy of the hydrological model is effectively improved, and the difficulty of calibrating the parameters of the hydrological model is reduced, so that a good degree of accuracy can be guaranteed in long-term (for example, one month or even six months) flow prediction, thereby realizing multi-step flow prediction.
[0052] Figure 2 A flowchart of a multi-step runoff prediction method based on a hydrological model and LSTM provided by another exemplary embodiment of the present disclosure is shown, and the method can be executed by a computer device. Figure 3 This is a schematic diagram of the training process of the first hydrological model and the LSTM model. Figure 3 Steps 201-204 are described. Figure 2 , the method comprising: In step 201, a first hydrological model is constructed based on historical data of a first watershed, and the first hydrological model is used to simulate the first watershed.
[0053] The relevant contents of step 201 refer to the aforementioned step 101, and the detailed description is omitted here.
[0054] In step 202, based on the output of the first hydrological model, the LSTM model is used to predict the flow of the first watershed to obtain a first predicted flow.
[0055] Optionally, the LSTM model in step 202 is an LSTM model that adopts an attention mechanism. In this case, step 202 includes the following steps ac.
[0056] Step a: standardize the output of the first hydrological model and input it into the LSTM model.
[0057] For the implementation of the standardization process, please refer to the aforementioned step 101, and the detailed description is omitted here.
[0058] Step b, calculate the attention weight of each input feature of the LSTM model at the tth time step.
[0059] Assume that at time step t, the LSTM model includes n input features , where n is a positive integer. Then the attention weight of the i-th input feature at the t-th time step is calculated using formula (3).
[0060] (3) In formula (3), is the i-th input feature at the t-th time step The attention weight, i is an integer, the value range of i is 1 to n, is the hidden state of the LSTM model at the t-1th time step, that is, the output of the LSTM model at the t-1th time step; Indicates that and Combine, usually a fully connected layer or a small neural network.
[0061] In step c, based on the attention weight of each input feature at the t-th time step, the input features at the t-th time step are weighted summed to obtain the fused input features at the t-th time step.
[0062] Optionally, the fused input features of the tth time step are expressed using formula (4).
[0063] (4) In formula (4), is the input feature of the tth time step after fusion. The meanings of other parameters in formula (4) are the same as those in formula (3), and their detailed description is omitted here.
[0064] By introducing the attention mechanism, the LSTM model can dynamically adjust the attention paid to each input feature based on historical information (output at the t-1th time step) and current features (input at the tth time step). This allows the LSTM model to pay more attention to features that have a significant impact on flow changes (such as precipitation during heavy rainfall periods, soil moisture changes, etc.) during flow prediction, thereby improving the accuracy of flow prediction.
[0065] Optionally, during the LSTM model training process, the Pearson correlation coefficient between each input feature at the t-th time step and the flow value at the t-th time step is calculated, and the input features whose Pearson correlation coefficient is greater than the relevant threshold are used to train the LSTM model. The relevant threshold is an empirical value and can be set as required. The embodiment of the present disclosure does not limit the value of the relevant threshold.
[0066] In this way, a dynamic feature selection method is adopted. By calculating the Pearson correlation coefficient of each input feature, the correlation between each input feature and the actual flow value can be evaluated in real time, thereby evaluating the contribution of each input feature to flow prediction. By training the LSTM model with input features whose Pearson correlation coefficient is greater than the relevant threshold, the features that are more relevant to flow prediction can be used to train the LSTM model.
[0067] Optionally, the Pearson correlation technique of the i-th input feature at the t-th time step is calculated using formula (5).
[0068] (5) In formula (5), represents the flow value at the tth time step, that is, the actual flow of the first basin at the tth time step. Here, since the LSTM model is trained using historical data, the actual flow of the first basin at the tth time step is known. represents the Pearson correlation coefficient, represents the covariance, The meanings of other parameters in formula (5) are the same as those in formula (3), and their detailed description is omitted here.
[0069] Optionally, in the process of using the LSTM model to predict traffic, a dynamic error correction mechanism is used to correct the hyperparameters of the LSTM model (such as correcting the learning rate, the number of neurons in the hidden layer, etc.). The dynamic error mechanism includes the following two steps.
[0070] The first step is to determine the difference between the first predicted flow and the actual flow; At time t, the difference between the first predicted flow and the actual flow can be expressed as , The traffic forecast value at time t output by the LSTM model, that is, the first forecast traffic; is the actual flow at time t.
[0071] In the second step, when the difference between the first predicted flow and the actual flow is greater than the second error threshold, the hyperparameters of the LSTM model are corrected using formula (6).
[0072] (6) In formula (6), is the hyperparameter of the modified LSTM model, is the learning rate, is the loss function, is the gradient of the loss function with respect to the hyperparameters of the LSTM model before correction.
[0073] The second error threshold is calculated using formula (7).
[0074] (7) In formula (7), is the second error threshold, is the mean of the historical errors (the historical errors here are also the historical errors of the LSTM model), is the standard deviation of the error (that is, the standard deviation of the LSTM model error), is a constant coefficient used to adjust the error sensitivity.
[0075] By adopting a dynamic error correction mechanism to correct the hyperparameters of the LSTM model, the LSTM model can be better adapted to the current hydrological conditions.
[0076] When the difference between the first predicted flow and the actual flow is less than or equal to the second error threshold, it means that the first predicted flow output by the LSTM model is relatively accurate, and there is no need to correct the hyperparameters of the LSTM model. In this case, step 203 can be directly executed.
[0077] In step 203, the parameters of the first hydrological model are modified based on the difference between the first predicted flow and the output of the first hydrological model.
[0078] In the conventional flow prediction method of machine learning coupled with hydrological model, after the parameters of the hydrological model are determined, the hydrological model parameters will not be corrected, resulting in low accuracy of the hydrological model parameters. It can only guarantee short-term (for example, 3 to 7 days) flow prediction, but cannot achieve multi-step runoff prediction.
[0079] In the disclosed embodiment, a closed-loop optimization strategy is adopted, that is, the output of the LSTM model (predicted flow value) is fed back to the first hydrological model. If the predicted value error between the LSTM model and the first hydrological model is large, the parameters of the first model will be automatically adjusted to make the first hydrological model more accurate in the next simulation. By performing closed-loop optimization on the parameters of the first hydrological model through the output of the LSTM model, the accuracy of the hydrological model is effectively improved, and the difficulty of calibrating the parameters of the hydrological model is reduced, so that a good degree of accuracy can be guaranteed in long-term (for example, one month or even six months) flow prediction, thereby realizing multi-step flow prediction.
[0080] Optionally, step 203 includes: when the difference between the first predicted flow and the output of the first hydrological model is greater than a first error threshold, adjusting the parameters of the first hydrological model using formula (8): (8) in, are the parameters of the first hydrological model after adjustment, It is an adjustment factor used to control the amplitude of parameter adjustment. is the difference between the first predicted flow and the output of the first hydrological model, expressed as ,in is the first predicted flow, is the output of the first hydrological model. are the parameters of the first hydrological model before adjustment.
[0081] This closed-loop feedback mechanism can continuously optimize the model's predictive capabilities by adjusting the parameters of the hydrological model to make it more accurate in subsequent forecasts, thereby improving the long-term accuracy of flow forecasts.
[0082] Among them, the first error threshold It can be determined in a manner similar to the second error threshold, that is, using formula (7), which will be omitted here.
[0083] Optionally, step 203 also includes: when the difference between the first predicted flow and the output of the first hydrological model is less than or equal to the first error threshold, there is no need to correct the parameters of the first hydrological model. In this case, step 204 becomes: based on the output of the first hydrological model, using the LSTM model to predict the flow of the first watershed to obtain a second predicted flow.
[0084] In step 204, based on the output of the modified first hydrological model, the LSTM model is used to predict the flow of the first watershed to obtain a second predicted flow.
[0085] Here, assuming that steps 201-202 are for the case of predicting the flow of the first basin for the mth time, steps 203-204 are for the case of predicting the flow of the first basin for the m+1th time. Through steps 201-204, the output of the hybrid model (including the hybrid model of the first hydrological model and the LSTM model) finally trained is more accurate, so that a good degree of accuracy can be guaranteed in the long-term (for example, one month or even six months) flow prediction, thereby realizing multi-step flow prediction.
[0086] After the parameters of the first hydrological model are closed-loop corrected, the LSTM model can be used to predict the flow of the first basin based on the output of the corrected first hydrological model to obtain the second predicted flow. The second predicted flow here is the flow of the first basin predicted for the m+1th time.
[0087] Optionally, after the hybrid model training is completed, the hybrid model will output the traffic prediction value for a period of time in the future. The traffic prediction value is compared with the actual traffic data, and the performance of the hybrid model in different instances is evaluated using indicators such as correlation coefficient (r), Nash-Sutcliffe efficiency coefficient (NSE), Kling-Gupta efficiency coefficient (KGE), Willmott Index (WI), Relative Root Mean Square Error (RRMSE), and Mean Absolute Percentage Error (MAPE).
[0088] Among them, r focuses on evaluating the linear correlation between the predicted value and the measured value, NSE focuses on evaluating the degree of fit between the predicted value and the observed value, KGE combines the three aspects of correlation, offset and variability, and can more comprehensively evaluate the model's ability to fit the observed value, WI comprehensively considers the deviation and correlation, and can evaluate the model's performance in terms of mean, variance and correlation, RRMSE reflects the degree of variation of the model's prediction error relative to the observed value, and MAPE is used to evaluate the model's prediction accuracy within different ranges of observed values, especially for situations where the predicted value is small.
[0089] The above index values are calculated using formula (9) to formula (14) respectively.
[0090] (9) (10) (11) (12) (13) (14) In formula (9) to formula (14), is the measured flow value, It is the flow prediction value output by the hybrid model. is the mean of the measured flow values, is the mean of the flow prediction values output by the hybrid model, , , and The unit is . is the correlation coefficient between the flow prediction value output by the hybrid model and the measured flow value, which has the same meaning as in formula (5). is the standard deviation of the flow prediction value output by the hybrid model, is the standard deviation of the measured flow value. n is the data length, which indicates the total number of flow prediction values output by the hybrid model, and i indicates the i-th flow prediction value output by the hybrid model. n and i are both positive integers and i is less than or equal to n.
[0091] The following are device embodiments of the present application. For details not described in detail in the device embodiments, reference may be made to the above method embodiments.
[0092] Figure 4 FIG. 1 is a schematic diagram showing a structure of a multi-step runoff prediction device based on a hydrological model and LSTM provided by an exemplary embodiment of the present disclosure. Figure 4 The multi-step runoff prediction device 400 based on the hydrological model and LSTM includes: a modeling module 401, a first prediction module 402, a correction module 403 and a second prediction module 404.
[0093] The modeling module 401 is used to construct a first hydrological model based on historical data of the first watershed, and the first hydrological model is used to simulate the first watershed.
[0094] The first prediction module 402 is used to predict the flow of the first watershed using the LSTM model based on the output of the first hydrological model to obtain a first predicted flow.
[0095] The correction module 403 is used to correct the parameters of the first hydrological model based on the difference between the first predicted flow and the output of the first hydrological model.
[0096] The second prediction module 404 is used to predict the flow of the first watershed using the LSTM model based on the output of the modified first hydrological model to obtain a second predicted flow.
[0097] Optionally, the correction module 403 is further configured to adjust the parameters of the first hydrological model using the following formula when the difference between the first predicted flow and the output of the first hydrological model is greater than a first error threshold:
[0098] in, are the parameters of the first hydrological model after adjustment, is the adjustment factor, is the difference between the first predicted flow and the output of the first hydrological model, are the parameters of the first hydrological model before adjustment.
[0099] Optionally, the correction module 403 is further configured to correct the hyperparameters of the LSTM model using the following formula when the difference between the first predicted flow and the actual flow is greater than a second error threshold:
[0100] in, is the hyperparameter of the modified LSTM model, is the learning rate, is the loss function, is the gradient of the loss function with respect to the hyperparameters of the LSTM model before correction.
[0101] Optionally, the first prediction module 402 is also used to predict the flow of the first watershed based on the output of the first hydrological model using the LSTM model to obtain a first predicted flow, including: normalizing the output of the first hydrological model and inputting it into the LSTM model; calculating the attention weight of each input feature of the LSTM model at the tth time step; and based on the attention weight of each input feature at the tth time step, performing weighted summation on the input features at the tth time step to obtain the fused input features of the tth time step.
[0102] Optionally, the first prediction module 402 is further configured to calculate the attention weight of the i-th input feature at the t-th time step using the following formula:
[0103] in, is the i-th input feature at the t-th time step The attention weight, i is an integer, the value range of i is 1 to n, n is the number of input features of the LSTM model at the tth time step, is the hidden state of the LSTM model at the t-1th time step, Indicates that and to combine.
[0104] It should be noted that: when the multi-step runoff prediction device based on the hydrological model and LSTM provided in the above embodiment performs multi-step runoff prediction, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the multi-step runoff prediction device based on the hydrological model and LSTM provided in the above embodiment and the multi-step runoff prediction method embodiment based on the hydrological model and LSTM belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0105] The division of modules in the embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present disclosure may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0106] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a terminal device (which can be a personal computer, mobile phone, or communication device, etc.) or a processor (processor) to execute all or part of the steps of the method of each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0107] Figure 5 Schematic diagram of the structure of the computer device provided by the embodiment of the present disclosure. Figure 5 As shown, the computer device 500 includes: a processor 501 and a memory 502 .
[0108] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0109] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one instruction, which is used to be executed by the processor 501 to implement the multi-step runoff prediction method based on the hydrological model and LSTM provided in the embodiments of the present disclosure.
[0110] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the computer device 500, and the computer device 500 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.
[0111] The embodiment of the present disclosure also provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by the processor of a computer device, the computer device is able to execute the multi-step runoff prediction method based on the hydrological model and LSTM provided in the embodiment of the present disclosure.
[0112] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the multi-step runoff prediction method based on a hydrological model and LSTM provided in the embodiments of the present disclosure.
[0113] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A multi-step runoff prediction method based on hydrological model and LSTM, characterized in that: The method comprises: constructing a first hydrological model based on historical data of a first watershed, wherein the first hydrological model is used to simulate the first watershed; Based on the output of the first hydrological model, using the LSTM model to predict the flow of the first watershed to obtain a first predicted flow; modifying parameters of the first hydrological model based on a difference between the first predicted flow and an output of the first hydrological model; Based on the output of the modified first hydrological model, the LSTM model is used to predict the flow of the first river basin to obtain a second predicted flow.
2. The method according to claim 1, characterized in that The step of modifying the parameters of the first hydrological model based on the difference between the first predicted flow and the output of the first hydrological model comprises: When the difference between the first predicted flow and the output of the first hydrological model is greater than a first error threshold, the parameters of the first hydrological model are adjusted using the following formula: in, are the parameters of the first hydrological model after adjustment, is the adjustment factor, is the difference between the first predicted flow and the output of the first hydrological model, are the parameters of the first hydrological model before adjustment.
3. The method according to claim 1, characterized in that The method further comprises: When the difference between the first predicted flow and the actual flow is greater than the second error threshold, the hyperparameters of the LSTM model are corrected using the following formula: in, is the modified hyperparameter of the LSTM model, is the learning rate, is the loss function, is the gradient of the loss function with respect to the hyperparameters of the LSTM model described above.
4. The method according to any one of claims 1 to 3, characterized in that: During the LSTM model training process, the Pearson correlation coefficient between each input feature at the t-th time step and the flow value at the t-th time step is calculated, and the input features whose Pearson correlation coefficient is greater than the correlation threshold are used to train the LSTM model.
5. The method according to any one of claims 1 to 3, characterized in that: The method of using the LSTM model to predict the flow of the first river basin based on the output of the first hydrological model to obtain a first predicted flow includes: Normalizing the output of the first hydrological model and inputting the output into the LSTM model; Calculate the attention weight of each input feature of the LSTM model at the tth time step; Based on the attention weight of each input feature of the t-th time step, the input features of the t-th time step are weighted summed to obtain the fused input features of the t-th time step.
6. The device according to claim 5, characterized in that The attention weight of the i-th input feature at the t-th time step is calculated using the following formula: in, is the i-th input feature at the t-th time step The attention weight, i is an integer, the value range of i is 1 to n, n is the number of input features of the LSTM model at the tth time step, is the hidden state of the LSTM model at the t-1th time step, Indicates that and to combine.
7. A multi-step runoff prediction device based on hydrological model and LSTM, characterized in that: The device comprises: A modeling module, configured to construct a first hydrological model based on historical data of a first watershed, wherein the first hydrological model is used to simulate the first watershed; A first prediction module, configured to predict the flow of the first river basin using an LSTM model based on the output of the first hydrological model to obtain a first predicted flow; a correction module, configured to correct parameters of the first hydrological model based on a difference between the first predicted flow and an output of the first hydrological model; The second prediction module is used to use the LSTM model to predict the flow of the first river basin based on the output of the modified first hydrological model to obtain a second predicted flow.
8. A computer device, characterized in that: The computer device comprises: a memory and a processor, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.