Short-term runoff intelligent forecasting method, system, equipment and medium

By constructing an error database and combining a nearest neighbor search algorithm with a long short-term memory neural network model, runoff forecast errors are corrected in real time. This solves the problem of insufficient forecast accuracy of deep learning methods under extreme hydrological events, improves the reliability and adaptability of forecasts, and is applicable to basin flood warning and water resource management.

CN121920581APending Publication Date: 2026-04-24FUJIAN HUADIAN FURUI ENERGY DEV CO LTD CHITAN HYDROPOWER PLANT
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN HUADIAN FURUI ENERGY DEV CO LTD CHITAN HYDROPOWER PLANT
Filing Date
2025-11-20
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing deep learning-based runoff forecasting methods suffer from systematic biases in real-time forecasting, especially under extreme hydrological events where error accumulation is significant. The lack of an effective real-time error correction mechanism leads to insufficient forecast accuracy and reliability, affecting the timeliness of flood control scheduling and water resource optimization decisions.

Method used

By constructing a long short-term memory neural network model, historical runoff and precipitation data are obtained, an error database is established, a nearest neighbor search algorithm is used to identify similar historical samples, and an error estimate is calculated using a distance-weighted method. Real-time error correction is performed in conjunction with the neural network model, and the number of nearest neighbors is optimized to adapt to different hydrological conditions.

Benefits of technology

It significantly improves forecast accuracy and reliability, dynamically identifies similar hydrological conditions, reduces systematic bias, and enhances the model's adaptability to different data environments, making it suitable for basin flood warning, reservoir scheduling, and water resource management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121920581A_ABST
    Figure CN121920581A_ABST
Patent Text Reader

Abstract

The invention discloses a short-term runoff intelligent forecasting method, system and device and a medium, and belongs to the technical field of short-term runoff intelligent forecasting, and the method comprises the steps: constructing a long and short-term memory neural network model for training, and obtaining an initial forecasting result; calculating a simulation error between the initial forecast result and historical observation data, and establishing an error database; acquiring a current input feature vector, and identifying k most similar historical samples from the error database by adopting a neighbor search algorithm based on a distance measurement mode; performing weighting calculation on the historical errors corresponding to the k most similar historical samples by adopting a distance weighting mode; and fusing the error estimation value with a forecast result of the long-short-term memory neural network model at the current moment to obtain an updated runoff forecast value. According to the method, the error database is established, the neighbor search and distance weighting mechanism is adopted for real-time error correction, deep learning forecasting and experience knowledge of similar historical scenes are organically combined, and the forecasting precision is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of short-term runoff intelligent forecasting technology, specifically to a short-term runoff intelligent forecasting method, system, device, and medium. Background Technology

[0002] Short-term runoff forecasting is a crucial basis for water resource management and flood control decision-making. Traditional physical models rely on complex parameter calibration and are sensitive to underlying surface changes. In recent years, deep learning methods, such as Long Short-Term Memory (LSTM) neural networks, have made progress in runoff forecasting. However, model training is based on historical data, leading to systematic biases in real-time forecasts, especially during extreme hydrological events where errors accumulate significantly. Existing methods lack effective real-time error correction mechanisms and struggle to leverage empirical knowledge from similar historical scenarios, resulting in insufficient forecast accuracy and reliability, thus limiting the application of deep learning models in practical operational systems. Summary of the Invention

[0003] In view of the above-mentioned problems, the present invention provides a method, system, device and medium for intelligent forecasting of short-term runoff.

[0004] Therefore, the technical problem addressed by this invention is how to solve the insufficient real-time forecast accuracy of existing deep learning runoff forecasting methods. Specifically, while long short-term memory neural network models can learn historical hydrological patterns, they cannot dynamically correct systematic biases in real-time forecasting and fail to fully utilize the error characteristics of similar flood events. Existing methods lack error estimation mechanisms based on historical scenario similarity, leading to reduced reliability of forecast results under complex meteorological conditions and extreme hydrological events, affecting the timeliness of flood control scheduling and water resource optimization decisions.

[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a short-term runoff intelligent forecasting method, comprising, Historical runoff and precipitation data are acquired, and a long short-term memory neural network model is constructed and trained to obtain initial forecast results. Calculate the simulation error between the initial forecast result and historical observation data, and establish an error database. The error database contains the simulation error at historical moments and its corresponding input feature vector. The input feature vector includes historical forecast results and precipitation data. For the current forecast time, the current input feature vector is obtained, and the nearest neighbor search algorithm is used to identify the k most similar historical samples from the error database based on the distance metric. The historical errors corresponding to the k most similar historical samples are weighted using a distance-weighted method to obtain the error estimate at the current moment; The error estimate is fused with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

[0006] As a preferred embodiment of the short-term runoff intelligent forecasting method described in this invention, the establishment of the error database includes applying the trained long short-term memory neural network model to historical data to obtain the initial forecast results for each historical moment. The difference between the initial forecast results and the corresponding observation data at each historical moment is calculated to obtain the simulation error at each historical moment; Extract the input feature vectors corresponding to each historical moment; An error database is established based on the simulation error at each historical moment and its corresponding input feature vector.

[0007] As a preferred embodiment of the short-term runoff intelligent forecasting method of the present invention, the input feature vector includes obtaining the initial forecast result of the previous moment of each historical moment as the historical forecast result; Obtain precipitation data for multiple historical moments; The historical forecast results and precipitation data at multiple times are combined to form the input feature vector.

[0008] As a preferred embodiment of the short-term runoff intelligent forecasting method of the present invention, the step of identifying k most similar historical samples from the error database using a nearest neighbor search algorithm based on a distance metric includes calculating the distance between the current input feature vector and the input feature vectors at each historical moment in the error database. Sort all the distance values ​​in ascending order; The k most similar historical samples are selected from the sorted results.

[0009] As a preferred embodiment of the short-term runoff intelligent forecasting method of the present invention, the step of using a distance-weighted method to calculate the historical errors corresponding to the k most similar historical samples to obtain the error estimate at the current moment includes using the distance values ​​corresponding to each of the k most similar historical samples. Perform the reciprocal calculation on each of the aforementioned distance values; Multiply the historical error corresponding to each of the most similar historical samples by the reciprocal of its distance value; Summing the product results and dividing by the sum of the reciprocals of all distance values ​​yields the error estimate for the current time.

[0010] The beneficial effects of this preferred technical solution are as follows: by calculating the error estimate through inverse distance weighting, higher weights are given to historical samples that are closer in distance, making the error estimate more accurately reflect the current hydrological situation. Compared with the equal weighted averaging method, it can more accurately capture the error characteristics of similar flood events, improve the pertinence and reliability of real-time forecasts, reduce forecast bias, and maintain a stable error correction effect, especially under complex weather conditions.

[0011] As a preferred embodiment of the short-term runoff intelligent forecasting method described in this invention, the value of k is determined by an optimization algorithm, including randomly generating multiple initial k values ​​within the range of k values; For each initial k value, the nearest neighbor search algorithm is used to identify the corresponding number of most similar historical samples, and the distance weighting method is used to calculate the error estimate. Calculate the difference between the error estimate corresponding to each initial k value and the historical simulation error; Based on the difference, iteratively update each initial k value; When the preset number of iterations is reached, the k value corresponding to the smallest difference is taken as the optimal k value.

[0012] The beneficial effects of this preferred technical solution are as follows: by adaptively determining the k value through optimization algorithm, the subjectivity and limitations of manual experience selection are avoided, the number of nearest neighbors is matched with the specific watershed characteristics and data distribution, the model sensitivity is dynamically adjusted under different hydrological conditions, and compared with the fixed k value method, it can maintain good performance in both data-rich and data-scarce scenarios, thus improving the model's generalization ability.

[0013] As a preferred embodiment of the short-term runoff intelligent forecasting method of the present invention, the step of fusing the error estimate with the forecast result of the long short-term memory neural network model at the current moment to obtain the updated runoff forecast value includes obtaining the forecast result output by the long short-term memory neural network model based on the precipitation data at the current moment and the runoff data at the previous moment. Determine the sign of the error estimate; The error estimate is algebraically added to the forecast result; The result of the summation is checked for reasonableness to ensure that the updated runoff forecast value is non-negative; Output the updated runoff forecast values.

[0014] This invention provides a short-term runoff intelligent forecasting system.

[0015] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a short-term runoff intelligent forecasting system, comprising: a data acquisition module, used to acquire historical runoff data, precipitation data and input data at the current forecast time; The model training module is used to build and train the long short-term memory neural network model. The error database module is used to store the simulation errors at historical moments and their corresponding input feature vectors; The similar sample identification module is used to identify the k most similar historical samples from the error database using a nearest neighbor search algorithm based on a distance metric. The error estimation module is used to perform weighted calculation on the historical errors corresponding to the k most similar historical samples using a distance weighting method to obtain the error estimate value at the current time. The result fusion module is used to fuse the error estimate with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

[0016] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the short-term runoff intelligent forecasting method.

[0017] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the aforementioned short-term runoff intelligent forecasting method.

[0018] The beneficial effects of this invention are as follows: By establishing an error database and employing nearest neighbor search and distance-weighted mechanisms for real-time error correction, it organically combines deep learning forecasting with empirical knowledge of similar historical scenarios, significantly improving forecast accuracy. Compared to single neural network methods, this invention can dynamically identify similar hydrological conditions and estimate current errors, effectively reducing systematic bias. By adaptively determining the number of nearest neighbors through an optimization algorithm, the model's adaptability to different data environments is enhanced. This method is computationally efficient and easily integrated into existing operational systems, providing more reliable decision support for basin flood warnings, reservoir scheduling, and water resource management. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 The above is a flowchart of a short-term runoff intelligent forecasting method provided in one embodiment of the present invention. Detailed Implementation

[0021] To make the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0022] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a short-term runoff intelligent forecasting method, including: Step 1: Obtain historical runoff and precipitation data, construct a long short-term memory neural network model for training, and obtain initial forecast results; Step 2: Calculate the simulation error between the initial forecast result and the historical observation data, and establish an error database. The error database contains the simulation error at historical moments and its corresponding input feature vector. The input feature vector includes historical forecast results and precipitation data. Step 3: For the current forecast time, obtain the current input feature vector, and use the nearest neighbor search algorithm based on distance metric to identify the k most similar historical samples from the error database; Step 4: Use distance weighting to calculate the historical errors corresponding to the k most similar historical samples to obtain the error estimate at the current time. Step 5: Fuse the error estimate with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

[0023] In practical watershed runoff forecasting applications, while long short-term memory (LSTM) neural network models can learn the nonlinear relationship between precipitation and runoff through training, they often exhibit systematic biases in real-time forecasts due to limited training data and the time-varying nature of underlying surface conditions. Particularly during extreme events such as torrential rains and floods, relying solely on the fixed weight parameters of neural networks is insufficient to adapt to rapidly changing hydrological processes, leading to problems such as forecast peak deviations and peak time lags. Furthermore, similar historical flood events contain valuable information on error patterns, but existing methods have failed to effectively mine and utilize this historical experience. Therefore, there is a need to develop an intelligent method capable of learning error characteristics from similar historical scenarios and correcting forecast results in real time to improve the accuracy of runoff forecasts under complex hydrological conditions.

[0024] This embodiment effectively solves the aforementioned technical problems by organically combining deep learning forecasting and intelligent error correction through five steps. Step 1: Construct a long short-term memory neural network model to obtain basic forecasting capabilities; Step 2: Establish an error database by calculating historical forecast errors, providing a knowledge base for subsequent similar scenario identification; Step 3: Use a nearest neighbor search algorithm to quickly identify historical samples most similar to the current hydrological conditions from the historical database, achieving accurate matching of empirical knowledge; Step 4: Calculate the historical errors of similar samples using a distance-weighted method, assigning higher weights to samples with closer distances to ensure the relevance of error estimation; Step 5: Add the estimated errors to the neural network forecast results to achieve real-time dynamic correction. The entire process fully utilizes the learning capabilities of deep learning and the empirical knowledge of historical similar events, improving real-time forecast accuracy while maintaining the model's generalization ability, making it particularly suitable for data-driven intelligent hydrological forecasting systems.

[0025] Example 2, an embodiment of the present invention, provides a short-term runoff intelligent forecasting method based on the previous embodiment, including: Step 2: Calculate the simulation error between the initial forecast result and historical observation data, and establish an error database, including the following steps A1-A4: A1: Apply the trained long short-term memory neural network model to historical data to obtain the initial forecast results for each historical moment; A2: Calculate the difference between the initial forecast results and the corresponding observation data at each historical moment to obtain the simulation error at each historical moment; A3: Extract the input feature vectors corresponding to each historical moment; A4: Establish an error database based on the simulation error at each historical moment and its corresponding input feature vector.

[0026] In this embodiment of the application, in step A1, the trained long short-term memory neural network model is trained by: using historical precipitation data and corresponding historical runoff observation data as training samples, inputting them into the long short-term memory neural network model for training, continuously adjusting the network weights and bias parameters through the backpropagation algorithm to minimize the mean square error between the forecast results and the observed data, stopping training when the loss function converges or reaches the preset number of training rounds, and obtaining the trained long short-term memory neural network model; then inputting the historical precipitation data in the training set into the trained long short-term memory neural network model, and outputting the initial forecast results for each historical moment.

[0027] In an optional implementation, in step A1, the trained long short-term memory neural network model can be constructed by: building a long short-term memory neural network structure containing an input layer, a hidden layer, and an output layer; the input layer receiving precipitation data and runoff data from the previous moment; the hidden layer setting multiple long short-term memory units, each containing a forget gate, an input gate, and an output gate, selectively retaining and updating time-series information through a gating mechanism; and the output layer outputting the current runoff forecast value; training the network using training data to optimize the connection weights between layers; and after training, inputting the training set data into the model to obtain the initial forecast results for each historical moment.

[0028] In another optional implementation, in step A1, the trained long short-term memory neural network model can also be further improved by: setting network hyperparameters, including the number of hidden layer units, learning rate, and batch size; dividing historical data into training and validation sets in chronological order; constructing input-output sample pairs using a sliding time window, where the time window contains precipitation data from multiple consecutive moments as input and runoff data from the corresponding moments as output; training the model on the training set and evaluating its performance on the validation set, selecting the model parameters with the smallest validation error; and applying the model to all training set data, outputting initial forecast results moment by moment.

[0029] Furthermore, the Long Short-Term Memory (LSTM) neural network model includes an input layer, hidden layers, and an output layer. The input layer receives time-series data, including precipitation data from the current time step and several previous time steps, as well as runoff data from the previous time step. The hidden layer consists of multiple LSM units, each containing a forget gate, an input gate, and an output gate. The forget gate determines how much information from the previous time step's cell state is retained, the input gate determines how much information from the current input is written into the cell state, and the output gate determines how much information from the cell state is output to the hidden state. The output layer receives the hidden state from the last time step and outputs the current runoff forecast value. During training, historical time periods are divided into multiple samples according to time windows. The input for each sample is precipitation and runoff data from several consecutive time steps, and the output is the runoff observation value for the corresponding time step. Mean squared error is used as the loss function. The gradient of the loss function with respect to the weights and biases of each layer is calculated using the backpropagation algorithm, and the parameters are updated using gradient descent. The learning rate controls the update step size, and the batch size is set to input training samples into the network in batches. Training stops when the loss function no longer decreases on the validation set or reaches the preset number of training rounds. After training, the model can predict future runoff values ​​based on the input precipitation and historical runoff data.

[0030] Step 3: For the current forecast time, obtain the current input feature vector, and use the nearest neighbor search algorithm based on distance metric to identify the k most similar historical samples from the error database, including the following steps B1-B6: B1: Obtain the initial forecast result of the previous moment for each historical moment as the historical forecast result; B2: Obtain precipitation data for multiple historical moments; B3: Combine the historical forecast results and the precipitation data at multiple times to form the input feature vector.

[0031] B4: Calculate the distance between the current input feature vector and the input feature vectors at each historical moment in the error database; B5: Sort all the distance values ​​in ascending order; B6: Select the k historical samples with the smallest distance values ​​from the sorted results as the most similar historical samples.

[0032] In this embodiment of the application, in step B3, the historical forecast results and the precipitation data at multiple times are combined by: obtaining the initial forecast result at time t-1 before historical time t, denoted as Q(t-1); obtaining precipitation data at multiple consecutive times before historical time t, denoted as p(t-1), p(t-2), ..., p(tl), where l is the time span of the precipitation data; arranging Q(t-1), p(t-1), p(t-2), ..., p(tl) in order to form a one-dimensional vector, which is the input feature vector corresponding to historical time t; the dimension of this vector is equal to the time span of the precipitation data plus one.

[0033] In an optional implementation, step B3, combining the historical forecast results and the precipitation data at multiple times can be achieved by: extracting the initial forecast result from the time preceding the historical time and the precipitation observation values ​​from several times preceding that historical time; standardizing the precipitation data to map precipitation values ​​of different magnitudes to the same numerical range; standardizing the initial forecast results; and concatenating the standardized initial forecast results and precipitation data in chronological order to form a normalized input feature vector; this vector can eliminate differences in the dimensions of different features and improve the accuracy of similarity measurement.

[0034] In another optional implementation, in step B3, combining the historical forecast results and the precipitation data at multiple times can also be achieved by: determining the time span of the precipitation data based on the watershed confluence time, so that the precipitation impact period covers the runoff generation and confluence process; extracting the precipitation data at each time within the corresponding time period; using the historical forecast results as the first element of the vector, and using the precipitation data at each time as the subsequent elements in sequence; constructing a matrix to store the input feature vectors of all historical times, with each row of the matrix representing the feature vector of a historical time, which facilitates batch calculation of distance values.

[0035] In this embodiment of the application, in step 3, the nearest neighbor search algorithm identifies similar historical samples based on the KNN algorithm, specifically including: calculating the distance between the current input feature vector and all historical input feature vectors in the error database; sorting all distance values ​​from smallest to largest; selecting the k historical samples with the smallest distance values ​​as nearest neighbors; the historical time corresponding to these k historical samples has the most similar precipitation and runoff conditions to the current time, and their simulation error characteristics can be used to estimate the forecast error at the current time.

[0036] In an optional implementation, in step 3, the nearest neighbor search algorithm can: identify similar samples using the K-nearest neighbor regression algorithm, traverse each historical record in the error database, and calculate the similarity between its input feature vector and the current input feature vector; sort all historical records in descending order of similarity, which is equivalent to sorting them in ascending order of distance; extract the top k historical records after sorting; these k records represent historical events with hydrological conditions closest to the current situation, and can provide the most relevant reference information for error estimation.

[0037] In another optional implementation, in step 3, the nearest neighbor search algorithm can also: set a range for the number of nearest neighbors k, and use an optimization algorithm to determine the optimal k value; when identifying similar samples, first calculate and sort the distance between the current vector and all historical vectors; select the corresponding number of nearest neighbor samples according to the optimal k value; when hydrological data is sufficient, the k value can be set larger to obtain more references, and when data is scarce, the k value can be set smaller to ensure the similarity of the selected samples, thereby achieving adaptive nearest neighbor search.

[0038] In this embodiment of the application, in step 3, the distance measurement method is as follows: the similarity between input feature vectors is measured by Euclidean distance. Let the current input feature vector be X and the historical input feature vector be Y. Both have a dimension of n. Then the Euclidean distance L is calculated by: taking the difference between the components of each corresponding dimension of X and Y, squaring the difference between each dimension and summing them, and taking the square root of the summation result to obtain the distance L. The smaller the distance L, the more similar the two vectors are, and the closer the corresponding hydrological conditions are.

[0039] In an optional implementation, in step 3, the distance metric can be: using Manhattan distance to measure vector similarity, calculating the absolute difference between the corresponding dimensional components of the current input feature vector and the historical input feature vector; summing the absolute differences of all dimensions to obtain the Manhattan distance; this distance calculation method does not require square root operations, and is more computationally efficient; when the feature vector dimension is high, Manhattan distance can more quickly complete the distance calculation of a large number of historical samples, and is suitable for real-time forecasting systems.

[0040] In another optional implementation, in step 3, the distance measurement method can also be: using weighted Euclidean distance to measure similarity, assigning weight coefficients to different dimensions of the input feature vector; assigning higher weights to the historical forecast result dimension and lower weights to precipitation data from more distant times, reflecting the differences in the degree of influence of different features on the current runoff; calculating the sum of squares of the weighted differences of each dimension and taking the square root to obtain the weighted Euclidean distance; this method can highlight the role of key features and improve the targeting of similar sample identification.

[0041] Step 4: The historical errors corresponding to the k most similar historical samples are weighted using a distance-weighted method to obtain the error estimate at the current time, including the following steps C1-C5: C1: Use the distance values ​​corresponding to the k most similar historical samples; C2: Calculate the reciprocal of each of the distance values; C3: Multiply the historical error corresponding to each of the most similar historical samples by the inverse of its distance value; C5: Summing the product results and dividing by the sum of the reciprocals of all distance values, we obtain the error estimate for the current time.

[0042] Furthermore, the value of k is determined through an optimization algorithm, which includes randomly generating multiple initial k values ​​within the range of k values; For each initial k value, the nearest neighbor search algorithm is used to identify the corresponding number of most similar historical samples, and the distance weighting method is used to calculate the error estimate. Calculate the difference between the error estimate corresponding to each initial k value and the historical simulation error; Based on the difference, iteratively update each initial k value; When the preset number of iterations is reached, the k value corresponding to the smallest difference is taken as the optimal k value.

[0043] Step 5: The error estimate is fused with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value, including the following steps D1-D5: D1: Obtain the forecast results output by the long short-term memory neural network model based on the precipitation data at the current moment and the runoff data at the previous moment; D2: Determine the sign of the error estimate; D3: Perform an algebraic addition operation between the error estimate and the forecast result; D4: Perform a reasonableness check on the summed result to ensure that the updated runoff forecast value is non-negative; D5: Output the updated runoff forecast value.

[0044] Example 3, an embodiment of the present invention, provides a short-term runoff intelligent forecasting method based on the previous embodiment, including: In practical runoff forecasting applications, the deep belief network model, as a semi-supervised deep learning method, extracts deep nonlinear features in the precipitation-runoff relationship through a multi-layer restricted Boltzmann machine, offering advantages such as high speed and high automation in feature data extraction. This embodiment uses a deep belief network model instead of a long short-term memory neural network model for runoff forecasting.

[0045] In step 1, historical runoff and precipitation data are acquired, and a deep belief network model is constructed and trained to obtain initial forecast results, specifically including: A deep belief network model is constructed, consisting of two layers of Restricted Boltzmann Machines (RBMs) and one layer of backpropagation neural network. The RBM consists of a visible layer... and hidden layer The network is composed of layers with no connections within each layer but fully connected between layers. The visible layer receives precipitation and runoff data input, while the hidden layers extract hydrological features. For runoff forecasting tasks, the number of neurons in the visible layer... Set as the input feature dimension, the number of neurons in the hidden layer Configure according to feature extraction requirements.

[0046] For a given visible layer state and hidden layer states Its joint configuration energy function is expressed as: In practical runoff forecasting applications, the deep belief network model, as a semi-supervised deep learning method, extracts deep nonlinear features in the precipitation-runoff relationship through a multi-layer restricted Boltzmann machine, offering advantages such as high speed and high automation in feature data extraction. This embodiment uses a deep belief network model instead of a long short-term memory neural network model for runoff forecasting.

[0047] In step 1, historical runoff and precipitation data are acquired, and a deep belief network model is constructed and trained to obtain initial forecast results, specifically including: A deep belief network model is constructed, consisting of two layers of Restricted Boltzmann Machines (RBMs) and one layer of backpropagation neural network. The RBM consists of a visible layer... and hidden layer The network is composed of layers with no connections within each layer but fully connected between layers. The visible layer receives precipitation and runoff data input, while the hidden layers extract hydrological features. For runoff forecasting tasks, the number of neurons in the visible layer... Set as the input feature dimension, the number of neurons in the hidden layer Configure according to feature extraction requirements.

[0048] For a given visible layer state and hidden layer states Its joint configuration energy function is expressed as: In the formula, For the first The visible unit and the first Connection weights between hidden units; and The first The visible unit and the first The bias vector of each hidden unit; These represent the number of neurons in the visible layer and the hidden layer, respectively. All the above RBM parameters are expressed in... To express. The joint probability distribution is: In the formula, This is the normalization factor.

[0049] Furthermore, the conditional probability distribution function between the visible layer and the hidden layer can be derived as follows: In an RBM structure, given the activation states of each visible layer unit, the activation states of each neuron in the hidden layer are independent of each other. Therefore, the activation states of the neurons in the hidden layer are independent of each other. The first neuron and the first visible layer The activation probabilities of the neurons are as follows: The purpose of training an RBM is to continuously update its parameters. This continues until the probability distribution of the model's output data is as close as possible to the training set. Specifically, for a given visual layer input data... Find its corresponding hidden layer Then calculate the new visible layer. Then passed again Find its corresponding The neuron connection weights and bias vectors in the visible and hidden layers are updated as follows, until... infinitely close to : In the formula, The learning rate is typically between 0.01 and 1.

[0050] DBN training includes two processes: unsupervised pre-training and supervised fine-tuning. (1) Pre-training. The RBM is trained from bottom to top using the greedy contrastive divergence (CD) algorithm. After the first RBM is trained, the input of the next RBM is the output of the hidden layer of the current RBM. This process is repeated layer by layer to continuously optimize the parameters of the model and minimize the error function to achieve a local optimum.

[0051] (2) Reverse fine-tuning. In the last layer of the DBM, the training error is propagated from top to bottom to the RBM layer using the supervised learning method of the BP neural network. Then, the entire DBM is fine-tuned to achieve global optimum.

[0052] The LSTM-KNN model incorporates the KNN algorithm as a real-time prediction update method. The KNN algorithm is one of the non-parametric methods used for real-time updates in hydrological forecasting. Due to the temporal and spatial similarity of flood events, similar underlying surfaces and weather conditions often produce parallel hydrological curves. Considering that the purpose of KNN is to learn from historical information similar to the current situation, it can be inferred that certain features of similar flood events can be used for real-time error estimation. KNN is used to select the simulation error of flood events at each time step, and Euclidean distance is chosen as the measure of input vector proximity to identify the most similar events. A hydrological map, using For the most recent samples, the simulation error is estimated using the inverse distance weighting method.

[0053] (1) Historical database construction is achieved by calculating simulation errors. After training the LSTM model, the error between the observed values ​​in the training set and the LSTM simulation is calculated. In the KNN model, the relationship between error and input is expressed by the following formula: In the formula, for The simulation error at time step is the difference between the LSTM result and the observed data. Is it the LSTM model in The result of the moment, To and Influencing factors related to moment-to-moment flow It is the dimension of the influence factor.

[0054] (2) Optimal Nearest neighbor identification. Euclidean distance is used to measure the distance between inputs; all vectors are sorted according to distance. Sort in ascending order and search Individual and input time The most similar vector.

[0055] (3) Error estimation. The weight of each historical error is calculated using the inverse distance weighting method. The time error is due to The weighted average of the simulation errors is determined as follows: (4) Update the results. Add the error from the KNN calculation to the LSTM calculation result: The value is the only parameter that needs to be adjusted in the KNN algorithm, and it is optimized using a population optimization algorithm. The results of the LSTM model and precipitation data are used as inputs to the KNN algorithm, and the simulation error is multiplied by each... To find the optimal KNN calculation, the difference between the calculation errors is minimized. Furthermore, the LSTM-KNN model leverages the ability of KNN to estimate errors from historical and newly collected information, making more efficient use of data and thus achieving more stable performance even with insufficient data.

[0056] In nearest neighbor search algorithms, the number of nearest neighbors, k, is a key parameter affecting the accuracy of error estimation. A k value that is too small leads to unstable error estimation, while a k value that is too large introduces interference from dissimilar samples. Traditional methods determine the k value through manual experience or cross-validation, but these methods are difficult to adapt to different watersheds and hydrological conditions. This embodiment uses the marine predator algorithm to adaptively determine the optimal k value, ensuring that the number of nearest neighbors matches the specific runoff forecasting task. The specific steps include: (1) Initialization Phase. Similar to most metaheuristic algorithms, MPA randomly initializes prey positions within the search space to initiate the optimization process. The formula is as follows: In the formula, , The search space range; It is a random number within the range [0,1].

[0057] (2) MPA Optimization Stage. In the early stages of iteration, when the predator's speed is faster than the prey's speed, the mathematical description of the MPA optimization process based on the exploration strategy is as follows: In the formula, stepsize is the movement step size; is a normally distributed Brownian walk random vector; Elitei is the elite matrix constructed from the top predators; Preyi is the prey matrix with the same dimension as the elite matrix; ⨂ is the term-by-term multiplication operator; P equals 0.5; R is a uniform random vector in [0,1]; n is the population size; Iter and Max_Iter are the current and maximum iteration counts, respectively.

[0058] In the middle of the iteration, when the predator and prey have the same speed, the prey uses a Lévy walk strategy to develop resources, while the predator uses a Brownian walk strategy to explore, gradually shifting from an exploration strategy to a development strategy. The mathematical descriptions of development and exploration are as follows: In the formula, It is a random vector that follows a Lévy distribution; , is an adaptive parameter for controlling the predator's step size; the other parameters have the same meaning as above.

[0059] At the end of the iteration, when the predator's speed is slower than the prey's, the predator adopts an exploitative strategy based on Lévy walking. Its mathematical description is as follows: (3) FADs effect or eddies. Fish gathering devices (FADs) or eddies often alter the foraging behavior of marine predators. This strategy enables MPA to overcome premature convergence and escape local extrema during the optimization process. Its mathematical description is as follows: In the formula, FADs represents the influence probability, which is set to 0.2; U is a binary vector; A random number within the range [0,1]; , These are random indices of the prey matrix.

[0060] Furthermore, a harmony search algorithm can be used to determine the optimal value of k. The harmony search algorithm simulates the creative process of a musician, analogizing each candidate k value to a pitch in harmony. Through searching within and outside the memory bank and a pitch fine-tuning mechanism, it searches for the optimal solution within the range of k values ​​that makes the error estimation most accurate. This includes the following steps: Step 1: Determine the objective function and initialize the parameters.

[0061] Step 2: Initialize the harmony memory library and calculate the objective function value.

[0062] Randomly generate within the range of values ​​for each decision variable Each solution vector is stored in the harmony memory (HM), and each decision variable is generated according to the following formula: In the formula, Step 3: Generate a new harmony (i.e., a new interpretation).

[0063] In the new harmony Any tone (i.e., variable) The following rules apply: First, generate a random number between 0 and 1, rand1. If rand1 is less than the probability of a value taken from the harmony memory bank... Then in the harmony memory bank, the HM-th Randomly select one variable from the variables, and then generate a random number rand2 between 0 and 1. If rand2 is less than the pitch fine-tuning probability... Local perturbation is performed according to the following formula; if rand1 is greater than the probability of the harmony memory value... Then, a new solution will be randomly generated according to the formula in Step 2.

[0064] Step 4: If the new solution in Step 3 is better than the worst harmony in HM, then the new solution... Replace the worst harmony in HM and update the harmony memory HM.

[0065] Step 5: Determine the termination condition of the algorithm. If it is met, stop the iteration and output the optimal solution; otherwise, repeat steps 3 and 4.

[0066] Example 4 is an embodiment of the present invention, which provides a short-term runoff intelligent forecasting method. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.

[0067] A hydrological station in a specific watershed was selected as the experimental subject. This watershed has a large catchment area and a complex precipitation-runoff relationship. The experimental data includes historical runoff observation data and precipitation data, with a time resolution of hourly and a time span covering many years. The dataset was divided into training, validation, and test sets in chronological order. The training set was used for model training and error database establishment, the validation set was used to optimize the algorithm and determine the optimal parameters, and the test set was used to evaluate forecast performance.

[0068] To verify the effectiveness of the method of the present invention, the following comparative scheme was designed: Scheme 1 (Method of this Invention): A real-time error correction method using a Long Short-Term Memory (LSTM) neural network model combined with a nearest neighbor search algorithm. First, the LSTM neural network model is trained to obtain initial forecast results, and an error database is established. Then, for the current forecast time, the KNN algorithm is used to identify similar historical samples, and the error estimate is calculated using the inverse distance weighting method. Finally, the error estimate is fused with the neural network forecast results to obtain the updated runoff forecast. The marine predator algorithm is used to optimize the number of nearest neighbors, k.

[0069] Option 2 (Single LSTM Method): This method uses only a Long Short-Term Memory (LSTM) neural network model for runoff forecasting without introducing an error correction mechanism. This option serves as a baseline method to evaluate the contribution of the error correction mechanism.

[0070] Option 3 (Fixed k-value method): This method uses a long short-term memory neural network model combined with a nearest neighbor search algorithm, but the number of nearest neighbors k is a fixed value set manually based on experience and is not optimized. This option is used to verify the necessity of determining the k-value in the optimization algorithm.

[0071] Option 4 (Equal-weighted averaging method): This option employs a Long Short-Term Memory (LSTM) neural network model combined with a nearest neighbor search algorithm, but uses equal-weighted averaging instead of inverse distance weighting for error estimation. This option is used to verify the effectiveness of the distance weighting mechanism. III. Model Parameter Settings: The input layer of the LSTM neural network model receives precipitation data from several previous time steps and runoff data from the previous time step. The hidden layer uses multiple LSTM units, and the output layer outputs the current runoff forecast value. Mean squared error is used as the loss function, and the model is trained using a time backpropagation algorithm. The learning rate, update step size, batch size, and number of training epochs are set. When constructing the error database, the input feature vector includes the initial forecast result from the previous time step and precipitation data from several previous time steps. Euclidean distance is used as the distance metric.

[0072] Marine Predator Algorithm Parameter Settings: The range of values ​​is Population size Set to 30, and set the maximum number of iterations Max_Iter to... The impact probability is set to 0.2. The objective function is the mean square error between the error estimate on the training set and the actual simulation error.

[0073] The following indicators are used to evaluate forecast performance: In the formula, For the number of forecast periods, Let be the predicted runoff value at time t. Let t be the measured runoff value at time t. The smaller the RMSE, the higher the forecast accuracy.

[0074] In the formula, The NSE value is the average value of the measured runoff, and the range of the NSE value is (-∞, 1]. The closer it is to 1, the better the forecast effect.

[0075] In the formula, This represents the average value of the predicted runoff. The closer R is to 1, the stronger the correlation between the predicted and observed values.

[0076] A smaller MAE indicates a smaller forecast bias.

[0077] Overall forecast accuracy comparison: On the test set, Scheme 1 achieved an NSE value above 0.92, with a significantly lower RMSE than other schemes, and a correlation coefficient R close to 0.98. Compared to Scheme 2 (single LSTM), Scheme 1 improved its NSE by approximately 0.08 and reduced its RMSE by approximately [missing value]. This demonstrates that the error correction mechanism significantly improves forecast accuracy. Compared to Scheme 3 (fixed k value), Scheme 1 improves NSE by approximately 0.03, verifying the effectiveness of the optimization algorithm in determining the k value. Compared to Scheme 4 (equal weighted averaging), Scheme 1 reduces RMSE by approximately [missing value]. This indicates that the inverse distance weighting mechanism can more accurately estimate the current error.

[0078] Performance under different hydrological conditions: During periods of normal flow, all four schemes demonstrated high forecast accuracy, with Scheme 1 showing no significant advantage. During periods of peak flow, Scheme 1 accurately captured the peak value and peak occurrence time, with the relative error of the peak value controlled within [specific range]. Within, while the peak relative error of scheme 2 reaches As shown above, the peak flow forecasts for Schemes 3 and 4 exhibit significant lag. During periods of low water flow, Scheme 1 demonstrates better forecast stability than the other schemes, avoiding negative forecasts.

[0079] Error correction effect analysis: Statistical analysis of the distribution characteristics of error estimates in Scheme 1 revealed that the signs of the error estimates are highly consistent with the actual systematic deviations, and the identification accuracy of both positive and negative errors exceeds [percentage missing]. Analysis of the distance distribution of similar historical samples revealed that the optimized k-value of the Ocean Predator algorithm can automatically adapt to the data density, with a larger k-value in areas with abundant data and a smaller k-value in areas with sparse data, demonstrating the algorithm's adaptability.

[0080] Forecast performance with different lead times: Lead times were set from 1 hour to 12 hours, and the forecast performance of each scheme was analyzed under different lead times. The results show that the forecast accuracy of all schemes decreases with increasing lead time, but the rate of decrease for Scheme 1 is significantly slower than that of the others. With a lead time of 1 hour, Scheme 1 achieved an NSE of 0.956; with a lead time of 6 hours, the NSE remained above 0.835; and with a lead time of 12 hours, the NSE was 0.604, an improvement of approximately 0.10 compared to Scheme 2. This indicates that the error correction mechanism has a more significant advantage in long-lead-time forecasts.

[0081] Computational efficiency analysis: The time consumed by a single forecast in Scheme 1 includes three parts: neural network forward propagation, error database retrieval, and distance-weighted calculation. Experiments show that the time consumed by a single forecast is within the range of seconds, meeting the requirements for real-time forecasting. The optimization of the k-value in the marine predator algorithm is completed during the model training phase and does not affect the real-time forecasting efficiency.

[0082] Experimental results show that the short-term runoff intelligent forecasting method based on long short-term memory neural network and nearest neighbor search algorithm proposed in this invention has the following advantages: (1) By using an error database and similar historical sample identification mechanism, it effectively utilizes historical experience knowledge and significantly improves forecast accuracy; (2) It uses the inverse distance weighting method to calculate the error estimate, giving greater weight to samples with high similarity, thus improving the pertinence of error estimation; (3) It uses an optimization algorithm to adaptively determine the number of nearest neighbors, enhancing the adaptability and robustness of the method under different data environments; (4) It exhibits stable forecasting performance under different hydrological conditions and forecast periods, especially showing significant advantages in flood peak forecasting and long-term forecasting. This method provides a high-precision, high-efficiency, and easy-to-implement intelligent solution for watershed runoff forecasting, and has important engineering application value.

[0083] Example 5 is an embodiment of the present invention, which provides a short-term runoff intelligent forecasting system, including: a data acquisition module, used to acquire historical runoff data, precipitation data and input data at the current forecast time; The model training module is used to build and train the long short-term memory neural network model. The error database module is used to store the simulation errors at historical moments and their corresponding input feature vectors; The similar sample identification module is used to identify the k most similar historical samples from the error database using a nearest neighbor search algorithm based on a distance metric. The error estimation module is used to perform weighted calculation on the historical errors corresponding to the k most similar historical samples using a distance weighting method to obtain the error estimate value at the current time. The result fusion module is used to fuse the error estimate with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

[0084] This embodiment also provides an electronic device applicable to a short-term runoff intelligent forecasting method, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the short-term runoff intelligent forecasting method proposed in the above embodiment.

[0085] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements a short-term runoff intelligent forecasting method as proposed in the above embodiments.

[0086] The storage medium proposed in this embodiment belongs to the same inventive concept as the method for implementing a short-term runoff intelligent forecasting proposed in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0087] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0088] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A short-term runoff intelligent forecasting method, characterized in that: include, Historical runoff and precipitation data are acquired, and a long short-term memory neural network model is constructed and trained to obtain initial forecast results. Calculate the simulation error between the initial forecast result and historical observation data, and establish an error database. The error database contains the simulation error at historical moments and its corresponding input feature vector. The input feature vector includes historical forecast results and precipitation data. For the current forecast time, the current input feature vector is obtained, and the nearest neighbor search algorithm is used to identify the k most similar historical samples from the error database based on the distance metric. The historical errors corresponding to the k most similar historical samples are weighted using a distance-weighted method to obtain the error estimate at the current moment; The error estimate is fused with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

2. The short-term runoff intelligent forecasting method as described in claim 1, characterized in that: The establishment of the error database includes applying the trained long short-term memory neural network model to historical data to obtain the initial forecast results for each historical moment. The difference between the initial forecast results and the corresponding observation data at each historical moment is calculated to obtain the simulation error at each historical moment; Extract the input feature vectors corresponding to each historical moment; An error database is established based on the simulation error at each historical moment and its corresponding input feature vector.

3. The short-term runoff intelligent forecasting method as described in claim 2, characterized in that: The input feature vector includes obtaining the initial forecast result of the previous moment of each historical moment as the historical forecast result; Obtain precipitation data for multiple historical moments; The historical forecast results and precipitation data at multiple times are combined to form the input feature vector.

4. The short-term runoff intelligent forecasting method as described in claim 3, characterized in that: The step of using a nearest neighbor search algorithm based on distance metric to identify k most similar historical samples from the error database includes calculating the distance between the current input feature vector and the input feature vectors at each historical moment in the error database; Sort all the distance values ​​in ascending order; The k most similar historical samples are selected from the sorted results.

5. The short-term runoff intelligent forecasting method as described in claim 4, characterized in that: The step of using a distance-weighted method to calculate the historical errors corresponding to the k most similar historical samples to obtain the error estimate at the current moment includes using the distance values ​​corresponding to each of the k most similar historical samples. Calculate the reciprocal of each of the distance values; Multiply the historical error corresponding to each of the most similar historical samples by the reciprocal of its distance value; Summing the product results and dividing by the sum of the reciprocals of all distance values ​​yields the error estimate for the current time.

6. The short-term runoff intelligent forecasting method as described in claim 5, characterized in that: The value of k is determined by an optimization algorithm, which includes randomly generating multiple initial k values ​​within the range of k values. For each initial k value, the nearest neighbor search algorithm is used to identify the corresponding number of most similar historical samples, and the distance weighting method is used to calculate the error estimate. Calculate the difference between the error estimate corresponding to each initial k value and the historical simulation error; Based on the difference, iteratively update each initial k value; When the preset number of iterations is reached, the k value corresponding to the smallest difference is taken as the optimal k value.

7. The short-term runoff intelligent forecasting method as described in claim 6, characterized in that: The step of fusing the error estimate with the forecast result of the long short-term memory neural network model at the current moment to obtain the updated runoff forecast value includes obtaining the forecast result output by the long short-term memory neural network model based on the precipitation data at the current moment and the runoff data at the previous moment. Determine the sign of the error estimate; The error estimate is algebraically added to the forecast result; The result of the summation is checked for reasonableness to ensure that the updated runoff forecast value is non-negative; Output the updated runoff forecast values.

8. A short-term runoff intelligent forecasting system, employing a short-term runoff intelligent forecasting method as described in any one of claims 1 to 7, characterized in that, include: The data acquisition module is used to acquire historical runoff data, precipitation data, and input data for the current forecast time. The model training module is used to build and train the long short-term memory neural network model. The error database module is used to store the simulation errors at historical moments and their corresponding input feature vectors; The similar sample identification module is used to identify the k most similar historical samples from the error database using a nearest neighbor search algorithm based on a distance metric. The error estimation module is used to perform weighted calculation on the historical errors corresponding to the k most similar historical samples using a distance weighting method to obtain the error estimate value at the current time. The result fusion module is used to fuse the error estimate with the forecast result of the long short-term memory neural network model at the current time to obtain the updated runoff forecast value.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the short-term runoff intelligent forecasting method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the short-term runoff intelligent forecasting method according to any one of claims 1 to 7.