Water quality probability forecasting method based on Bayesian multi-time sequence deep learning
By employing a Bayesian multi-temporal deep learning method, combined with deep neural networks and Bayesian inference, the shortcomings of traditional water quality forecasting in terms of nonlinear temporal and uncertainty expression are addressed, achieving high-precision water quality forecasting and risk quantification, applicable to various water environments.
Patent Information
- Application Number
- CN202511731613.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-02-03
AI Technical Summary
Traditional water quality forecasting methods are insufficient in handling nonlinear time-series relationships and expressing uncertainties, making it difficult to meet the practical application needs in complex environments. Furthermore, most deep learning models only provide point predictions and cannot provide reliable metrics or risk ranges.
We employ a Bayesian multi-temporal deep learning approach, combining the high-dimensional temporal modeling capabilities of deep neural networks with the uncertainty representation advantages of Bayesian inference, to output the forecast mean and confidence interval. We then use the Bayesian random dropout method for parameter learning and model training to quantify the prediction uncertainty.
It significantly improves the scientific rigor and stability of water quality forecasting, provides high-precision predictions and confidence intervals, is applicable to various water environments, and has promising prospects for widespread application.
Smart Images

Figure CN121456671A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of water quality monitoring and forecasting technology, specifically relating to a water quality probabilistic forecasting method based on Bayesian multi-temporal deep learning. Background Technology
[0002] Water quality forecasting has become an important technical means for watershed management and ecological protection. Although traditional methods such as statistical regression, physical models, or conventional machine learning can achieve a certain degree of short-term prediction, they have significant shortcomings in handling nonlinear time series relationships and expressing uncertainty, making it difficult to meet the practical application needs in complex environments.
[0003] In recent years, deep learning models based on LSTM, Transformer, and other architectures have been introduced into the field of water quality prediction, significantly improving nonlinear modeling and feature extraction capabilities. However, most methods remain at the point prediction level, failing to provide reliable metrics or risk ranges, thus limiting their application in decision support. Furthermore, water quality evolution is influenced by multiple driving factors, exhibiting characteristics of multi-temporal interleaving and complex dynamic changes, which traditional modeling methods struggle to effectively address.
[0004] Therefore, there is an urgent need for an intelligent forecasting method that can integrate multiple time series information, quantify prediction uncertainties, and adapt to complex water environment evolution mechanisms. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a water quality probabilistic forecasting method based on Bayesian multi-temporal deep learning. This method is straightforward and easy to use, combining the high-dimensional temporal modeling capabilities of deep neural networks with the uncertainty expression advantages of Bayesian inference. It provides high-precision predictions while outputting confidence intervals, thereby enhancing the scientific rigor and stability of the forecast. It exhibits significant advantages in quantifying prediction uncertainty and forecasting risks, and has promising prospects for widespread application.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: A water quality probabilistic prediction method based on Bayesian multi-temporal deep learning includes the following steps: S1. Determine the forecast water environment and water ecology indicators, driving indicators, and forecast days; S2. Collect time series data of forecast indicators and driving indicators, perform data preprocessing, and construct the dataset required for model construction. S3. Divide the time series data, construct a driving indicator forecasting model using a multi-time series deep learning method, and select the Bayesian random dropout method for parameter learning. S4. Evaluate the accuracy and precision of the model, and use hyperparameter optimization methods to improve the simulation and forecasting effect; S5. No need to split the training set and test set, use all data to train the model, and use the trained model to make water quality probability predictions, outputting the prediction mean and confidence interval.
[0007] Preferably, the specific steps of step S1 are as follows: S11. Collect historical water quality monitoring data of the target water area. The historical water quality monitoring data includes the monitoring values of various water environment and water ecology indicators in different time periods. The water environment and water ecology indicators include chlorophyll a, total phosphorus, total nitrogen, dissolved oxygen and chemical oxygen demand. S12. Collect and select input features that are highly correlated with the water environment and water ecology indicators in the forecast, and use the input features as driving indicators; the driving indicators include historical water quality parameters, meteorological variables, flow rate, water level and land use; S13. Taking into account water quality management needs, monitoring frequency, data availability and forecast accuracy, set the forecast water environment and water ecology indicators and forecast days; the forecast days are 1 day, 7 days or 15 consecutive days.
[0008] Preferably, the specific process of step S2 is as follows: S21. After identifying and removing outliers from the monitoring data, the Kalman filter method is used to fuse the observed values and the state estimate in order to improve the estimation accuracy and complete the missing value filling. S22. After normalizing or standardizing various indicators, a multi-source database is constructed.
[0009] Preferably, in step S21, the Kalman filtering method includes establishing a state-space model to describe the concentration change process, setting the covariance matrix of process noise and observation noise, and realizing dynamic imputation of missing values through a prediction-update loop; in step S22, the normalization adopts min-max normalization to map the data to the [0,1] interval; the standardization adopts Z-score standardization to make the data have a distribution with a mean of 0 and a standard deviation of 1.
[0010] Preferably, the specific process of step S3 is as follows: S31. Divide the time series data into training and test sets in an 8:2 ratio according to the chronological order. S32: Based on the task characteristics and temporal dependency structure, a deep learning architecture with the ability to model multivariate long-term time series, capture long-distance dependencies, and attention mechanism is selected to meet the needs of water quality dynamic modeling and to construct a driving indicator forecast model; the deep learning architecture is Crossformer, Informer, or LSTM. S33: Integrating Bayesian methods into a neural network, the posterior distribution of parameters is approximated through random sampling in the forward propagation, achieving synchronous output of the predicted mean and confidence interval. This is used to introduce uncertainty modeling, treating the neural network weights as probability distributions, performing posterior inference to obtain the probability distribution of the predicted results, and then using the probability distribution to approximate the true posterior distribution. The calculation formula is as follows: , ,in, It is a probability distribution; For model weights; For parameters; In the dataset The true distribution of the weights; For dataset; Lower bound of evidence; For mathematical expectation; It is the likelihood function; To utilize Divergence calculation probability distribution and Differences between probability distributions; The formula for calculating divergence is: ,in, for Divergence; and These are two probability distributions, with probability density functions respectively. and ; Let be a given random variable; Using Bayesian random dropout with probability Randomly discard neurons, perform multiple forward propagations, and the output of the forward propagation is... The mean of the samples is calculated using the following formula: , in, For a given hour The posterior predicted distribution; Output values for the model; This represents the total number of samples. For the first Secondary sampling; For the first Weight configuration for each sampling; The variance obtained by applying the Bayesian random dropout method needs to be decomposed using the variance decomposition formula, which is as follows: ,in, The total variance of the model; For new input samples The predicted output; For the first Noise variance at the time of sampling; For the first Newest input sample; Configure the model with weights as The input is Deterministic output; yes Transpose of; For predicting output The expected value is the mean of the results from multiple samplings; yes Transpose of; S34. The training of the driving indicator forecasting model uses the root mean square error as the main loss function to measure the deviation between the model's predicted values and the actual values. The calculation formula is as follows: ,in, for Root mean square error; This represents the number of samples in the test set. Number the sample; For the first Predicted values for each sample; For the first The true value of each sample; the root mean square error, combined with early stopping mechanism and regularization strategy, is used to improve the model's generalization ability on the validation set and avoid overfitting.
[0011] Preferably, the specific steps of step S4 are as follows: S41. Multiple prediction and evaluation indicators are used to verify the accuracy of the driving indicator forecast model output, in order to quantify the model's fit to the actual water quality change trend; the prediction and evaluation indicators include mean square error. Mean absolute error and coefficient of determination ; S42. Quantitatively evaluate the uncertainty of the prediction output. Use prediction interval coverage to measure the confidence of the prediction interval, average confidence interval width to measure the compactness of the prediction interval, and continuous ranking probability score to comprehensively reflect the quality of the distribution prediction, as follows: The formula for calculating the coverage rate of the predicted interval is as follows: , in, To predict interval coverage; For indicator functions, when The function value is 1 within the upper and lower limits of the prediction interval, and 0 otherwise; For the model to the first The predicted output for each sample; and These are the upper and lower limits of the prediction interval, respectively. The formula for calculating the average confidence interval width is as follows: ,in, This represents the average confidence interval width. The formula for calculating the consecutive ranking probability score is as follows: ,in, Probability score for consecutive rankings; To predict the cumulative distribution function; For Heaviside step function, The function value is 1 at time. The function value is 0 at that time. The model predicts all possible values. S43. Based on the quantitative evaluation results, the system adjusts the key hyperparameters and improves the overall performance of the driving index forecasting model under different forecast durations through grid search or Bayesian optimization strategies.
[0012] Preferably, in step S43, the key hyperparameters include the learning rate, batch size, and random dropout probability.
[0013] Preferably, the specific steps of step S5 are as follows: S51. After completing the structure and parameter tuning, use complete historical data to train the model for the final time to maximize data utilization and model stability, so that the final prediction results have the generalization ability of full sample support. S52. For the target forecast time window, the model outputs the forecast mean and the corresponding uncertainty interval for each forecast time point, providing quantitative basis and risk assessment information for management decisions.
[0014] Preferably, in step S52, the uncertainty interval is a 90% confidence interval.
[0015] After adopting the above technical solution, the present invention has the following beneficial effects: The water quality probabilistic forecasting method based on Bayesian multi-time series deep learning of the present invention introduces outlier detection, Kalman filtering, and missing value imputation strategies in the data quality control stage, which significantly improves the integrity and reliability of the original monitoring data and provides a solid data foundation for subsequent modeling. In the model construction process, multi-source heterogeneous time series data are integrated, and the long-distance dependence and nonlinear coupling characteristics in water quality evolution are effectively captured through the deep learning framework. At the same time, a Bayesian inference mechanism is introduced to realize the quantitative expression of the uncertainty of the prediction results. In addition, the method is simple to operate and easy to use. Combining the high-dimensional time series modeling capability of deep neural networks with the uncertainty expression advantage of Bayesian inference, it outputs confidence intervals while providing high-precision predictions, improving the scientificity and stability of the forecast. It has obvious advantages in quantifying prediction uncertainty and forecast risk, is applicable to various water environments, and has good prospects for promotion and application. Attached Figure Description
[0016] Figure 1 This is a flowchart of the present invention; Figure 2 This is a flowchart of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0018] like Figure 1 and Figure 2 As shown, a water quality probabilistic prediction method based on Bayesian multi-temporal deep learning includes the following steps: S1. Determine the forecast water environment and water ecology indicators, driving indicators, and forecast days; The specific steps of step S1 are as follows: S11. Collect historical water quality monitoring data of the target water area. The historical water quality monitoring data includes the monitoring values of various water environment and water ecology indicators in different time periods. The water environment and water ecology indicators include chlorophyll a, total phosphorus, total nitrogen, dissolved oxygen and chemical oxygen demand. S12. Collect and select input features that are highly correlated with the water environment and water ecology indicators in the forecast, and use the input features as driving indicators; the driving indicators include historical water quality parameters, meteorological variables, flow rate, water level and land use; S13. Taking into account water quality management needs, monitoring frequency, data availability, and forecast accuracy, set the forecast water environment and water ecology indicators and forecast days; the forecast days are 1 day, 7 days, or 15 consecutive days. S2. Collect time series data of forecast indicators and driving indicators, perform data preprocessing, and construct the dataset required for model construction. The specific process of step S2 is as follows: S21. After identifying and removing outliers from the monitoring data, the Kalman filter method is used to fuse the observed values and the state estimate in order to improve the estimation accuracy and complete the missing value filling. In step S21, the Kalman filtering method includes establishing a state-space model to describe the concentration change process, setting the covariance matrix of process noise and observation noise, and realizing dynamic imputation of missing values through a prediction-update loop; in step S22, the normalization adopts min-max normalization to map the data to the [0,1] interval; the standardization adopts Z-score standardization to make the data have a distribution with a mean of 0 and a standard deviation of 1. S22. After normalizing or standardizing various indicators, a multi-source database is constructed. S3. Divide the time series data, construct a driving indicator forecasting model using a multi-time series deep learning method, and select the Bayesian random dropout method for parameter learning. The specific process of step S3 is as follows: S31. Divide the time series data into training and test sets in an 8:2 ratio according to the chronological order. S32: Based on the task characteristics and temporal dependency structure, a deep learning architecture with the ability to model multivariate long-term time series, capture long-distance dependencies, and attention mechanism is selected to meet the needs of water quality dynamic modeling and to construct a driving indicator forecast model; the deep learning architecture is Crossformer, Informer, or LSTM. S33: Integrating Bayesian methods into a neural network, the posterior distribution of parameters is approximated through random sampling in the forward propagation, achieving synchronous output of the predicted mean and confidence interval. This is used to introduce uncertainty modeling, treating the neural network weights as probability distributions, performing posterior inference to obtain the probability distribution of the predicted results, and then using the probability distribution to approximate the true posterior distribution. The calculation formula is as follows: , ,in, It is a probability distribution; For model weights; For parameters; In the dataset The true distribution of the weights; For dataset; Lower bound of evidence; For mathematical expectation; It is the likelihood function; To utilize Divergence calculation probability distribution and Differences between probability distributions; The formula for calculating divergence is: ,in, for Divergence; and These are two probability distributions, with probability density functions respectively. and ; Let be a given random variable; Using Bayesian random dropout with probability Randomly discard neurons, perform multiple forward propagations, and the output of the forward propagation is... The mean of the samples is calculated using the following formula: , in, For a given hour The posterior predicted distribution; Output values for the model; This represents the total number of samples. For the first Secondary sampling; For the first Weight configuration for each sampling; The variance obtained by applying the Bayesian random dropout method needs to be decomposed using the variance decomposition formula, which is as follows: ,in, The total variance of the model; For new input samples The predicted output; For the first Noise variance at the time of sampling; For the first Newest input sample; Configure the model with weights as The input is Deterministic output; yes Transpose of; For predicting output The expected value is the mean of the results from multiple samplings; yes Transpose of; S34. The training of the driving indicator forecasting model uses the root mean square error as the main loss function to measure the deviation between the model's predicted values and the actual values. The calculation formula is as follows: ,in, for Root mean square error; This represents the number of samples in the test set. Number the sample; For the first Predicted values for each sample; For the first The true value of each sample; the root mean square error, combined with early stopping mechanism and regularization strategy, is used to improve the model's generalization ability on the validation set and avoid overfitting; S4. Evaluate the accuracy and precision of the model, and use hyperparameter optimization methods to improve the simulation and forecasting effect; The specific steps of step S4 are as follows: S41. Multiple prediction and evaluation indicators are used to verify the accuracy of the driving indicator forecast model output, in order to quantify the model's fit to the actual water quality change trend; the prediction and evaluation indicators include mean square error. Mean absolute error and coefficient of determination ; S42. Quantitatively evaluate the uncertainty of the prediction output. Use prediction interval coverage to measure the confidence of the prediction interval, average confidence interval width to measure the compactness of the prediction interval, and continuous ranking probability score to comprehensively reflect the quality of the distribution prediction, as follows: The formula for calculating the coverage rate of the predicted interval is as follows: , in, To predict interval coverage; For indicator functions, when The function value is 1 within the upper and lower limits of the prediction interval, and 0 otherwise; For the model to the first The predicted output for each sample; and These are the upper and lower limits of the prediction interval, respectively. The formula for calculating the average confidence interval width is as follows: ,in, This represents the average confidence interval width. The formula for calculating the consecutive ranking probability score is as follows: ,in, Probability score for consecutive rankings; To predict the cumulative distribution function; For Heaviside step function, The function value is 1 at time. The function value is 0 at that time. The model predicts all possible values. S43. Based on the quantitative evaluation results, the system adjusts the key hyperparameters and improves the overall performance of the driving index forecasting model under different forecast durations through grid search or Bayesian optimization strategies. In step S43, the key hyperparameters include learning rate, batch size, and random dropout probability; S5. No need to split the training set and test set, use all data to train the model, and use the trained model to make water quality probability predictions, outputting the prediction mean and confidence interval. The specific steps of step S5 are as follows: S51. After completing the structure and parameter tuning, use complete historical data to train the model for the final time to maximize data utilization and model stability, so that the final prediction results have the generalization ability of full sample support. S52. For the target forecast time window, the model outputs the forecast mean and the corresponding uncertainty interval for each forecast time point, providing quantitative basis and risk assessment information for management decisions. In step S52, the uncertainty interval is a 90% confidence interval.
[0019] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A water quality probabilistic prediction method based on Bayesian multi-temporal deep learning, characterized in that, Includes the following steps: S1. Determine the forecast water environment and water ecology indicators, driving indicators, and forecast days; S2. Collect time series data of forecast indicators and driving indicators, perform data preprocessing, and construct the dataset required for model construction. S3. Divide the time series data, construct a driving indicator forecasting model using a multi-time series deep learning method, and select the Bayesian random dropout method for parameter learning. S4. Evaluate the accuracy and precision of the model, and use hyperparameter optimization methods to improve the simulation and forecasting effect; S5. No need to split the training set and test set, use all data to train the model, and use the trained model to make water quality probability predictions, outputting the prediction mean and confidence interval.
2. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 1, characterized in that, The specific steps of step S1 are as follows: S11. Collect historical water quality monitoring data of the target water area. The historical water quality monitoring data includes the monitoring values of various water environment and water ecology indicators in different time periods. The water environment and water ecology indicators include chlorophyll a, total phosphorus, total nitrogen, dissolved oxygen and chemical oxygen demand. S12. Collect and select input features that are highly correlated with the water environment and water ecology indicators in the forecast, and use the input features as driving indicators; the driving indicators include historical water quality parameters, meteorological variables, flow rate, water level and land use; S13. Taking into account water quality management needs, monitoring frequency, data availability and forecast accuracy, set the forecast water environment and water ecology indicators and forecast days; the forecast days are 1 day, 7 days or 15 consecutive days.
3. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 1, characterized in that, The specific process of step S2 is as follows: S21. After identifying and removing outliers from the monitoring data, the Kalman filter method is used to fuse the observed values and the state estimate in order to improve the estimation accuracy and complete the missing value filling. S22. After normalizing or standardizing various indicators, a multi-source database is constructed.
4. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 3, characterized in that: In step S21, the Kalman filtering method includes establishing a state-space model to describe the concentration change process, setting the covariance matrix of process noise and observation noise, and realizing dynamic imputation of missing values through a prediction-update loop; in step S22, the normalization adopts min-max normalization to map the data to the [0,1] interval; the standardization adopts Z-score standardization to make the data have a distribution with a mean of 0 and a standard deviation of 1.
5. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 1, characterized in that, The specific process of step S3 is as follows: S31. Divide the time series data into training and test sets in an 8:2 ratio according to the chronological order. S32: Based on the task characteristics and temporal dependency structure, a deep learning architecture with the ability to model multivariate long-term time series, capture long-distance dependencies, and attention mechanism is selected to meet the needs of water quality dynamic modeling and to construct a driving indicator forecast model; the deep learning architecture is Crossformer, Informer, or LSTM. S33: Integrating Bayesian methods into a neural network, the posterior distribution of parameters is approximated through random sampling in the forward propagation, achieving synchronous output of the predicted mean and confidence interval. This is used to introduce uncertainty modeling, treating the neural network weights as probability distributions, performing posterior inference to obtain the probability distribution of the predicted results, and then using the probability distribution to approximate the true posterior distribution. The calculation formula is as follows: , ,in, It is a probability distribution; For model weights; For parameters; In the dataset The true distribution of the weights; For dataset; Lower bound of evidence; For mathematical expectation; It is the likelihood function; To utilize Divergence calculation probability distribution and Differences between probability distributions; The formula for calculating divergence is: ,in, for Divergence; and These are two probability distributions, with probability density functions respectively. and ; Let be a given random variable; Using Bayesian random dropout with probability Randomly discard neurons, perform multiple forward propagations, and the output of the forward propagation is... The mean of the samples is calculated using the following formula: , in, For a given hour The posterior predicted distribution; Output values for the model; This represents the total number of samples. For the first Secondary sampling; For the first Weight configuration for each sampling; The variance obtained by applying the Bayesian random dropout method needs to be decomposed using the variance decomposition formula, which is as follows: ,in, The total variance of the model; For new input samples The predicted output; For the first Noise variance at the time of sampling; For the first Newest input sample; Configure the model with weights as The input is Deterministic output; yes Transpose of; For predicting output The expected value is the mean of the results from multiple samplings; yes Transpose of; S34. The training of the driving indicator forecasting model uses the root mean square error as the main loss function to measure the deviation between the model's predicted values and the actual values. The calculation formula is as follows: ,in, for Root mean square error; This represents the number of samples in the test set. Number the sample; For the first Predicted values for each sample; For the first The true value of each sample; the root mean square error, combined with early stopping mechanism and regularization strategy, is used to improve the model's generalization ability on the validation set and avoid overfitting.
6. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 1, characterized in that, The specific steps of step S4 are as follows: S41. Multiple prediction and evaluation indicators are used to verify the accuracy of the driving indicator forecast model output, in order to quantify the model's fit to the actual water quality change trend; the prediction and evaluation indicators include mean square error. Mean absolute error and coefficient of determination ; S42. Quantitatively evaluate the uncertainty of the prediction output. Use prediction interval coverage to measure the confidence of the prediction interval, average confidence interval width to measure the compactness of the prediction interval, and continuous ranking probability score to comprehensively reflect the quality of the distribution prediction, as follows: The formula for calculating the coverage rate of the predicted interval is as follows: , in, To predict interval coverage; For indicator functions, when The function value is 1 within the upper and lower limits of the prediction interval, and 0 otherwise; For the model to the first The predicted output for each sample; and These are the upper and lower limits of the prediction interval, respectively. The formula for calculating the average confidence interval width is as follows: ,in, This represents the average confidence interval width. The formula for calculating the consecutive ranking probability score is as follows: ,in, Probability score for consecutive rankings; To predict the cumulative distribution function; For Heaviside step function, The function value is 1 at time. The function value is 0 at that time. The model predicts all possible values. S43. Based on the quantitative evaluation results, the system adjusts the key hyperparameters and improves the overall performance of the driving index forecasting model under different forecast durations through grid search or Bayesian optimization strategies.
7. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 6, characterized in that: In step S43, the key hyperparameters include the learning rate, batch size, and random dropout probability.
8. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 1, characterized in that, The specific steps of step S5 are as follows: S51. After completing the structure and parameter tuning, use complete historical data to train the model for the final time to maximize data utilization and model stability, so that the final prediction results have the generalization ability of full sample support. S52. For the target forecast time window, the model outputs the forecast mean and the corresponding uncertainty interval for each forecast time point, providing quantitative basis and risk assessment information for management decisions.
9. The water quality probabilistic prediction method based on Bayesian multi-temporal deep learning as described in claim 8, characterized in that: In step S52, the uncertainty interval is a 90% confidence interval.
Citation Information
Cited By
Drainage basin water quality multi-step forecast uncertainty quantification method and system based on double-flow graph state space model
CN122113761A
A method and system for quantifying multi-step prediction uncertainty of watershed water quality based on a two-stream graph state space model
CN122113761B
