Stacked model-based water level prediction system, method, medium, and computer program product

By combining stacked models with multiple deep learning models and optimizing hyperparameters, the shortcomings of traditional water level prediction models in capturing complex nonlinear features and adaptability are addressed, achieving more efficient and accurate water level prediction and enhancing the scientific support capabilities for water conservancy management and water resources planning.

CN120355036BActive Publication Date: 2026-02-24CHANGJIANG SEA-ROUTE PLANNING DESIGN RES INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510696435.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2026-02-24
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

Traditional water level prediction models based on statistical methods struggle to capture the complex nonlinear characteristics of water level changes. A single prediction model cannot fully capture the multifaceted features of the data, and there is a lack of a water level prediction model framework that can adapt to complex changes.

Method used

A water level prediction system based on a stacked model is adopted, including a base model and a stacked model building module. It utilizes various deep learning models (such as RNN, LSTM, and GRU) combined with a multi-layer feedforward neural network, and optimizes hyperparameters through grid search and multiple cross-validation to build a robust water level prediction model.

Benefits of technology

It improves the accuracy and stability of water level prediction, enhances the model's generalization ability, ensures more accurate predictions in practical applications, and improves the scientific decision-making level of water conservancy management and water resources planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120355036B_ABST
    Figure CN120355036B_ABST
Patent Text Reader

Abstract

The application discloses a water level prediction system and method based on a stacked model, a medium and a computer program product. The system comprises a base model construction module, a stacked model construction module, a base model training module, a stacked model training module and a water level prediction module. The application provides a water level prediction model framework with generalization and comprehensive advantages of multiple deep learning models. The advantages of multiple deep learning models are integrated, the prediction ability for water level change is improved, more reliable scientific support is provided for water conservancy management and water resource planning, and the public service ability and scientific decision-making level of waterway water level prediction and forecasting are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence and deep learning technology, specifically relating to a water level prediction system, method, medium, and computer program product based on a stacked model. Background Technology

[0002] With the increasing severity of global climate change, the importance of hydrological issues such as water resource management and flood disaster early warning is becoming increasingly prominent. Accurate water level prediction is one of the core tasks of water conservancy, waterway management, and water resource planning, and its accuracy directly affects the effectiveness of flood control and disaster reduction and the rational allocation of water resources. Against this backdrop, improving the public service capacity and scientific decision-making level of waterway water level prediction and forecasting is particularly important.

[0003] Traditional statistical-based water level prediction models often struggle to capture the complex nonlinear characteristics of water level changes, leading to significant prediction errors. To overcome these shortcomings and fully utilize information from big data, introducing data-driven deep learning models has become a key approach to improving the accuracy and precision of water level prediction. In recent years, scholars both domestically and internationally have conducted extensive research on water level prediction based on machine learning and deep learning models, resulting in rapid development of machine learning and deep learning methods for water level prediction.

[0004] While these deep learning models have made some progress in water level prediction, a single prediction model often only captures a single feature of the time series, making it difficult to comprehensively capture the multifaceted characteristics of the data. Furthermore, for a specific water level prediction problem, it is difficult to determine in advance which method is most suitable. Therefore, there is a lack of a generalizable water level prediction model framework that can adapt to complex changes to meet the needs of water level prediction under different conditions. Summary of the Invention

[0005] To improve the ability to predict water level changes and provide more reliable scientific support for water conservancy management and water resources planning, this invention proposes a water level prediction system, method, medium, and computer program product based on a stacked model.

[0006] A water level prediction system based on a stacked model, which achieves one of the objectives of this invention, includes:

[0007] Base model construction module: used to construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for future time periods;

[0008] Stacked model building module: used to build a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period.

[0009] Base model training module: used to train the base model using historical water level data to obtain each trained base model;

[0010] Stacked model training module: used to train the stacked model using the initial predicted values ​​of the future time period output by each trained base model as training data, to obtain a water level prediction model for predicting water levels in the future time period.

[0011] Water level prediction module: used to predict water level changes in the future time period using the water level prediction model.

[0012] Furthermore, during training of each base model or stacked model, a grid search method is used to determine the optimal values ​​of the hyperparameters for each base model or stacked model. Each base model is evaluated by cross-validation with a set multiple on the validation set. Training stops when the error on the validation set fails to improve over multiple consecutive training epochs. The technical benefits include: the grid search method can find the optimal hyperparameter settings on a given dataset, thus fully realizing the model's performance potential; by finding the optimal hyperparameters, the model's performance on the training and validation sets is more balanced, avoiding overfitting or underfitting due to improper hyperparameter settings, thereby improving the model's generalization ability to unseen data and enabling more accurate prediction or classification in practical applications; multiple cross-validation, compared to evaluating with only one validation set, makes fuller use of the validation set data, reducing evaluation bias caused by different data partitioning methods, making the evaluation results more stable and reliable; by performing multiple cross-validation evaluations on the validation set, the performance of different base models can be compared more accurately, thus selecting the most suitable base model for the current task and providing a better foundation for subsequent stacked model construction. When errors on the validation set fail to improve over multiple consecutive training epochs, it indicates that the model may have reached its optimal state or begun to overfit. Stopping training at this point avoids wasting significant computational resources and time on ineffective training, improving training efficiency. Early stopping strategies can terminate model training promptly, preventing the model from learning too deeply on the training set and thus preventing overfitting. This maintains the model's generalization ability on the validation and test sets, enabling it to better handle new data in real-world applications. It also helps optimize the model's robustness and predictive accuracy, ensuring that its potential is fully utilized to improve performance.

[0013] Furthermore, the stacked model includes two hidden layers and one output layer. Each hidden layer contains multiple neurons. The first hidden layer is used to map the initial predicted value of water level change output by each base model to a multidimensional space, thereby extracting preliminary features from the initial predicted value of water level change output by each base model to obtain a first output feature value. The second hidden layer is used to map the multidimensional space corresponding to the first output feature value to another multidimensional space, and perform a nonlinear transformation on the first output feature value to obtain a second output feature value. The output layer is used to map the second output feature value extracted by the second hidden layer to the final predicted value of water level change.

[0014] The technical advantages of the above solution include: the two hidden layers of the stacked model can extract more complex features from the initial predictions of the base model through nonlinear mapping, thereby improving prediction accuracy. The first hidden layer extracts preliminary features, and the second hidden layer performs nonlinear transformation; this hierarchical structure can better capture the complex patterns of water level changes. The output layer maps the features of the second hidden layer to the final prediction value, ensuring the accuracy and stability of the prediction results.

[0015] Furthermore, the calculation for each layer of the stacked model includes:

[0016]

[0017] In the formula:

[0018] h 1. h 2 and h 3 represents the first output feature value, the second output feature value, and the final predicted water level change value, respectively;

[0019] σ is the ReLU activation function;

[0020] W 1. W 2 and W 3 are the weight matrices for the first hidden layer, the second hidden layer, and the output layer, respectively;

[0021] b 1. b 2 and b 3 represents the bias vectors for the first hidden layer, the second hidden layer, and the output layer, respectively.

[0022] The technical effects of the above-mentioned technical solution include: describing the calculation process of each layer with explicit mathematical formulas to ensure the interpretability and reproducibility of the model; using the ReLU activation function to avoid the gradient vanishing problem and accelerate model training; and further improving the predictive performance of the model through the optimization of the weight matrix and bias vector.

[0023] Furthermore, the stacking model uses mean squared error (MSE) and mean absolute error (MAE) as loss functions.

[0024] Furthermore, the base model includes a first base model based on RNN, comprising two RNN layers and a fully connected layer. The hidden state output by the first RNN layer serves as the input value of the second RNN layer. The first RNN layer has more neurons than the second RNN layer. The fully connected layer is used to convert the output value of the second RNN layer into the final predicted value of water level change, thereby obtaining the initial predicted value of water level change.

[0025] Furthermore, in each of the RNN layers, the first... t The formulas for calculating the output information in a step-by-step RNN include:

[0026] h t =σ ( W h h t-1 + W x x t + b h )

[0027] In the formula:

[0028] h t For time step t The hidden state at the current time step contains all the input information up to the current time step, and is the hidden state output by the first RNN layer. h t As the input value for the second RNN layer;

[0029] W h , W x These are weight matrices, used to connect the hidden state of the previous time step and the input features of the current time step, respectively;

[0030] b h This is a bias used to adjust the input to the activation function;

[0031] x t For the current time step t The input features, i.e., the current time step. t Water level data; h t-1 The previous time step of memory t-1 stores the status information;

[0032] σ is the activation function.

[0033] The technical effects of the above-mentioned solution include: by using two RNN layers and one fully connected layer, the temporal dependence of water level data can be better captured; the first RNN layer has more neurons than the second RNN layer, and this design can progressively compress information and extract more important features; the output of the RNN layer is converted into the initial predicted value of water level change, ensuring that the output of the base model can be effectively utilized by the stacked model.

[0034] Furthermore, the base model includes a second base model based on LSTM, comprising two LSTM layers, wherein the number of neurons in one LSTM layer is half that of the other LSTM layer.

[0035] Furthermore, the formulas for calculating the output information in the LSTM layer include:

[0036]

[0037] In the formula:

[0038] f t Forget gates determine which information is retrieved from the cell state. C t-1 Discarded in the middle;

[0039] The hidden state is the hidden state of the previous time step. The hidden state contains all the input information up to the current time step. For the first time step, it is usually initialized as a zero vector or a random vector.

[0040] Represents water level data at time step t The measured value;

[0041] i t As an input gate, it determines which new information will be stored in the cell state. C t middle;

[0042] O t As an output gate, it determines which information will be taken from the cell state. C t Output from the middle;

[0043] For candidate memories, new candidate values ​​are generated, which may be added to the cell state;

[0044] C tTo update the cell state, used to update the current cell state;

[0045] σ is the sigmoid activation function;

[0046] W f 、W i and W o It is weight;

[0047] b f 、b i and b o These are biases, corresponding to the forget gate, input gate, and output gate, respectively.

[0048] W c These are the weights of the candidate memory units;

[0049] b c It is the bias of candidate memory units.

[0050] Furthermore, the base model includes a third base model based on GRU, comprising two GRU layers and one fully connected layer. The calculation formula for the output information in each GRU layer includes:

[0051]

[0052] In the formula:

[0053] z t To update the gate, used to control the hidden state information of the previous moment. The extent to which it has been transmitted to the current moment;

[0054] r t To reset the door, used to control its previous hidden state. How much information is forgotten;

[0055] This represents the input feature at time step t, i.e., the water level data at the current time step t;

[0056] Candidate memories;

[0057] and These represent the hidden states at the current time step t and the previous time step t-1, respectively.

[0058] W z ,W r , W h This represents the weight matrix used for updating the gate, resetting the gate, and calculating the candidate hidden state. b z , b r , b h These are the corresponding biases;

[0059] tanh This is the hyperbolic tangent activation function, used to generate candidate memories.

[0060] The technical advantages of the above solution include: by using two LSTM layers, it is possible to better capture long-term dependencies in water level data. The number of neurons in one LSTM layer is half that of the other; this design allows for the progressive extraction of more abstract features while reducing computational complexity.

[0061] Furthermore, the multiple base models include: a first base model based on RNN, a second base model based on LSTM, and a third base model based on GRU; each base model contains two layers, and each layer contains a first predetermined number of neurons.

[0062] The technical effects of the above-mentioned technical solution include: through two GRU layers and one fully connected layer, the temporal dependence of water level data can be captured efficiently; the introduction of update gate and reset gate can dynamically control the transmission and forgetting of information, thereby improving the predictive ability of the model; the calculation process of GRU layer is described by explicit mathematical formulas to ensure the interpretability and reproducibility of the model; and the use of tanh activation function to generate candidate memories ensures the nonlinear transformation capability of information.

[0063] Furthermore, each base model uses mean squared error (MSE) and mean absolute error (MAE) as loss functions.

[0064] Furthermore, the system also includes a data preprocessing module for normalizing historical water level data to improve the stability and efficiency of model training.

[0065] The water level prediction method based on a stacked model, which achieves the second objective of this invention, includes:

[0066] Construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for a future time period;

[0067] Construct a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period.

[0068] The base model is trained using historical water level data to obtain each trained base model;

[0069] The stacked model is trained using the initial predicted values ​​of future time periods output by each trained base model as training data to obtain a water level prediction model for predicting water levels in future time periods.

[0070] When training the model, the optimal values ​​of the hyperparameters of each base model or stacked model are determined by using a grid search method. Each base model is evaluated by using cross-validation with a set multiple on the validation set. Training is stopped when the error on the validation set fails to improve over multiple consecutive training epochs.

[0071] A non-transitory computer-readable storage medium for achieving the third objective of the present invention stores a computer program thereon, which, when executed by a processor, implements the steps of the water level prediction method based on the stacked model.

[0072] A computer program product for achieving the fourth objective of the present invention includes a computer program / instruction that, when executed by a processor, implements the steps of the water level prediction method based on the stacked model.

[0073] The beneficial effects of this invention include:

[0074] This invention provides a generalizable water level prediction model framework that integrates the advantages of multiple deep learning-based stacked models. By integrating the advantages of multiple deep learning models, it improves the ability to predict water level changes, provides more reliable scientific support for water conservancy management and water resources planning, and enhances the public service capability and scientific decision-making level of waterway water level prediction and forecasting. Attached Figure Description

[0075] Figure 1 This is a schematic diagram of a stacked model architecture;

[0076] Figures 2 to 5 These are comparison charts showing the water levels predicted at four different stations during the dry season (December to April of the following year) using RNN, GRU, LSTM, and RGL-Stacking stacked models.

[0077] Figure 6 and Figure 7 The mean absolute error (MAE) and root mean square error (RMSE) for predicting water levels at different stations are respectively obtained using RNN, GRU, LSTM, and RGL-Stacking stacked models. Detailed Implementation

[0078] The following detailed embodiments are provided to explain the technical solutions of the claims of this invention, so that those skilled in the art can understand the claims. The scope of protection of this invention is not limited to the following specific embodiments. Any modifications made by those skilled in the art that incorporate the technical solutions of the claims but differ from the following detailed embodiments are also within the scope of protection of this invention.

[0079] This invention provides a water level prediction method based on a stacked model, comprising:

[0080] (1) Data preprocessing

[0081] We used water level data from the Yangtze River basin over the past ten years. The data was cleaned, supplemented, smoothed, and denoised, then normalized to ensure that the values ​​were distributed between 0 and 1, in order to improve the stability and efficiency of model training. The data was then divided into training and test sets.

[0082] (2) Base model construction

[0083] Three base models were constructed, based on RNN, GRU, and LSTM respectively. Each base model contains two layers, with 128 neurons per layer. The Adam optimizer was used, with a learning rate of 0.001, a batch size of 32, and 100 training epochs. (The details are missing from the original text.)

[0084] Base Model 1: The first base model based on RNN; RNN is a basic recurrent neural network model that uses a recurrent structure (hereinafter referred to as memory) to maintain the memory of previous input information. This allows RNN to take into account the temporal order and dependencies of data when processing sequential data, making it suitable for processing short sequence data. A model containing multiple hidden layers was built to capture the temporal characteristics of water level data.

[0085] The first RNN layer in the first base model based on RNNs has a large number of neurons. More neurons mean the model can learn and represent more information, thus enhancing its representational power. The second RNN layer has a smaller number of neurons, which helps to further extract more abstract features from the features extracted in the first layer. Finally, a fully connected layer is added to convert the output of the second RNN layer into the final predicted water level change value. t The formula for calculating the output information in a step-by-step RNN is as follows:

[0086] h t =σ ( W h h t-1 + W xx t + b h )

[0087] in h t For time step t The hidden state at the current time step contains all the input information up to the current time step, and is the hidden state output by the first RNN layer. h t As the input value for the second RNN layer; W h , W x These are weight matrices, used to connect the hidden state of the previous time step and the input features of the current time step, respectively; b h This is a bias used to adjust the input to the activation function; x t For the current time step t The input features, i.e., the current time step. t Water level data; h t-1 The previous time step of memory t -1 stores the state information, and σ is the activation function (using...). tanh (The same applies below).

[0088] Assuming the input sequence has a length of T, after computation through two RNN layers, the hidden state h of the second RNN layer at time step T is obtained. T ;

[0089] The hidden state h of the second RNN layer at time step T T As the input to the fully connected layer, assume the weight matrix of the fully connected layer is... W1 fc , bias is b 1 fc The calculation of the fully connected layer is as follows:

[0090]

[0091] Y predRNN This refers to the water level change value ultimately predicted by the first base model based on RNN.

[0092] Base Model 2: The second base model based on LSTM; LSTM is a recurrent neural network model that performs well when processing long sequence data. It was proposed to solve the vanishing feedback problem in RNNs and can better capture long-range dependencies in sequences. The second base model based on LSTM contains two LSTM layers. The input of the first LSTM layer is the input features at each time step. x t For example, given the water level data at the current time step, the output values ​​are the hidden state and cell state at each time step. The input to the second LSTM layer is the hidden state output by the first LSTM layer, and the output values ​​are the hidden state and cell state. The number of neurons in the second layer is half that of the first layer. Through LSTM layers, the model can effectively learn the temporal features and trends of water level data. The formula for calculating the output information in LSTM is shown below:

[0093]

[0094] in f t Forget gates determine which information is retrieved from the cell state. C t-1 Discarded in the middle; The hidden state is the hidden state of the previous time step. The hidden state contains all the input information up to the current time step. For the first time step, it is usually initialized as a zero vector or a random vector. Represents water level data at time step t The measured value; i t As an input gate, it determines which new information will be stored in the cell state. C t middle; O t As an output gate, it determines which information will be taken from the cell state. C t Output from the middle; For candidate memories, new candidate values ​​are generated, which may be added to the cell state; C t To update the cell state, it is used to update the current cell state; σ is the sigmoid activation function. W f 、W i and W o It's weight. b f 、b i and b o These are biases, corresponding to the forget gate, input gate, and output gate, respectively.W c These are the weights of the candidate memory units; b c It is the bias of candidate memory units.

[0095] After passing through two LSTM layers, the hidden state output by the second LSTM layer is... ( T The last time step of the input sequence is used as the input to the fully connected layer. Assume the weight matrix of the fully connected layer is... W2 fc , bias is b2 fc The calculation of the fully connected layer is as follows:

[0096]

[0097] Y predLSTM This is the final predicted water level change value based on the second base model of LSTM. Through two LSTM layers, the model can effectively learn the temporal characteristics and trends of water level data.

[0098] Base Model 3: The third base model based on GRU; GRU is a recurrent neural network model between RNN and LSTM, which can reduce computational cost while maintaining good performance. Compared with LSTM, GRU eliminates the output gate and sets reset and update gates to jointly control how to calculate the new hidden state from the previous hidden state, which helps the model capture important changing features of water level data. The calculation formula for the output information in GRU is as follows:

[0099]

[0100] Where z t To update the gate, used to control the hidden state information of the previous moment. The extent to which it has been transmitted to the current moment; r t To reset the door, used to control its previous hidden state. How much information is forgotten; This represents the input feature at time step t, i.e., the water level data at the current time step t; Candidate memories; and These represent the hidden states at the current time step t and the previous time step t-1, respectively. W z , W r , W h This represents the weight matrix used for updating the gate, resetting the gate, and calculating the candidate hidden state. bz , b r , b h These are the corresponding biases; tanh This is the hyperbolic tangent activation function, used to generate candidate memories.

[0101] Assuming the input water level data sequence is of length T, after processing by the GRU layer, the hidden state at time step T is obtained. Assume the weight matrix of the fully connected layer is... W3 fc , bias is b3 fc The calculation of the fully connected layer is as follows:

[0102]

[0103] Y predGRU This is the final predicted water level change value based on the third basis model of GRU.

[0104] (3) Model output fusion

[0105] The prediction results Y of the above three base models predRNN y predLSTM y predGRU As meta-features, they are input into a multi-layer feedforward neural network (hereinafter referred to as a stacked model) containing two hidden layers, each containing 64 neurons.

[0106] (4) Stacked model construction and training

[0107] A stacked model is trained using the predictions output by each pre-trained base model as training data. The stacked model is a three-layer multilayer perceptron (MLP) that utilizes the predictions from each base model to perform further learning, thereby enhancing prediction stability and robustness across different sites. The predictions from all base models are then combined into a new feature matrix. X meta As input to the stacking model:

[0108]

[0109] The calculations for each layer of the stacked model are as follows:

[0110]

[0111] The first layer: This is the hidden layer, used to store meta-features. X meta The first output feature value is obtained by inputting the first layer perceptron. h 1, where σ is the ReLU activation function; W1 represents the weight matrix of the first-layer perceptron, with a dimension of 3×64, because the meta-feature has 3 elements; b 1 represents the bias vector of the first-layer perceptron, with a dimension of 64×1.

[0112] The second layer: This is a hidden layer, used to process the first output feature value. h 1. Input the second layer perceptron to calculate the second output feature value. h 2; of which W 2 represents the weight matrix of the second-layer perceptron, with a dimension of 64×64; b 2 is the bias vector of the second-layer perceptron, with a dimension of 64×1.

[0113] The third layer: This is the output layer, used to process the second output feature value. h 2. Input the third-layer perceptron to calculate the final feature value. h final That is, the final water level change value predicted by the stacking model; where W 3 represents the weight matrix of the third-layer perceptron, with a dimension of 64×1; b 3 represents the bias vector of the third-layer perceptron, with a dimension of 1×1.

[0114] For each base model (RNN, GRU, LSTM), the training process includes the following steps:

[0115]

[0116] Finally, stack the models. M meta use X meta As input, Y final (that is, the aforementioned) h final As the final output of the stacked model:

[0117]

[0118] Both the base model and the stacked model use the Corrected Linear Unit (RELU) as the activation function. RELU is known for its computational efficiency and ability to mitigate the vanishing gradient problem, thereby improving the training efficiency and overall performance of the model.

[0119] An early stopping mechanism was implemented throughout the training process to prevent overfitting. Training stopped if the error on the validation set failed to show improvement over five consecutive training epochs. This strategy is crucial for maintaining the model's performance on the validation set and ensuring it does not degrade due to overtraining.

[0120] To determine the most efficient hyperparameter configuration for each base model and the stacked models, a grid search method was employed to explore optimal combinations of hyperparameters across different sites. This involved defining a set of potential hyperparameters, including the learning rate, number of neurons, and batch size. We then evaluated the power of each model configuration by employing up to 5x cross-validation on the validation set. This meticulous examination under different hyperparameters significantly contributes to optimizing the robustness of the models and their predictive accuracy, ensuring that we fully utilize the models' potential to improve performance.

[0121] In the embodiments of the present invention, each base model and the stacked model use mean squared error (MSE) and mean absolute error (MAE) as loss functions to control error and optimize model parameters.

[0122] Mean Absolute Error (MAE):

[0123]

[0124] Where T is the number of time steps in the test set. It is the predicted value output by the model. x t This is the actual value.

[0125] Root Mean Square Error (RMSE):

[0126]

[0127] (5) Water level prediction

[0128] A pre-trained stacked model is used as a water level prediction model to predict water level changes. This model is then used to predict water level changes over future time periods. The prediction results are compared with the actual water levels on a test set to evaluate the predictive performance of the water level prediction model.

[0129] Let the water level time series data be { x t},in t = 1, 2, ..., T, where T is the length of the time series. The prediction results of the base model can be expressed as:

[0130]

[0131] in, n The time lag step considered for the model, f RNN , f GRU and f LSTMLet represent the prediction functions of the first model based on RNN, the second model based on LSTM, and the third model based on GRU, respectively.

[0132] The meta-features of the stacked model are the set of predictions from the base models:

[0133]

[0134] The stacked model can be represented as:

[0135]

[0136] in, g ( X t () represents the prediction function of the stacked model, which takes the prediction results of the base model as input and outputs the final water level prediction value. .

[0137] from Figures 2 to 5 As can be seen, the accuracy of the water level change values ​​predicted by the water level prediction model based on the RGL-Stacking model described in this invention during the dry season at four different stations is the highest compared to using RNN, GRU, or LSTM alone. Meanwhile, from... Figure 6 and Figure 7 It can also be seen that the water level prediction model based on the stacking model (RGL(RNN-GRU-LSTM)-Stacking) described in this invention has the lowest mean absolute error (MAE) and root mean square error (RMSE) compared to models that use RNN, GRU, and LSTM alone.

[0138] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0139] This invention also provides a water level prediction system based on a stacked model, comprising:

[0140] Base model construction module: used to construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for future time periods;

[0141] Stacked model building module: used to build a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period.

[0142] Base model training module: used to train the base model using historical water level data to obtain each trained base model;

[0143] Stacked model training module: used to train the stacked model using the initial predicted values ​​of the future time period output by each trained base model as training data, to obtain a water level prediction model for predicting water levels in the future time period.

[0144] Water level prediction module: used to predict water level changes over future time periods using the water level prediction model.

[0145] When training the model, the optimal values ​​of the hyperparameters of each base model or stacked model are determined using a grid search method. Each base model is evaluated by using 5x cross-validation on the validation set. Training is stopped when the error on the validation set fails to improve over multiple consecutive training epochs.

[0146] In some embodiments, the stacked model includes two hidden layers and an output layer. Each hidden layer contains multiple neurons. The first hidden layer is used to map the initial predicted value of water level change output by each base model to a multidimensional space, thereby extracting preliminary features from the initial predicted value of water level change output by each base model to obtain a first output feature value. The second hidden layer is used to map the multidimensional space corresponding to the first output feature value to another multidimensional space, and perform a nonlinear transformation on the first output feature value to obtain a second output feature value. The output layer is used to map the second output feature value extracted by the second hidden layer to the final predicted value of water level change.

[0147] In some embodiments, the calculation of each layer of the stacked model includes:

[0148]

[0149] In the formula:

[0150] h 1. h 2 and h 3 represents the first output characteristic value, the second output characteristic value, and the final predicted water level change value, respectively;

[0151] σ is the ReLU activation function;

[0152] W 1. W 2 and W 3 are the weight matrices for the first hidden layer, the second hidden layer, and the output layer, respectively;

[0153] b 1. b 2 and b 3 represents the bias vectors for the first hidden layer, the second hidden layer, and the output layer, respectively.

[0154] In some embodiments, the base model includes a first base model based on RNN, comprising two RNN layers and a fully connected layer, wherein the hidden state output by the first RNN layer is used as the input value of the second RNN layer; the first RNN layer has more neurons than the second RNN layer; the fully connected layer is used to convert the output value of the second RNN layer into the final predicted value of water level change, thereby obtaining the initial predicted value of water level change.

[0155] In some embodiments, the base model includes a second base model based on LSTM, comprising two LSTM layers, wherein the number of neurons in one LSTM layer is half that of the other LSTM layer.

[0156] In some embodiments, the base model includes a third base model based on GRU, comprising two GRU layers and a fully connected layer, wherein the formula for calculating the output information in each GRU layer includes:

[0157]

[0158] In the formula:

[0159] z t To update the gate, used to control the hidden state information of the previous moment. The extent to which it has been transmitted to the current moment;

[0160] r t To reset the door, used to control its previous hidden state. How much information is forgotten;

[0161] This represents the input feature at time step t, i.e., the water level data at the current time step t;

[0162] Candidate memories;

[0163] and These represent the hidden states at the current time step t and the previous time step t-1, respectively.

[0164] W z , W r and W h This represents the weight matrix used for updating the gate, resetting the gate, and calculating the candidate hidden state. b z , b r and b hThese are the corresponding biases;

[0165] tanh This is the hyperbolic tangent activation function, used to generate candidate memories.

[0166] In some embodiments, the plurality of base models include: a first base model based on RNN, a second base model based on LSTM, and a third base model based on GRU; each base model contains two layers, and each layer contains a first predetermined number of neurons.

[0167] This invention also provides a stacked model-based water level prediction method that employs the aforementioned stacked model-based water level prediction method, comprising:

[0168] Construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for a future time period;

[0169] Construct a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period.

[0170] The base model is trained using historical water level data to obtain each trained base model;

[0171] The stacked model is trained using the initial predicted values ​​of future time periods output by each trained base model as training data to obtain a water level prediction model for predicting water levels in future time periods.

[0172] The water level prediction model is used to predict water level changes over future periods.

[0173] When training the model, the optimal values ​​of the hyperparameters of each base model or stacked model are determined using a grid search method. Each base model is evaluated by using 5x cross-validation on the validation set. Training is stopped when the error on the validation set fails to improve over multiple consecutive training epochs.

[0174] This invention also provides a non-transitory computer-readable storage medium storing a computer program. The computer program includes program instructions that, when executed by a processor, implement the various steps of the method described in this invention, which will not be elaborated further here.

[0175] The computer-readable storage medium can be the data transmission apparatus or the internal storage unit of a computer device provided in any of the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium can also be the external storage device of the computer device, such as the plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on the computer device.

[0176] Furthermore, the computer-readable storage medium may include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that is to be output or has already been output.

[0177] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0178] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0179] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0180] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0181] This invention also provides a computer program product, including a computer program / instructions, characterized in that the computer program / instructions, when executed by a processor, implement the steps of the water level prediction method based on the stacked model.

[0182] The contents not described in detail in this specification are existing technologies known to those skilled in the art.

Claims

1. A water level prediction system based on a stacked model, characterized in that, include: Base model construction module: used to construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for future time periods; Stacked model building module: used to build a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period. The stacked model includes two hidden layers and one output layer. Each hidden layer contains multiple neurons. The first hidden layer is used to map the initial predicted value of water level change output by each base model to a multidimensional space, thereby extracting preliminary features from the initial predicted value of water level change output by each base model to obtain the first output feature value. The second hidden layer is used to map the multidimensional space corresponding to the first output feature value to another multidimensional space, and to perform a nonlinear transformation on the first output feature value to obtain the second output feature value; the output layer is used to map the second output feature value extracted by the second hidden layer to the final water level change prediction value. Base model training module: used to train the base model using historical water level data to obtain each trained base model; The multiple base models include: a first base model based on RNN, a second base model based on LSTM, and a third base model based on GRU; each base model contains two layers, and each layer contains a first predetermined number of neurons; The first base model based on RNN includes two RNN layers and a fully connected layer. The hidden state output by the first RNN layer is used as the input value of the second RNN layer. The number of neurons in the first RNN layer is greater than the number of neurons in the second RNN layer. The fully connected layer is used to convert the output value of the second RNN layer into the final predicted value of water level change, thus obtaining the initial predicted value of water level change. The GRU-based third base model includes two GRU layers and one fully connected layer; Stacked model training module: used to train the stacked model using the initial predicted values ​​of the future time period output by each trained base model as training data, to obtain a water level prediction model for predicting water levels in the future time period. Water level prediction module: used to predict water level changes in the future time period using the water level prediction model.

2. The water level prediction system based on a stacked model as described in claim 1, characterized in that, The calculations for each layer of the stacked model include: h 1 =σ ( W 1 X meta +b 1) h 2 =σ ( W 2 h 1 +b 2) h final =W 3 h 2 +b 3 In the formula: h 1. h 2 and h 3 represents the first output characteristic value, the second output characteristic value, and the final predicted water level change value, respectively; σ is the ReLU activation function; W 1. W 2 and W 3 are the weight matrices for the first hidden layer, the second hidden layer, and the output layer, respectively; b 1. b 2 and b 3 are the bias vectors for the first hidden layer, the second hidden layer, and the output layer, respectively; X meta The feature matrix consists of the prediction results of all base models.

3. The water level prediction system based on a stacked model as described in claim 1, characterized in that, The formulas for calculating the output information in each GRU layer include: ; In the formula: z t To update the gate, used to control the hidden state information of the previous moment. The extent to which it has been transmitted to the current moment; r t To reset the door, used to control its previous hidden state. How much information is forgotten; This represents the input feature at time step t, i.e., the water level data at the current time step t; Candidate memories; and These represent the hidden states at the current time step t and the previous time step t-1, respectively. W z , W r , W h This represents the weight matrix used for updating the gate, resetting the gate, and calculating the candidate hidden state. b z , b r , b h These are the corresponding biases; tanh This is the hyperbolic tangent activation function, used to generate candidate memories.

4. The water level prediction method based on a stacked model using the system described in claim 1, characterized in that, include: Construct multiple base models for predicting water level changes; the input data for each base model is historical water level data, and the output data is the initial predicted value of water level changes for a future time period; Construct a stacked model for predicting water level changes; the input data of the stacked model is the initial predicted value of water level changes for a future time period output by each base model, and the output value is the final predicted value of water level changes for a future time period. The base model is trained using historical water level data to obtain each trained base model; The stacked model is trained using the initial predicted values ​​of future time periods output by each trained base model as training data. After training, a water level prediction model for predicting water levels in future time periods is obtained. The water level prediction model is used to predict water level changes over future periods.

5. A non-transitory 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 water level prediction method based on the stacked model as described in claim 4.

6. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the water level prediction method based on the stacked model as described in claim 4.

Citation Information

Patent Citations

  • Intelligent water level prediction method based on recurrent neural network and convolutional neural network

    CN111242344A

  • Water flooded waterwheel chamber early warning method and system based on knowledge graph

    CN111736636A