Reservoir water level prediction method and medium based on neural network and uncertainty perception
By using multi-scale decomposition and uncertainty perception through hybrid expert networks, the accuracy and robustness issues of traditional water level prediction methods in the face of complex dynamic systems are solved, achieving high-precision and adaptive water level prediction.
Patent Information
- Application Number
- CN202511369385.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2045-09-24
AI Technical Summary
Traditional reservoir water level prediction methods struggle to capture deep nonlinear relationships, cannot distinguish between different operating modes, and exhibit reduced generalization ability when faced with unprecedented extreme conditions, posing a risk of catastrophic prediction errors.
Multiple feature subsequences are generated using multi-scale decomposition technology. Unsupervised clustering and anomaly detection algorithms are combined to determine the macroscopic operating status label. A hybrid expert network is constructed to perform uncertainty perception weight regulation. The final water level prediction value is obtained through end-to-end optimization.
It improves the accuracy and adaptability of water level prediction, enabling high-precision prediction under normal conditions and making conservative decisions when facing unknown patterns to avoid catastrophic errors, thus enhancing the robustness and safety of the model.
Smart Images

Figure CN120851400B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of hydrological forecasting and artificial intelligence technology, specifically to a method and medium for predicting reservoir water levels based on neural networks and uncertainty perception. Background Technology
[0002] Accurate water level prediction for large-scale water conservancy projects such as reservoirs and dams plays an irreplaceable core role in flood control scheduling, power generation planning, navigation safety, and optimal allocation of water resources. However, the operation of a reservoir system is an extremely complex dynamic process, with strong nonlinearity, time-varying characteristics, and multi-timescale coupling between its input data (such as inflow and outflow) and output data (such as upstream and downstream water levels).
[0003] Traditional prediction methods, such as statistical models (ARIMA, etc.), struggle to capture deep nonlinear relationships. While conventional deep learning models, such as single Long Short-Term Memory (LSTM) networks, improve prediction accuracy to some extent, their inherent "black box" nature and static structure result in two fundamental drawbacks: First, they typically treat the entire prediction cycle as a single, homogeneous process, failing to effectively differentiate and adapt to the drastically different dynamic response patterns of the system under different operating modes (such as water storage during the flood season versus power generation during the dry season). Second, when the system encounters rare or extreme conditions not fully represented in the training data (i.e., out-of-distribution data), the generalization ability of these models drops sharply, potentially leading to catastrophic erroneous predictions that deviate significantly from reality, posing a significant threat to the safe operation of reservoirs.
[0004] In recent years, hybrid expert (MoE) models have been introduced to address changing system states. However, traditional gating mechanisms often "blindly" delegate decision-making power to a single expert when faced with unknown or ambiguous inputs. If that expert lacks the necessary processing capabilities, the risk of prediction failure remains high. Therefore, existing technologies urgently need a novel approach that can not only handle complex dynamics under normal conditions with fine precision, but more importantly, must possess the ability to make conservative decisions when facing highly uncertain or unknown patterns, ensuring the reliability and robustness of prediction results across all scenarios. Summary of the Invention
[0005] The present invention proposes a reservoir water level prediction method and medium based on neural networks and uncertainty perception, which can at least solve one of the technical problems in the background art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A reservoir water level prediction method based on neural networks and uncertainty perception performs the following steps using computer equipment:
[0008] S100. Collect multivariate hydrological sequence data and apply multi-scale decomposition technology to generate multiple feature subsequences representing different time frequencies.
[0009] S200: Process multivariate hydrological time series data through unsupervised clustering and anomaly detection algorithms to determine macro-operational status labels and calculate quantitative anomaly scores;
[0010] S300, Construct a hybrid expert network to process the feature subsequences and macroscopic operating status labels of step S100;
[0011] S400, uncertainty perception weight regulation based on hybrid expert network and quantified anomaly score;
[0012] S500 predicts and integrates the results of uncertainty-perceived weight control and end-to-end optimization to obtain the final water level prediction value.
[0013] Furthermore, the feature subsequence generation method in step S100 of the present invention includes:
[0014] S110. Obtain and define the raw data;
[0015] S120. Select the wavelet mother function and the number of decomposition levels to preprocess the original data;
[0016] S130. Reconstruct the feature subsequences from the preprocessed data;
[0017] The raw data preprocessing methods include: processing the time series of each raw hydrological variable. Independent implementation Discrete wavelet transform of the layer;
[0018] For any original hydrological variable sequence After the first level of decomposition, an approximate component coefficient vector is obtained. and a detail component coefficient vector The calculation process can be represented by the following formula:
[0019]
[0020]
[0021] in, It is related to the wavelet mother function Associated low-pass filter, It is related to the wavelet mother function Associated high-pass filter, This represents the convolution operation. Indicates a downsampling operation;
[0022] The obtained approximate component coefficients As new input, the above process is repeated to perform a second-level decomposition, resulting in... and ;
[0023] go through After stratification, for each original hydrological variable sequence We obtain a set of wavelet coefficients, denoted as :
[0024]
[0025] in, It is the first The approximate component coefficients of the layer represent the lowest frequency trend portion of the signal. It is the first The detail component coefficients of a layer represent the high-frequency fluctuations of the signal at different scales. .
[0026] Furthermore, the feature subsequence reconstruction method in step S130 of the present invention includes:
[0027] Construct a temporary set of coefficients Only the first The detail factor of the layer is preserved;
[0028] right implement Layered inverse discrete wavelet transform:
[0029]
[0030] Similarly, for the first Reconstructed feature subsequences of layer approximate components The calculation process is as follows:
[0031] Construct a temporary set of coefficients Only the first one The approximation coefficients of the layers are preserved;
[0032] right implement Layered inverse discrete wavelet transform:
[0033]
[0034] Through the above steps, each variable All are decomposed into a containing A set of feature subsequences :
[0035]
[0036] Ultimately, all The decomposition results of each variable are concatenated to form a dimension of . Multiscale feature matrix
[0037] .
[0038] Furthermore, the method for determining the macroscopic operating status label in step S200 of the present invention includes:
[0039] Set the number of states A data point Belongs to the The probability density function of Gaussian components is defined as follows:
[0040]
[0041] in, It is the first The mean vector of Gaussian components; It is the first The covariance matrix of Gaussian components;
[0042] The probability density function of the entire mixture model is the weighted sum of all components:
[0043]
[0044] in, It is the first The mixing coefficients of the components satisfy the following conditions: and ;
[0045] Apply the expectation-maximization algorithm to the dataset Train the model and estimate its parameters. ;
[0046] After training is completed, for each time point Data The state label is determined by calculating the posterior probability of a state belonging to each state and assigning it to the state with the highest posterior probability. :
[0047]
[0048] in, Data points Belongs to the The posterior probability of each state;
[0049] Finally, a length of is generated. State label vector .
[0050] Furthermore, the method for calculating the quantified anomaly score in step S200 of the present invention includes:
[0051] Construct a forest containing multiple isolated trees; during the construction of each tree, recursively partition the data by randomly selecting a feature and a random split point within the range of that feature, until each data point is completely isolated;
[0052] For each data point Its path length in a single isolated tree Defined as the number of splits required to get from the root node to the leaf node containing the data point;
[0053] Throughout the forest Take the average value to obtain the desired path length. ;
[0054] Ultimately, data points abnormal scores Normalization calculation is performed using the following formula:
[0055]
[0056] in, This is the number of samples used to train the isolated forest. It has The average path length of the binary search tree with nodes is used to standardize the result, and its calculation formula is as follows:
[0057] ,in It is the harmonic number;
[0058] Finally, a length of is generated. abnormal score vector .
[0059] Furthermore, the hybrid expert network construction method in step S300 of the present invention includes:
[0060] S310, Define the expert subnetwork;
[0061] Based on the number of states determined in step S220 , build A separate expert subnetwork, denoted as ;
[0062] expert The input is the multi-scale feature matrix generated in step S130. A slice of a time window;
[0063] For any point in time The input sequence used to predict the next time step is denoted as... ,in It is the preset time step.
[0064] The input sequence is defined as:
[0065]
[0066] expert At any moment The output is a scalar , representing its independent prediction of the target variable at the next time step; its functional relationship can be expressed as:
[0067]
[0068] in, Representative expert network All trainable parameters;
[0069] S320, Define the gated network;
[0070] Build a gated network Based on the current system status, for each expert Assign a weight;
[0071] Gated Networks The input is defined in step S210, at time... Standardized raw hydrological data vector ;
[0072] The output of the gating network is A dimensional vector, denoted as It represents the gating network's initial preference for each expert, and its output layer is a linear activation function;
[0073] Its functional relationship can be expressed as:
[0074]
[0075] in, Representative gating network All trainable parameters.
[0076] Furthermore, the fusion prediction method in step S500 of the present invention includes:
[0077] S510. The independent predicted values generated by the expert subnetwork are weighted and summed with the dynamic weight vector of uncertainty perception to obtain the system predicted value.
[0078] For any time All of S310 Independent predictions generated by each expert subnetwork The uncertainty-aware dynamic weight vector generated in S430 A weighted sum is then performed to obtain the final, single system prediction. ;
[0079] The fusion process can be represented by the following formula:
[0080]
[0081] in, It is the first An expert on the moment The predicted value, At any moment Assigned to the Weights adjusted for uncertainty by an individual expert;
[0082] S520. Define the loss function and calculate the prediction error of the system's predicted values;
[0083] For time The predicted value, its loss function Defined as the final predicted value Compared with the actual observed value The square of the difference between them:
[0084]
[0085] in, The target variable at time t is The true value;
[0086] S530: Optimize the system prediction values end-to-end to obtain the final prediction values;
[0087] The optimization objective is expressed as:
[0088]
[0089] in, It is the total number of training samples. These are the parameters of the expert subnetwork. These are the parameters of the gating network.
[0090] In another aspect, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method described above.
[0091] As can be seen from the above technical solution, the present invention achieves significant beneficial effects through a systematic and multi-layered innovative architecture, with a significant improvement in accuracy: through multi-scale feature decomposition and specialized expert networks, the present invention can capture the dynamic laws of hydrological systems at different time scales in detail, and its prediction accuracy is higher under normal conditions compared with a single model; strong adaptability: by using unsupervised learning to automatically identify the macroscopic operating state of the system and drive the hybrid expert architecture to make adaptive decisions, it effectively overcomes the limitations of traditional models when facing time-varying system dynamics. Attached Figure Description
[0092] Figure 1 This is a schematic diagram of the water level prediction method based on neural networks and uncertainty perception of the present invention.
[0093] Figure 2 This is a graph of the original multivariate hydrological time series data in an embodiment of the present invention;
[0094] Figure 3 This is a graph showing the dynamic weight changes of the uncertainty-aware gating network on the test set for each expert subnetwork in this embodiment of the invention.
[0095] Figure 4 This is a comparison chart of the final prediction result of the model for the upstream water level on the test set and the actual observed value in an embodiment of the present invention. Detailed Implementation
[0096] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0097] like Figure 1 As shown, the reservoir water level prediction method and system based on neural networks and uncertainty perception described in this embodiment executes the following steps using computer equipment:
[0098] S100. Collect multivariate hydrological sequence data and apply multi-scale decomposition technology to generate multiple feature subsequences representing different time frequencies.
[0099] S200: Process multivariate hydrological time series data through unsupervised clustering and anomaly detection algorithms to determine macro-operational status labels and calculate quantitative anomaly scores;
[0100] S300, Construct a hybrid expert network to process the feature subsequences and macroscopic operating status labels of step S100;
[0101] S400, uncertainty perception weight regulation based on hybrid expert network and quantified anomaly score;
[0102] S500 predicts and integrates the results of uncertainty-perceived weight control and end-to-end optimization to obtain the final water level prediction value.
[0103] The following provides a detailed explanation of each step:
[0104] S100. Collect multivariate hydrological time series data and apply multi-scale decomposition technology to generate multiple feature subsequences representing different time frequencies.
[0105] Methods for generating feature subsequences include:
[0106] S110. Obtain and define the raw data;
[0107] First, obtain and define a hydrological time series dataset containing multiple variables, denoted as . The dataset is a matrix with dimensions [missing information]. ,in It is the number of observation points in the time series. It refers to the quantity of hydrological variables, where the time series of hydrological variables is as follows: Figure 2 As shown.
[0108]
[0109] in, Represents a discrete time step. Indexes representing hydrological variables. Corresponding to the upstream water level, Corresponding to the downstream water level, Corresponding inbound flow Corresponding outbound flow. Representing the Hydrological variables over time The observed values. For ease of description, we denote the complete time series of a variable as a vector. .
[0110] S120. Select the wavelet mother function and the number of decomposition levels to preprocess the original data;
[0111] To perform multi-scale decomposition, a mother wavelet needs to be selected in advance. and a decomposition level In this embodiment, the Daubechies wavelets are preferably selected. Wavelets, due to their good compact support and smoothness, have a high degree of decomposition level. The choice of scale determines the fineness of the time series decomposition. The higher the value, the more low-frequency components can be separated. In this embodiment, the number of decomposition layers is set. .
[0112] The implementation of Discrete Wavelet Transform (DWT) is performed on each original hydrological variable sequence. (a length of (vector) implemented independently Discrete Wavelet Transform (DWT) of layers. DWT decomposes the signal by performing layer-by-layer convolution and downsampling on the signal using a set of high-pass and low-pass filters.
[0113] For any original hydrological variable sequence After the first level of decomposition, an approximate component coefficient vector is obtained. and a detail component coefficient vector The calculation process can be expressed by the following formula:
[0114]
[0115]
[0116] in, It is related to the wavelet mother function Associated low-pass filter, It is related to the wavelet mother function Associated high-pass filter, This represents the convolution operation. This indicates a downsampling operation (i.e., taking a value every other point) that makes the length of the coefficient vector approximately half that of the original sequence.
[0117] Subsequently, the obtained approximate component coefficients As new input, the above process is repeated to perform a second-level decomposition, resulting in... and This process is repeated. Second-rate.
[0118] go through After stratification, for each original hydrological variable sequence We obtain a set of wavelet coefficients, denoted as :
[0119]
[0120] in, It is the first The component coefficients of a layer represent the lowest frequency trend portion of the signal. It is the first The component coefficients of a layer represent the high-frequency fluctuations of the signal at different scales. .
[0121] S130. Reconstruct the feature subsequences from the preprocessed data;
[0122] In order to use the decomposed wavelet coefficients as input to the subsequent neural network, they need to be reconstructed to a length equal to that of the original sequence. Consistent feature subsequences. This is achieved by performing an inverse discrete wavelet transform (Inverse DWT, IDWT) on each set of coefficients, but in each reconstruction, only one set of coefficients is retained as the original value, while all other coefficients are set to zero.
[0123] For variables The Layer detail component ( ), its reconstructed feature subsequence The calculation process is as follows:
[0124] (1) Construct a temporary set of coefficients Only the first one The detail factor of the layer is preserved.
[0125] (2) To implement Layered inverse discrete wavelet transform:
[0126]
[0127] Similarly, for the first Reconstructed feature subsequences of layer approximate components The calculation process is as follows:
[0128] (1) Construct a temporary set of coefficients Only the first one The approximation coefficients of the layers are preserved.
[0129] (2) To implement Layered inverse discrete wavelet transform:
[0130]
[0131] Through the above steps, each original variable All were successfully decomposed into a containing A set of feature subsequences :
[0132]
[0133] Ultimately, all The decomposition results of each variable are concatenated to form a dimension. Multiscale feature matrix This matrix will serve as the input to the expert subnetwork in subsequent steps.
[0134]
[0135] This step effectively separates information from different time scales mixed in the original data, enabling the model to learn long-term trends and short-term fluctuations more effectively in subsequent steps.
[0136] S200: Process multivariate hydrological time series data through unsupervised clustering and anomaly detection algorithms to determine macro-operational status labels and calculate quantitative anomaly scores;
[0137] By applying unsupervised clustering and anomaly detection algorithms in parallel, a macroscopic operational status label is determined for each data point in time, and a quantified anomaly score is calculated.
[0138] S210. Preprocess the feature subsequence of the input data for state analysis;
[0139] The analysis object in this step is the preprocessed original multivariate hydrological time series matrix defined in step S110. To eliminate the influence of different dimensions between variables and to ensure the stability and performance of subsequent algorithms, it is first necessary to optimize the matrix. Standardize the process.
[0140] for Each feature column (i.e., variable) in the dataset. Its standardized feature columns Each element in Calculate using the following formula:
[0141]
[0142] in, It is a feature column The mean, It is a feature column The standard deviation.
[0143] This operation yields a standardized data matrix. The matrix has a mean of 0 and a standard deviation of 1 for each of its feature columns. This will serve as input for subsequent state identification and anomaly calculation.
[0144] S220. Macroscopic state identification is performed on the preprocessed data using a Gaussian mixture model (GMM).
[0145] This step aims to standardize the dataset. Automatically divided into A potential macroscopic operating state with different statistical characteristics.
[0146] Set the number of states The Gaussian mixture model assumes that all data points are generated by... It is generated by a mixture of different multivariate Gaussian distributions.
[0147] A data point Belongs to the The probability density function of Gaussian components is defined as follows:
[0148]
[0149] in, It is the first The mean vector of Gaussian components. It is the first The covariance matrix of Gaussian components.
[0150] The probability density function of the entire mixture model is a weighted sum of all components:
[0151]
[0152] in, It is the first The mixing coefficients of the components satisfy the following conditions: and .
[0153] The dataset was analyzed by applying the Expectation-Maximization (EM) algorithm. Train the model to estimate its parameters. After training is completed, for each time point... Data The state label is determined by calculating the posterior probability of a state belonging to each state and assigning it to the state with the highest posterior probability. :
[0154]
[0155] in, Data points Belongs to the The posterior probabilities of each state are calculated. Finally, a sequence of length [length missing] is generated. State label vector .
[0156] S230. Anomaly quantification using Isolation Forest;
[0157] This step is executed in parallel with step S220. Its purpose is to calculate an anomaly score for each data point. This score does not depend on the state partition and only measures the degree of its isolation in the data space.
[0158] The basic idea of Isolation Forest is that outliers are usually more likely to be isolated than normal points due to their "rarity and difference" characteristics.
[0159] The algorithm constructs a forest containing multiple isolation trees (iTrees). During the construction of each tree, the data is recursively partitioned by randomly selecting a feature and a random split point within that feature range until each data point is completely isolated.
[0160] For each data point Its path length in a single isolated tree Defined as the number of splits required to get from the root node to the leaf node containing the data point.
[0161] Throughout the forest Take the average value to obtain the desired path length. Ultimately, the data points abnormal scores Normalization calculation is performed using the following formula:
[0162]
[0163] in, This is the number of samples used to train the isolated forest. It has The average path length of the binary search tree with n nodes is used to standardize the result, and its calculation formula is: ,in It is the harmonic number.
[0164] Abnormal scores The value range is (0, 1]. A score close to 1 indicates that the point has a high probability of being an outlier; a score much less than 0.5 indicates that the point is normal. Finally, a value of length [value missing] is generated. abnormal score vector .
[0165] The output of this step is two vectors that correspond one-to-one with the time steps of the original data: a state label vector. and abnormal score vector These two types of information comprehensively characterize the system state from two orthogonal dimensions: macroscopic operating mode and microscopic data rarity. They serve as key inputs to the uncertainty perception gating mechanism in the subsequent step S400, guiding the dynamic decision-making process of the entire hybrid expert network. Table 1 shows the interpretation of the physical state corresponding to each expert in the model.
[0166] Table 1: Physical states corresponding to each expert in the model
[0167]
[0168] S300, Construct a hybrid expert network to process the feature subsequences and macroscopic operating status labels of step S100;
[0169] Construct a hybrid expert (MoE) neural network architecture that includes multiple parallel expert sub-networks and a gated network, wherein the expert sub-networks are recurrent neural networks used to process the feature sub-sequences of step S100.
[0170] S310, Expert Sub-Networks Definition,
[0171] Based on the number of states determined in step S220 , build A separate expert subnetwork, denoted as Every expert They were all designed as independent predictive models, specifically designed to learn and process the first... The dynamic laws governing a macroscopic operating state.
[0172] Each expert Long Short-Term Memory (LSTM) networks are preferred because they are good at handling long-term dependencies in time series data.
[0173] expert The input is the multi-scale feature matrix generated in step S130. A slice of a time window. Specifically, for any point in time... The input sequence used to predict the next time step is denoted as... ,in This is the preset time step. The input sequence is defined as follows:
[0174]
[0175] expert At any moment The output is a scalar , representing its independent prediction of the target variable at the next time step. Its functional relationship can be expressed as:
[0176]
[0177] in, Representative expert network All trainable parameters (such as weights and biases).
[0178] S320. Define a gating network and construct the gating network. ,
[0179] Its function is to provide each expert with information based on the current system state. Assign a weight.
[0180] Gated Networks The input is defined in step S210, at time... Standardized raw hydrological data vector .
[0181] The output of the gating network is A dimensional vector, denoted as This vector is called the raw score or logits. It represents the gating network's initial bias towards each expert, and its output layer is a linear activation function. Its functional relationship can be expressed as:
[0182]
[0183] in, Representative gating network All trainable parameters.
[0184] This step defines and constructs the core computational architecture of the entire prediction system, namely a hybrid expert model consisting of multiple parallel expert sub-networks and a gating network. This architecture provides the foundation for implementing uncertainty-aware weight allocation in subsequent step S400 and end-to-end optimization in step S5.
[0185] S400, uncertainty perception weight regulation based on hybrid expert network and quantified anomaly score;
[0186] A weight control mechanism is implemented in the gated network, wherein the anomaly score calculated in step S200 is used to dynamically adjust the temperature parameter of a Softmax function to generate a set of expert weights controlled by uncertainty.
[0187] S410, Acquisition and standardization of uncertainty measures;
[0188] This step directly utilizes the value calculated in step S230 at time [time]. abnormal scores As a measure of system uncertainty, to ensure a uniform scale for this measure and facilitate subsequent calculation of temperature parameters, the entire anomaly fraction vector is first analyzed. Range scaling is performed, specifically Min-Max Normalization, to map its value range to the corresponding interval.
[0189] For any time Normalized outlier scores The calculation formula is as follows:
[0190]
[0191] in, It is the entire abnormal score vector The minimum value in. It is the entire abnormal score vector The maximum value in.
[0192] This step yields a standardized measure of uncertainty. A value close to 0 indicates a normal state, while a value close to 1 indicates a highly abnormal state.
[0193] S420. Calculate dynamic temperature based on standardized uncertainty metrics;
[0194] Define a dynamic temperature parameter. Its value is determined by a standardized measure of uncertainty. Linear decision-making. This design allows the model's decision "temperature" to respond in real time to the degree of anomaly in the system state.
[0195]
[0196] in This is a preset hyperparameter, greater than 0, called the sensitivity coefficient. This coefficient controls the strength of the temperature response to uncertainty. Based on this formula:
[0197] (1) When the system is in a normal state, ,but .
[0198] (2) When the system enters an abnormal state, ,but It will be significantly greater than 1.
[0199] S430. Apply the dynamic temperature Softmax function to process dynamic temperature data and obtain the expert weight vector.
[0200] The logits vector output by the gated network in step S320 Apply a dynamic temperature A modulated Softmax function is used to calculate the final, uncertainty-adjusted expert weight vector. .
[0201] vector The first in element The calculation formula is:
[0202]
[0203] This formula works by dividing each logit value by the temperature parameter. To scale it. When the temperature As the value increases, the differences between all logits are reduced, resulting in a smoother and more uniform probability distribution output by the Softmax function, as shown in the following effect. Figure 3 As shown. This mechanism forces the model to avoid overconfident weighting of any single expert (e.g., close to 1.0) when it perceives high uncertainty.
[0204] The final output of this step is a dynamic, uncertainty-aware weight vector. This vector not only reflects the gating network's judgment of the current state, but more importantly, its confidence level has been structurally calibrated for the degree of system anomaly, providing a foundation for robust prediction fusion in the subsequent step S5.
[0205] S500: Based on the uncertainty perception weight control results, predictive fusion and end-to-end optimization are performed to obtain the final water level prediction value;
[0206] Based on the dynamic weights generated in step S400, the outputs of each expert subnetwork are weighted and fused to obtain the final predicted value. The entire hybrid expert network is then trained end-to-end by minimizing the difference between the predicted value and the observed value.
[0207] The prediction fusion method is as follows:
[0208] S510. The independent predicted values generated by the sub-network are weighted and summed with the uncertainty-aware dynamic weight vector to obtain the system predicted value.
[0209] For any time This step will include all the steps in step S310. Independent predictions generated by each expert subnetwork The uncertainty-aware dynamic weight vector generated in step S430 A weighted sum is then performed to obtain the final, single system prediction. .
[0210] The weighted summation process can be expressed by the following formula:
[0211]
[0212] in, It is the first An expert on the moment The predicted value, At any moment Assigned to the Weights adjusted for uncertainty by an expert.
[0213] In this way, the final prediction result integrates the "opinions" of all experts, and the importance of each "opinion" has been dynamically weighted by a gating mechanism that can sense the uncertainty of the system.
[0214] S520. Define the loss function and calculate the prediction error of the system's predicted values;
[0215] To train and optimize the entire hybrid expert network, a loss function needs to be defined. This is used to quantify the prediction error of the model at a specific time point. In this embodiment, mean squared error (MSE) is preferably used as the loss function.
[0216] For a single sample (i.e. at time 1) (predictions), its losses Defined as the final predicted value Compared with the actual observed value The square of the difference between them:
[0217]
[0218] in, The target variable at time t is The true value.
[0219] S530. Obtain the final predicted value by optimizing the system's predicted values through end-to-end optimization.
[0220] The goal of this step is to simultaneously optimize all trainable parameters in the network, including the parameters of all expert subnetworks, by minimizing the total loss across the entire training dataset. Parameters of the gated network .
[0221] The entire optimization process is end-to-end, meaning the entire computational graph from the input raw data to the output final predicted value is completely differentiable. This implies that the loss function... The gradient of any trainable parameter can be calculated using the back propagation algorithm.
[0222] The optimization objective can be expressed as:
[0223]
[0224] in, This refers to the total number of training samples. In this embodiment, a gradient descent-based optimization algorithm, specifically the Adam algorithm, is used to update the network parameters. The simulation results show the prediction effect as follows: Figure 4 As shown.
[0225] Furthermore, to prevent the model from overfitting on the training set and to improve its generalization ability on unseen data, this embodiment also introduces an early stopping strategy. This strategy monitors the model's performance on the independent validation set, and when the loss on the validation set no longer improves significantly within a preset number of epochs, the training process is terminated early, and the model weights with the best performance are retained.
[0226] This invention discloses a water level prediction method based on a hybrid expert network of multi-scale decomposition and uncertainty perception. The method first preprocesses and performs multi-scale feature decomposition on hydrological time series data containing multiple variables; then, by applying an unsupervised learning algorithm in parallel, it jointly identifies and quantifies the macroscopic operating state and microscopic data anomalies of the system.
[0227] The core of this invention lies in constructing a hybrid expert neural network, which comprises multiple expert subnetworks and an uncertainty-aware gating network. The gating network utilizes previously identified anomalies and dynamically adjusts the decision temperature of its internal Softmax function to structurally regulate the weights assigned to each expert, thereby forcing multi-level judgment and prediction fusion when the system enters unknown or rare modes. The entire hybrid expert network is optimized through end-to-end training, aiming to minimize prediction error, thus constructing a high-precision prediction system that can adaptively cope with different operating conditions and remain robust under uncertainty. To verify the effectiveness and advancement of the method described in this invention, a comparative experiment was conducted on the publicly available historical dataset of the Three Gorges Reservoir in China, comparing the performance of the method with two baseline models (Multilayer Perceptron (MLP) and Long Short-Term Memory (LSTM) network). The evaluation metric was R0. 2 R-squared score. The experimental results are shown in Table 2:
[0228] Table 2: Performance comparison of different models on the test set
[0229]
[0230] The above description is only a preferred embodiment of the present invention. It should be noted that, for those skilled in the art, various improvements can be made to these embodiments without departing from the principle of the present invention, and these improvements should also be considered within the scope of protection of the present invention.
[0231] In summary, this invention achieves significant beneficial effects through a systematic and multi-layered innovative architecture, resulting in a substantial improvement in accuracy: Through multi-scale feature decomposition and specialized expert networks, this invention can precisely capture the dynamic patterns of hydrological systems at different time scales, achieving higher prediction accuracy under normal conditions compared to single models; strong adaptability: Utilizing unsupervised learning to automatically identify the macroscopic operating state of the system and drive the hybrid expert architecture for adaptive decision-making, effectively overcoming the limitations of traditional models when facing time-varying system dynamics; and excellent robustness and security: The core advantage of this invention lies in its innovative uncertainty-aware gating mechanism. This mechanism endows the model with "self-awareness," enabling it to suppress overconfident erroneous judgments by increasing the decision "temperature" when facing rare or unknown extreme conditions in the training set, forcing more conservative predictions, thereby effectively avoiding catastrophic prediction failures and greatly enhancing the reliability and security of the model in all application scenarios. Wide range of applications: The methods and systems provided by this invention can be widely applied to key areas such as dam safety monitoring, flood forecasting and early warning, power generation optimization scheduling and comprehensive water resource management, providing scientific and reliable technical support for intelligent and refined decision-making in water conservancy projects, and have great engineering practical significance and promotion prospects.
[0232] In another aspect, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method described above.
[0233] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0234] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the reservoir water level prediction methods and systems based on neural networks and uncertainty perception described in the above embodiments.
[0235] It is understood that the systems, devices, and storage media provided in the embodiments of the present invention correspond to the methods provided in the embodiments of the present invention, and the explanations, examples, and beneficial effects of the relevant content can be referred to the corresponding parts of the above methods.
[0236] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0237] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0238] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0239] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A reservoir water level prediction method based on neural network and uncertainty perception, characterized in that, The following steps are performed by a computer device: S100, collecting multivariate hydrological sequence data, and applying a multiscale decomposition technique to generate a plurality of characteristic sub-sequences representing different time frequencies; S200, processing the multivariate hydrological time sequence data by an unsupervised clustering and anomaly detection algorithm to determine a macro operation state label and calculate a quantitative anomaly score; S300, constructing a hybrid expert network to process the characteristic sub-sequences and the macro operation state label of step S100; S400, regulating the uncertainty perception weight based on the hybrid expert network and the quantitative anomaly score; S500, predicting fusion and end-to-end optimization according to the uncertainty perception weight regulation result to obtain a final water level prediction value; The hybrid expert network construction method in step S300 includes: S310, defining an expert sub-network; According to the number of states determined in step S220 , construct one independent expert sub-network, denoted as ; expert The input is a time window slice of the multi-scale feature matrix generated in step S130 one time window slice of the multi-scale feature matrix generated in step S130 For any time point , the input sequence for predicting the next time is denoted as , where is a preset time step. The input sequence is defined as: expert At time The output is a scalar , representing its independent prediction of the target variable at the next time; its functional relationship can be expressed as: wherein, representing the expert network all trainable parameters; S320, defining a gating network; Constructing a gating network , a weight is assigned to each expert according to the system state at the current time Gated network The input is the normalized raw hydrological data vector defined in step S210 at time t; The output of the gating network is a dimensional vector, denoted by which represents the preliminary inclination of the gating network for each expert, whose output layer is a linear activation function. The functional relationship can be represented as: wherein, representing a gating network all trainable parameters of the gating network; The uncertainty perception weight regulation method in step S400 includes: S410, uncertainty measurement acquisition and standardization; At time the anomaly score As a measure of system uncertainty, the entire anomaly score vector is first range-scaled to map its value domain to a corresponding interval; For any time instant the normalized anomaly score is calculated as follows: wherein is the minimum value in the entire anomaly score vector is the maximum value in the entire anomaly score vector is the minimum value in the entire anomaly score vector is the maximum value in the entire anomaly score vector obtaining a normalized uncertainty measure whose value is close to 0 indicates a normal state and close to 1 indicates a highly abnormal state; S420, calculating a dynamic temperature according to the standardized uncertainty measurement; A dynamic temperature parameter is defined The dynamic temperature parameter value is determined by a normalized uncertainty metric The dynamic temperature parameter T(t) is linearly determined by the formula wherein is a preset, greater than 0 hyperparameter, called sensitivity coefficient, which controls the strength of the temperature response to uncertainty; According to the formula: (1) when the system is in a normal state, then (2) when the system enters an abnormal state, then will be significantly greater than 1 S430, applying a dynamic temperature Softmax function to process the dynamic temperature data to obtain an expert weight vector; The logits vector output by the gating network in step S320 is transformed into a probability vector An application of a dynamic temperature A regulated Softmax function is applied to compute the final, uncertainty-adjusted expert weight vector ; Vector The formula for calculating the first element in the vector The formula scales each logit value by dividing it by a temperature parameter When the temperature is raised, the differences between all logits are reduced.
2. The neural network and uncertainty-aware reservoir water level prediction method of claim 1, wherein, The characteristic sub-sequence generation method in step S100 includes: S110, obtaining the original data and defining; S120, selecting a wavelet mother function and a decomposition level to pre-process the original data; S130, reconstructing the characteristic sub-sequences from the pre-processed data; The original data preprocessing method comprises the following steps of: preprocessing the original hydrological variable sequence Independently implemented Discrete wavelet transform of layers; For any one original hydrological variable sequence , after the first layer decomposition, an approximate component coefficient vector and a detail component coefficient vector are obtained; the calculation process can be represented by the following formula: wherein is a low-pass filter associated with the wavelet mother function is a high-pass filter associated with the wavelet mother function is a low-pass filter associated with the wavelet mother function is a high-pass filter associated with the wavelet mother function denotes a convolution operation, denotes a down-sampling operation; The resulting approximate component coefficients As new inputs, the above process is repeated for the second layer decomposition to obtain and ; go through After stratification, for each original hydrological variable sequence We obtain a set of wavelet coefficients, denoted as : wherein, is the approximation component coefficient of the first layer representing the trend part of the signal with the lowest frequency, is the detail component coefficient of the first layer representing the high frequency fluctuation part of the signal at different scales, wherein, .
3. The neural network and uncertainty-aware based reservoir water level prediction method of claim 2, wherein, The characteristic sub-sequence reconstruction method in step S130 includes: constructing a temporary set of coefficients where only the first layer of detail coefficients are retained; To perform layer inverse discrete wavelet transform: Likewise, for the first reconstruction feature subsequence of the layer approximation component The calculation process is as follows: constructing a temporary coefficient set where only the first approximation coefficients of the layer are kept; to performing layer inverse discrete wavelet transform: By the above steps, each variable is decomposed into a set of feature subsequences : Finally, the decomposition results of all variables are spliced to form a multi-scale feature matrix with a dimension of 。 4. The neural network and uncertainty-aware based reservoir water level prediction method of claim 1, wherein, The macro operation state label determination method in step S200 includes: Setting the number of states , one data point belongs to the th Gaussian component is defined as: wherein is the mean vector of the th Gaussian component; is the covariance matrix of the th Gaussian component; The probability density function of the entire hybrid model is the weighted sum of all components: wherein, is the mixing coefficient of the th component, satisfying and ; By applying an expectation-maximization algorithm to the data set to train, estimate model parameters ; After the training, for each time point of data its state label is determined by computing its posterior probability of belonging to each state and assigning it to the state with the highest posterior probability : wherein, is a data point belongs to the posterior probability of the state; Finally, a state label vector of length is generated .
5. The neural network and uncertainty-aware based reservoir water level prediction method of claim 1, wherein, The quantitative anomaly score calculation method in step S200 includes: A forest containing multiple isolation trees is constructed; during the construction of each tree, the data is recursively divided by randomly selecting a feature and a random split point within the range of the feature until each data point is completely isolated; For each data point its path length in the single isolated tree is defined as the number of splits needed from the root node to the leaf node where the data point resides; Taking the average over the whole forest gives the expected path length ; Finally, the data points of abnormal scores are normalized by the following calculation: wherein, is the number of samples used to train the Isolation Forest, is the average path length of a binary search tree with nodes, used to normalize the results, which is calculated as: wherein is the harmonic number; Finally, an anomaly score vector of length is generated .
6. The neural network and uncertainty-aware based reservoir water level prediction method of claim 1, wherein, The fusion prediction method in step S500 includes: S510, weighting and summing the independent prediction values generated by the expert sub-networks and the dynamic weight vector of the uncertainty perception to obtain a system prediction value; For any time All of S310 Independent predictions generated by each expert subnetwork The uncertainty-aware dynamic weight vector generated in S430 A weighted sum is then performed to obtain the final, single system prediction. ; The weighting and summing process is represented by the following formula: wherein, is the prediction of the expert at time is the uncertainty-adjusted weight assigned to the expert at time ; S520, defining a loss function to calculate the prediction error of the system prediction value; For the predicted value at time the loss function is defined as the square of the difference between the final predicted value and the true observed value : wherein is the true value of the target variable at time t; S530, optimizing the system prediction value through system end-to-end optimization to obtain the final prediction value; The optimization objective is represented as: wherein, is the total number of training samples, is the parameters of the expert subnetwork, is the parameters of the gating network.
7. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by a processor to perform the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Water level prediction method and electronic equipment
CN119358658A
Model training method and device and electronic equipment
CN120526217A