Method and device for runoff prediction by fusing bayesian neural network and physical constraints

By integrating Bayesian neural networks with physical constraints, a dynamic adjacency matrix and Bayesian inference were constructed, solving the problem of high-precision and probabilistic forecasting of runoff in complex river network systems. This resulted in a high-precision, physically consistent forecast with uncertainty quantification.

CN122196553APending Publication Date: 2026-06-12NORTH CHINA UNIV OF WATER RESOURCES & ELECTRIC POWER
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTH CHINA UNIV OF WATER RESOURCES & ELECTRIC POWER
Filing Date
2026-04-30
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing runoff prediction technologies struggle to achieve high accuracy, physical consistency, and probabilistic forecasting in complex river network systems, especially under conditions of scarce data or extreme circumstances, and lack a quantitative expression of model uncertainty.

Method used

By employing a method that integrates Bayesian neural networks and physical constraints, a dynamic adjacency matrix for physical perception is constructed. The uncertainty of model parameters is quantified through Bayesian inference, and end-to-end training is performed using the Musking equation as a differentiable loss term to generate probabilistic prediction results.

Benefits of technology

It achieves high-precision, physically consistent runoff probability forecasts with uncertainty quantification, improving the model's generalization ability and physical interpretability in data-free areas and extreme conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122196553A_ABST
    Figure CN122196553A_ABST
Patent Text Reader

Abstract

The application discloses a runoff prediction method and equipment fusing a Bayesian neural network and physical constraints, and belongs to the technical field of intelligent hydrological forecasting. The method comprises the following steps: S1. data preprocessing and feature construction; S2. constructing a river network graph structure dataset; S3. constructing a physical perception dynamic adjacency matrix; S4. constructing a Bayesian physical constraint graph neural network model; S5. calculating a total loss function based on a data loss term, a physical constraint loss term and a Bayesian KL divergence loss term, and updating model parameters through back propagation; S6. performing multiple forward propagations on the model, and randomly sampling the weight of a Bayesian linear layer from a posterior distribution in each forward propagation to obtain multiple groups of daily runoff prediction results; and S7. calculating the prediction mean and standard deviation of the daily runoff of each node and outputting a probability prediction result. The application can realize high-precision, physically consistent and uncertainty-quantized runoff probability prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent hydrological forecasting technology, specifically relating to a runoff prediction method and device that integrates Bayesian neural networks and physical constraints. Background Technology

[0002] Runoff forecasting, as a core supporting technology for hydrological and water resources management, flood control and drought relief scheduling, and ecological environmental protection, directly impacts national water security and the safety of people's lives and property. With the rapid development of artificial intelligence technology, data-driven models have demonstrated enormous potential in this field. However, constructing a forecasting system that is both accurate and physically plausible, and capable of supporting risk-based decision-making, still faces numerous challenges. Existing technologies can be mainly categorized into the following three types: 1. Traditional Physical-Hydrological Models: Traditional methods are represented by models such as the Xin'anjiang model, SAC-SMA model, and VIC model. Their core concept is based on an understanding of the mechanisms of runoff generation and concentration in the watershed. The entire watershed is divided into several units, and a series of empirical or semi-empirical equations (such as runoff generation at full storage, runoff exceeding infiltration limits, slope runoff, and river evolution) are used to simulate the precipitation-runoff conversion process. These models typically contain a large number of parameters that require calibration, and their application is highly dependent on long-term, high-quality measured hydrological and meteorological data. Their advantages lie in their clear physical meaning and good extrapolation ability, providing reliable deterministic forecasts in data-rich watersheds.

[0003] 2. Purely Data-Driven Machine Learning and Deep Learning Models: In recent years, deep learning models, represented by Long Short-Term Memory Networks (LSTM), Transformers, and Graph Neural Networks (GNNs), have been widely applied to runoff forecasting. Their core concept is to treat the forecasting problem as a complex nonlinear time series or spatiotemporal series prediction task. The model automatically learns the mapping relationship between inputs (such as past flow, rainfall, and meteorological elements) and outputs (future flow) through massive amounts of historical data, without needing to explicitly describe the physical processes. GNNs, in particular, due to their natural ability to adapt to graph-structured data, have been used to model the spatial dependencies between stations in river networks, treating hydrological stations as nodes and flow paths as edges, thereby capturing the dynamic interactions between upstream and downstream areas. However, existing GNN hydrological applications have significant drawbacks: their graph structure construction typically employs two extreme approaches: one is a fixed, static graph based on geographical adjacency, completely ignoring the dynamic impact of river hydraulic characteristics (such as confluence time and attenuation coefficient) changing with river segments; the other is a dynamic graph based on statistical data, which, while capturing correlations between data, is often spurious or lagging, failing to reflect the true hydrodynamic evolution mechanism. More importantly, existing technologies fail to directly map the physical parameters (K,x) from classic hydrology such as Muskingen's model to message passing weights in the neural network. This causes the model to lose the guidance of physical mechanisms during the feature aggregation stage, merely learning statistical laws in a black box, making it difficult to maintain physical consistency under data scarcity or extreme conditions.

[0004] 3. Physics-Data Hybrid Models: To combine the advantages of physical mechanisms and data-driven approaches, early researchers often employed a "model concatenation" method. For example, combining the runoff generation module of the Xin'anjiang model with the runoff collection module of an LSTM, or using the output of the physical model as the input feature of the data-driven model. While these methods combine the advantages of both types of models to some extent, the physical processes and data learning modules are independent and unidirectional. Physical constraints cannot guide the internal parameter updates of the data model, essentially remaining a patchwork of two black boxes, failing to achieve true collaborative optimization. For deeper integration, Physical Information Neural Networks (PINN) were introduced into the hydrological field. Its core idea is to explicitly embed equations describing physical laws into the loss function of the neural network, forcing the model output to satisfy conservation laws by minimizing the physical residuals. This method attempts to inject physical priors while maintaining high fitting ability, improving generalization and consistency.

[0005] While each of the aforementioned technologies has its advantages in runoff forecasting, they still exhibit significant and systemic shortcomings when addressing the comprehensive demands for high-precision and high-reliability probabilistic forecasts in complex river network systems. Traditional physical hydrological models heavily rely on extensive historical data for parameter calibration, and the parameters in their core equations are mostly empirical, lacking universality. This leads to a sharp decline in performance or even complete inapplicability when new monitoring stations are established, cross-border rivers are constructed, or data-scarce areas are encountered. In contrast, while purely data-driven models have achieved breakthroughs in point prediction accuracy, they lack the guidance of physical laws and are highly susceptible to physical errors that violate fundamental laws of water balance. The root cause lies in the fact that the optimization objective of such models only pursues numerical approximation between predicted and observed values, completely neglecting any constraints related to physical conservation laws. This results in the model sacrificing physical rationality in order to reduce numerical errors. Meanwhile, existing hybrid models also have significant drawbacks: loosely coupled architectures, lacking bidirectional feedback between modules, cannot effectively guide the deep learning process with physical knowledge, potentially leading to unreasonable results; while mainstream PINN methods, though tightly coupled, are mostly limited to single-section or simple serial systems, making it difficult to effectively model complex river network topologies such as tree-like and mesh-like structures prevalent in the real world; transforming complex hydrodynamic processes such as multi-source confluence into globally differentiable loss functions suitable for heterogeneous directed graph structures is extremely challenging, and standard PINN architectures fall short in this regard. Furthermore, both loosely coupled and existing PINN models almost exclusively employ a deterministic form with fixed weights, lacking the ability to model the uncertainty of model cognition and thus unable to generate probabilistic predictions.

[0006] In summary, existing technologies, due to over-reliance on data, neglect of physical structure, or lack of uncertainty representation, are insufficient to meet the modern smart water management requirements for "accurate, reasonable, and reliable" runoff forecasting. Therefore, there is an urgent need for an innovative method that can explicitly integrate river network topology, embed physical constraints, and natively support probabilistic forecasting. Summary of the Invention

[0007] The present invention aims to at least partially solve one of the technical problems in the aforementioned related technologies.

[0008] Therefore, the purpose of this invention is to provide a runoff prediction method and device that integrates Bayesian neural networks and physical constraints, which can provide high-precision, physically consistent runoff probability forecasts with uncertainty quantification. It is suitable for complex river network systems, and has better generalization ability and physical interpretability, especially in situations where hydrological data is scarce or under extreme conditions.

[0009] To solve the above-mentioned technical problems, the present invention is implemented as follows: This invention provides a runoff prediction method that integrates Bayesian neural networks and physical constraints, the method comprising: S1. Data preprocessing and feature construction; S2. Construct a river network map structure dataset; S3. Construct a physical perception dynamic adjacency matrix; S4. Construct a Bayesian physical constraint graph neural network model; S5. Calculate the total loss function based on the data loss term, physical constraint loss term, and Bayesian KL divergence loss term; and update the model parameters through backpropagation. S6. Perform multiple forward propagations on the model. In each forward propagation, the weights of the Bayesian linear layer are randomly sampled from its posterior distribution to obtain multiple sets of daily runoff prediction results. S7. Calculate the predicted mean and standard deviation of daily runoff at each node, and output the probability forecast results.

[0010] In addition, the runoff prediction method according to the present invention, which integrates Bayesian neural networks and physical constraints, may also have the following additional technical features: In some implementations, step S1 includes: performing quality control and standardization processing on historical flow data within the current river network system, and constructing node dynamic features that include the current daily flow and the previous day's flow.

[0011] In some implementations, step S2 includes: obtaining the Muskingan parameter storage constant and weight coefficient of each river segment in the river network, and constructing a graph structure dataset containing nodes, directed edges and edge attributes by combining the upstream and downstream connection relationships of the river network. Wherein, the node corresponds to a hydrological station, the directed edge represents the direction of water flow, and the edge attributes include the Muskinguistic parameters of the corresponding river segment.

[0012] In some implementations, step S3 includes: calculating the dynamic edge weights of the current time step in real time using a nonlinear mapping function based on the Musking parameters K and x corresponding to each directed edge, and generating a physically-aware dynamic adjacency matrix.

[0013] In some of these implementations, the Bayesian physical constraint graph neural network model described in step S4 includes an encoder, a graph convolution module, and a decoder. The encoder employs a single Bayesian linear layer to process node features. ∈ N×2 Mapping to the latent space dimension The weights of the Bayesian linear layer are modeled as a Gaussian distribution and sampled using a reparameterization technique. The graph convolution module includes an L-layer stacked graph convolution network, and is updated based on a dynamic adjacency matrix and a specific node feature update formula. Message passing follows the direction of the directed edge flow. The decoder employs another Bayesian linear layer to represent the final node. This is mapped to the daily runoff prediction vector for all stations.

[0014] In some implementations, the data loss term is calculated only for non-upstream sites, using the mean square error between the predicted and measured values. The physical constraint loss term is constructed based on the Muskingen equation, and the theoretical downstream outflow is calculated using the upstream inflow and the downstream outflow at the previous moment; the mean square error between the theoretical downstream outflow and the model predicted outflow is used as the loss term. The Bayesian KL divergence loss term measures the KL divergence between the posterior distribution of the weights of each Bayesian linear layer and the standard normal prior, and is normalized to balance the magnitude by the total number of training samples.

[0015] In some implementations, updating model parameters via backpropagation includes: minimizing the total loss using the Adam optimizer; and using an early stopping strategy to stop updating when the validation loss has not improved for P consecutive rounds, saving the model with the lowest validation loss as the optimal model.

[0016] In some implementations, step S6 includes: Load the optimal model and perform S independent forward propagations on the test set; in each forward propagation, the weights of the Bayesian linear layer are independently sampled from its posterior distribution to obtain a set of prediction results; Calculate the mean and standard deviation of the prediction results, and then perform inverse standardization on the mean and standard deviation respectively; The inverse standardization results were used as the probabilistic forecast results for daily runoff.

[0017] In some implementations, step S7 includes: At each non-upstream hydrological station, the performance of the model is evaluated using indicators including point prediction accuracy and probability forecast quality. The indicators of the point prediction accuracy include: Nash efficiency coefficient, coefficient of determination, root mean square error, and mean absolute error. The quality of the probability forecast includes: constructing multi-level confidence intervals and calculating their coverage based on the probability forecast results of S6, and using the coverage to quantify the reliability and calibration degree of the probability forecast.

[0018] This invention also provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the runoff prediction method integrating Bayesian neural networks and physical constraints as described in any of the preceding embodiments.

[0019] Compared with the prior art, the present invention has at least the following beneficial effects: In this embodiment of the invention, the provided runoff prediction method integrating Bayesian neural networks and physical constraints constructs a physically-aware dynamic message passing mechanism. This differs from existing technologies that use fixed geographical adjacencies or purely statistical correlations to construct graph structures. It innovatively transforms river channel Muskingan calculus parameters into dynamic adjacency matrix weights in real time through a learnable mapping. This allows the information aggregation intensity in the neural network to be directly determined by the hydrodynamic confluence characteristics, realizing a shift from "data-driven black-box fitting" to "mechanism-guided feature extraction." This significantly improves the model's generalization ability and physical interpretability in data-free areas and under extreme flood conditions. In this embodiment of the invention, the provided runoff prediction method that integrates Bayesian neural networks and physical constraints has the feature of explicitly modeling river network topology: by constructing a directed graph structure, it accurately reflects the hydraulic connectivity between stations in the watershed, overcoming the defect of traditional sequence models that ignore spatial dependencies; In this embodiment of the invention, the provided runoff prediction method that integrates Bayesian neural networks and physical constraints adopts a deep integration of physical constraints: the Muskingan equation is embedded as a differentiable loss term in the end-to-end training process to ensure that the prediction results meet the basic hydrodynamic laws and improve physical consistency. In this embodiment of the invention, the runoff prediction method that integrates Bayesian neural networks and physical constraints can achieve probabilistic forecasting: by using Bayesian neural networks and Monte Carlo sampling, a prediction interval is output, providing a risk quantification basis for flood control scheduling.

[0020] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0021] Figure 1 This is a flowchart illustrating the construction process of a river network graph structure dataset as disclosed in one embodiment of the present invention; Figure 2 This is a schematic diagram of the B-PGNN model structure and joint training process disclosed in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the application of probability forecast generation and evaluation according to an embodiment of the present invention. Detailed Implementation

[0022] 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 only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and specific examples and application scenarios.

[0024] In some embodiments of the present invention, a runoff prediction method integrating Bayesian neural networks and physical constraints is provided. This method constructs a Bayesian Physically Constrained Graph Neural Network (B-PGNN) model, explicitly embeds the river network topology and Muskingan channel calculus equations, and introduces a Bayesian inference mechanism to achieve high-precision, physically consistent runoff prediction with uncertainty quantification. First, the river network system is abstracted into graph-structured data containing node features, directed topological connections, and river channel physical attributes, such as… Figure 1 As shown. Then, the graph data is learned and mapped using an end-to-end neural network, with the structure as follows. Figure 2 As shown. During the training phase, the model learns to fit historical observation data, explicitly embedding the physical constraints of the Muskingan channel calculus equations through a joint loss function, and quantifying the uncertainty of model parameters using Bayesian inference. During the inference phase, multiple forward propagation samplings are performed on the trained model to generate runoff prediction results with a probability distribution form, the process of which is as follows. Figure 3 As shown in the figure. Ultimately, this method achieves high-precision, physically consistent runoff probability forecasts with uncertainty quantification capabilities.

[0025] Figure 1 This paper demonstrates the complete workflow of data preprocessing in this invention. The flowchart begins with the raw data input in the upper left corner, sequentially proceeding through key steps such as quality control and standardization, node feature construction, and graph structure construction incorporating physical parameters, ultimately outputting a standardized graph structure dataset. The diagram clearly illustrates how raw hydrological observation data is transformed into a standardized form suitable for graph neural network input.

[0026] Figure 2 This diagram illustrates the architecture and training principle of the core model B-PGNN of this invention. The upper part of the diagram shows the model's structure from forward propagation (encoder-graph convolution-decoder), while the lower part details the closed-loop process of jointly calculating three types of losses (data loss, physical constraint loss, and Bayesian KL divergence loss) and performing backpropagation optimization during training. This diagram reveals how the model simultaneously learns data features and physical laws.

[0027] Figure 3 This diagram illustrates the inference and application process of probabilistic forecasting using a trained B-PGNN model. From left to right, the diagram shows Monte Carlo sampling, statistical aggregation of prediction results, confidence interval generation, and the final evaluation steps. This diagram comprehensively presents how to generate forecast results with quantified uncertainty from a trained model.

[0028] In some embodiments of the present invention, a runoff prediction method integrating Bayesian neural networks and physical constraints includes the following steps: Step 1. Perform quality control and standardization on the historical daily flow data within the river network system under study, and construct node dynamic features that include the current daily flow and the previous day's flow; Step 2. Obtain the Muskingen parameters, storage constants, and weight coefficients of each river segment in the river network, and construct a graph structure dataset containing nodes, directed edges, and edge attributes by combining the upstream and downstream connections of the river network; wherein, the nodes correspond to hydrological stations, the directed edges represent the direction of water flow, and the edge attributes include the Muskingen parameters of the corresponding river segment. Step 3. Construct a physical sensing dynamic adjacency matrix generation module: Based on the Musking parameters K and x corresponding to each directed edge, calculate the dynamic edge weights at the current time step in real time through a nonlinear mapping function to generate a physical sensing dynamic adjacency matrix. Step 4. Construct the B-PGNN model; the B-PGNN model includes: an encoder composed of Bayesian linear layers, used to map the dynamic features of nodes to the latent space; a multi-layer graph convolutional network (GCN) module, used to aggregate neighborhood information on the river network topology; and a decoder composed of Bayesian linear layers, used to output the predicted daily runoff values ​​of each node. Step 5. During model training, simultaneously calculate the following three types of loss terms and jointly optimize the model parameters: Data loss term: The mean square error between the predicted and measured runoff values ​​for non-upstream stations calculated by the model; Physical constraint loss term: Based on the Muskingen channel calculation equation, the theoretical downstream outflow is calculated using the current upstream inflow, the upstream inflow at the previous moment, and the downstream outflow at the previous moment, and the mean square error between the calculated and the downstream outflow predicted by the model. Bayesian KL divergence loss term: Calculates the KL divergence between the weight posterior distribution of all Bayesian linear layers in the model and the preset Gaussian prior distribution, and normalizes it according to the total number of training samples; The data loss term, physical constraint loss term, and Bayesian KL divergence loss term are weighted and summed to form the total loss function. The model parameters are then updated through backpropagation to complete model training. Step 6. In the model inference stage, perform multiple forward propagations on the trained model. In each forward propagation, the weights of the Bayesian linear layer are randomly sampled from its posterior distribution to obtain multiple sets of daily runoff prediction results. Step 7. Perform statistical analysis on multiple sets of forecast results, calculate the forecast mean and standard deviation of daily runoff at each node, and output the probability forecast results for flood risk early warning and dispatch decision-making.

[0029] Example 1: This embodiment constructs a graph-structured dataset based on historical daily flow data of the river network and Muskingan parameters; it designs a deep neural network containing Bayesian linear layers and graph convolutional layers, dynamically generating a physically-aware adjacency matrix representing the intensity of hydrodynamic evolution using Muskingan calculus parameters, thereby driving the message passing process of the graph convolutional layers; it jointly optimizes data fitting, physical consistency, and parameter uncertainty objectives during training; and finally outputs the probabilistic prediction results of daily runoff through multiple forward samplings. The specific steps include: Step 1: Construct dynamic node features Collect historical daily measured flow sequences of all hydrological stations within the study area Q={ , ,…, }∈R T×N Where T is the total number of time steps. Let R represent the total number of sites and R denote the real domain. Quality control is performed on the raw data, including outlier identification and correction, and linear imputation of missing values. Subsequently, the entire traffic matrix is ​​normalized using the Z-score normalization method.

[0030] in, and Let be the mean and standard deviation of the traffic sequence for the i-th site, respectively. This represents the original measured traffic value of the i-th station at time t. This represents the traffic value of the i-th site at time t after Z-score normalization.

[0031] For any predicted time t (t≥1), the current flow rate is used as the basis for the forecast. Traffic volume compared to the previous moment This forms a two-dimensional dynamic feature vector. Therefore, the node feature matrix at that moment is obtained:

[0032] Step 2: Construct the river network diagram structure dataset Based on the actual river network topology, construct a directed graph G=( , ), where the set of nodes For all hydrological stations, a set of directed edges × Indicates the direction of water flow: if the station The water flow directly into the station Then there exists a directed edge. .

[0033] For each edge = Obtain the corresponding Muskingen channel calculation parameters: storage constant. With weighting coefficients These parameters are used to construct an edge attribute vector a. e =[ , ] All edge attributes constitute the edge attribute matrix A. edge ∈ .

[0034] At this point, the input data at each time step t can be represented as a graph data object ( , A edge ), where graph structure ( A edge The adjacency matrix is ​​dynamically generated over time throughout the entire time series.

[0035] Step 3: Construct a Bayesian physical constraint graph neural network model The constructed model is denoted as B-PGNN, and consists of four core parts: a physical perception dynamic adjacency matrix generator, an encoder, a graph convolution module, and a decoder. Physically-aware dynamic adjacency matrix generator: For any time t, based on the edge attribute matrix A edge Real-time computation of the dynamic adjacency matrix of physical sensing For any pair of nodes Matrix elements The calculation formula is defined as follows:

[0036] in, , These are the storage constants. and weighting coefficients The globally learnable scalar parameters are used to adaptively adjust the contribution of physical parameters to edge weights; This is a bias term.

[0037] Encoder: Employs a single Bayesian linear layer to process node features. ∈ N×2 Mapping to the latent space dimension :

[0038] Among them, the weights of the Bayesian linear layer Modeled as a random variable, its posterior distribution is approximated as a Gaussian distribution through variational inference. , Indicates a normal distribution. This represents the diagonal matrix operator, i.e., the variance vector. Transforming it into a diagonal covariance matrix implies that the weights are independent of each other across their dimensions. In this distribution, and These are the mean matrix and standard deviation matrix, respectively, of the same dimension as the weight matrix. During forward propagation, the weights are sampled using a reparameterization technique:

[0039] Graph Convolution Module: Stacked Layered Graph Convolutional Network (GCNConv). For the l-th layer (where l=0,1,…), 1) Its message passing process strictly uses the dynamic adjacency matrix calculated by the generator mentioned above, and the node feature update formula is:

[0040] In GCN modules, message passing strictly follows the direction of water flow defined by directed edges.

[0041] Decoder: Employs another Bayesian linear layer to represent the final node. Mapped to daily runoff prediction vectors for all stations:

[0042] Where, vector The Each component represents the model for the site. The predicted daily runoff at time t.

[0043] Step 4: Joint Model Training The total loss function is defined as the weighted sum of the three losses:

[0044] The definitions of each item are as follows: Data loss term: only for non-upstream sites (i.e., the set of sites to be predicted) Calculate the mean square error:

[0045] in, This is the standardized measured flow rate.

[0046] Physical constraint loss term: constructed based on Muskingan equations. For each edge... = The theoretical downstream outflow calculation is as follows:

[0047] in, For upstream inflow, This is the measured outflow from the downstream at the previous moment. The flow used... The values ​​used are actual observations, not model predictions. Coefficients , , Based on Muskingen parameters and time step =Confirmed on the 1st:

[0048] The physical loss term is the mean square error between the theoretical outflow and the model-predicted outflow:

[0049] KL divergence loss term: measures the posterior distribution of weights across all Bayesian linear layers. With standard normal prior Differences:

[0050] And according to the total number of training samples Normalization is used to balance the magnitudes.

[0051] Minimize using the Adam optimizer An early stopping strategy is adopted: let the early stopping patience value be P. When the validation set loss has not improved for P consecutive training rounds, the training process is terminated, and the model corresponding to the lowest validation loss is saved as the optimal model.

[0052] Step 5: Generate probability forecast results Load the optimal model obtained from training and perform S independent forward propagations on the test set. In each forward propagation, the weights of the Bayesian linear layer are independently sampled from its posterior distribution to obtain a set of prediction results. .

[0053] Calculate the predicted mean and standard deviation:

[0054] Perform inverse standardization on the mean and standard deviation respectively. Let the standardization parameter be... The prediction result in physical units is:

[0055] Final output and As a probabilistic forecast result of daily runoff.

[0056] Step 6, Performance Evaluation At each non-upstream hydrological station, the following indicators were used to evaluate the model performance: Point prediction accuracy: Nash efficiency coefficient ( ), coefficient of determination ( ), root mean square error ( Mean absolute error ( Let the test set contain T time steps. For any non-upstream station i, let... This represents the measured daily runoff at time t. This represents the predicted average daily runoff output by the model. , This represents the average measured traffic for this site. The formulas for calculating each indicator are as follows: Nash efficiency coefficient ( ):

[0057] Coefficient of determination ( ):

[0058] Root mean square error (RMSE) ):

[0059] Mean absolute error ( ):

[0060] Probabilistic forecast quality: based on the output of step 5 and We construct multi-level confidence intervals and calculate their coverage. Specifically, assuming the prediction distribution approximately follows a normal distribution, then for a given confidence level α (e.g., 90%), the corresponding prediction interval is:

[0061] in, The upper part of the standard normal distribution quantiles (e.g., corresponding to the 90% confidence level) ).

[0062] Coverage probability is defined as the proportion of actual observations falling within the aforementioned prediction interval throughout the entire testing period. The system calculates coverage probabilities at 90%, 92%, 95%, and 98% confidence levels to quantify the reliability and calibration level of the probabilistic forecast.

[0063] Through the above modules, this embodiment can effectively integrate river network topology, hydrophysical laws and deep learning models to generate daily runoff probability forecast results with high accuracy, physical consistency and reliable uncertainty quantification, providing scientific and operable decision support for basin flood warning and water resource allocation.

[0064] Example 2: This embodiment takes a section of the Yellow River Basin in China as the research object, selects measured data from 9 hydrological stations, and details the specific implementation process of the runoff prediction method that integrates Bayesian neural network and physical constraints.

[0065] Step 1: Construct dynamic node features.

[0066] Historical daily flow data for the aforementioned stations from January 1, 2002 to August 3, 2004 were collected. After quality control and linear interpolation to fill gaps in the data, the flow sequences for each station were standardized using the Z-score method. For each forecast time t, the standardized flow data of the current time and the previous time were combined to form a two-dimensional dynamic feature for each station, ultimately resulting in a 9×2 node feature matrix.

[0067] Step 2: Construct a river network diagram structure dataset.

[0068] Based on the actual flow direction of the Yellow River, a static river network graph containing 9 nodes and 6 directed edges is constructed. Edge relationships include: Shizuishan → Bayangol, Wanjiazhaixia → Fugu, etc. The storage constant and weight coefficient of each edge are calculated according to the Muskingum equation and stored in a file as edge attributes.

[0069] Step 3: Joint training of models.

[0070] The data was divided into a training set (757 days), a validation set (142 days), and a test set (47 days) in chronological order. Physical loss weights were then set. =0.1, early stopping patience value P=30. The model is trained using the Adam optimizer, and stopped when the validation loss does not decrease for 30 consecutive rounds, and the optimal model is saved.

[0071] Step 4: Generate probability forecast results.

[0072] Perform 30 Monte Carlo forward propagations on the test set, sampling Bayesian weighted posteriors each time. Calculate the mean and standard deviation of the 30 prediction results, and inversely transform them to the original flow units using the standardization parameters from step 1. Finally, output the daily runoff prediction mean and standard deviation for each station.

[0073] Step 5: Performance evaluation.

[0074] The model performance was evaluated at six non-upstream sites. The results show that the regional average Nash efficiency coefficient ( The coefficient of determination reached 0.936, and the coefficient of determination was ( The root mean square error (RMSE) is 0.936. The value is 173.52m. 3 / s, mean absolute error ( The value is 119.84 m.3 / s. The average coverage probability of the area is as follows: 90% confidence interval average coverage rate: 53.1%, 92% confidence interval average coverage rate: 55.5%, 95% confidence interval average coverage rate: 61.1%, 98% confidence interval average coverage rate: 69.9%.

[0075] For the parts of this invention not described in detail, please refer to the prior art or the art known to those skilled in the art. This embodiment does not limit these aspects and will not describe them in detail here.

[0076] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other modifications under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these modifications are within the protection scope of the present invention.

Claims

1. A runoff prediction method integrating Bayesian neural networks and physical constraints, characterized in that, The method includes: S1. Data preprocessing and feature construction; S2. Construct a river network map structure dataset; S3. Construct a physical perception dynamic adjacency matrix; S4. Construct a Bayesian physical constraint graph neural network model; S5. Calculate the total loss function based on the data loss term, physical constraint loss term, and Bayesian KL divergence loss term; and update the model parameters through backpropagation. S6. Perform multiple forward propagations on the model. In each forward propagation, the weights of the Bayesian linear layer are randomly sampled from its posterior distribution to obtain multiple sets of daily runoff prediction results. S7. Calculate the predicted mean and standard deviation of daily runoff at each node, and output the probability forecast results.

2. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Step S1 includes: performing quality control and standardization processing on historical flow data within the current river network system, and constructing node dynamic features that include the current daily flow and the previous day's flow.

3. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Step S2 includes: obtaining the Muskingan parameter storage constant and weight coefficient of each river segment in the river network, and constructing a graph structure dataset containing nodes, directed edges and edge attributes by combining the upstream and downstream connection relationships of the river network. Wherein, the node corresponds to a hydrological station, the directed edge represents the direction of water flow, and the edge attributes include the Muskinguistic parameters of the corresponding river segment.

4. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Step S3 includes: calculating the dynamic edge weights at the current time step in real time using a nonlinear mapping function based on the Musking parameters K and x corresponding to each directed edge, and generating a physically-aware dynamic adjacency matrix.

5. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, The Bayesian physical constraint graph neural network model described in step S4 includes an encoder, a graph convolution module, and a decoder; The encoder employs a single Bayesian linear layer to process node features. ∈ N×2 Mapping to the latent space dimension The weights of the Bayesian linear layer are modeled as a Gaussian distribution and sampled using a reparameterization technique. The graph convolution module includes an L-layer stacked graph convolution network, and is updated based on a dynamic adjacency matrix and a specific node feature update formula. Message passing follows the direction of the directed edge flow. The decoder employs another Bayesian linear layer to represent the final node. Mapped to the daily runoff prediction vector for all stations.

6. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, The data loss term is calculated only for non-upstream sites, showing the mean square error between the predicted and measured values. The physical constraint loss term is constructed based on the Muskingen equation, and the theoretical downstream outflow is calculated using the upstream inflow and the downstream outflow at the previous moment; the mean square error between the theoretical downstream outflow and the model predicted outflow is used as the loss term. The Bayesian KL divergence loss term measures the KL divergence between the posterior distribution of the weights of each Bayesian linear layer and the standard normal prior, and is normalized to balance the magnitude by the total number of training samples.

7. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Updating model parameters through backpropagation includes: minimizing the total loss using the Adam optimizer; and employing an early stopping strategy, stopping when the validation loss has not improved for P consecutive rounds, and saving the model with the lowest validation loss as the optimal model.

8. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Step S6 includes: Load the optimal model and perform S independent forward propagations on the test set; in each forward propagation, the weights of the Bayesian linear layer are independently sampled from its posterior distribution to obtain a set of prediction results; Calculate the mean and standard deviation of the prediction results, and then perform inverse standardization on the mean and standard deviation respectively; The inverse standardization results were used as the probabilistic forecast results for daily runoff.

9. The runoff prediction method integrating Bayesian neural networks and physical constraints according to claim 1, characterized in that, Step S7 includes: At each non-upstream hydrological station, the performance of the model is evaluated using indicators including point prediction accuracy and probability forecast quality. The indicators of the point prediction accuracy include: Nash efficiency coefficient, coefficient of determination, root mean square error, and mean absolute error. The quality of the probability forecast includes: constructing multi-level confidence intervals and calculating their coverage based on the probability forecast results of S6, and using the coverage to quantify the reliability and calibration degree of the probability forecast.

10. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the runoff prediction method merging Bayesian neural networks and physical constraints as described in any one of claims 1-9.