Water Quality Prediction Model Based on Residual Correction and Optimization of Gated Recurrent Unit and Its Application

GUO Li-jin, CHEN Jian-zheng

Journal of Changjiang River Scientific Research Institute ›› 2026, Vol. 43 ›› Issue (3) : 46-54.

PDF(2130 KB)
PDF(2130 KB)
Journal of Changjiang River Scientific Research Institute ›› 2026, Vol. 43 ›› Issue (3) : 46-54. DOI: 10.11988/ckyyb.20250127
Water Environment and Water Ecology

Water Quality Prediction Model Based on Residual Correction and Optimization of Gated Recurrent Unit and Its Application

Author information +
History +

Abstract

[Objective] The time series of reservoir water quality indices,especially dissolved oxygen content, exhibit strong nonlinearity,high complexity,and uncertainty,which lead to insufficient accuracy of single prediction models.This study aims to construct a high-precision hybrid prediction model that integrates time series decomposition,intelligent optimization,and residual correction,thereby significantly improving the prediction accuracy of dissolved oxygen (DO) content and providing reliable support for water environment management and pollution early warning. [Methods] The core procedures of the proposed hybrid prediction model are as follows. 1) Data decomposition and reconstruction. Singular spectrum analysis (SSA) was applied to decompose the dissolved oxygen time series, and the series was reconstructed into trend components, periodic components, and residual components to reduce sequence complexity and highlight features at different frequencies. 2) An improved dung beetle optimizer (IDBO) which integrates piecewise chaotic mapping and opposition-based learning strategies was designed to enhance population diversity and initialization quality. The improved IDBO was used to optimize key hyperparameters of the GRU network, including the number of hidden layer neurons and the initial learning rate. 3) Component prediction and residual correction. The GRU model optimized by IDBO was used to predict the trend component and periodic components separately. A residual series prediction difference correction method (DCM) was proposed. The residual component was first predicted using GRU, and the difference sequence between the predicted values and the observed values was calculated. Variational mode decomposition (VMD) was then applied to the difference sequence to fully extract high-frequency detail information. Each decomposed component was predicted using GRU and aggregated to obtain the predicted difference values. Finally, the predicted differences were compensated into the initial residual prediction to obtain the corrected residual prediction results. 4) Model integration and validation. The prediction results of the three components were aggregated to obtain the final DO prediction values. Measured dissolved oxygen data from Daheiting Reservoir in Tangshan, Hebei Province were used for experiments. The dataset contained 2352 records with a sampling interval of four hours. Root mean square error (RMSE), mean absolute error (MAE), mean relative error (MRE), and the coefficient of determination (R2) were used as evaluation metrics. The proposed model was compared with GRU, SSA-GRU, SSA-DBO-GRU, SSA-IDBO-GRU, and models reported in the literature such as LSTM and PSO-GRU. [Results] The proposed SSA-IDBO-GRU-DCM hybrid model achieved the best performance among all comparative models. The prediction errors were significantly reduced, with an RMSE of 0.580 2 mg/L, an MAE of 0.329 2 mg/L, an MRE of 0.0269, and an R2 of 0.918 8. Ablation experiments confirmed that the proposed IDBO improvement strategies effectively enhanced hyperparameter optimization accuracy. The residual difference correction method (DCM) significantly improved the prediction performance of the residual component and was the key factor contributing to the overall accuracy improvement. These results fully demonstrated the effectiveness and superiority of the “decomposition-optimization-correction” framework. [Conclusion] SSA effectively decouples the complex characteristics of water quality time series. IDBO efficiently and accurately optimizes GRU hyperparameters. The proposed VMD-GRU-based residual difference correction method (DCM) is the key innovation for improving overall prediction accuracy. The proposed model significantly improves the prediction accuracy of dissolved oxygen content and provides an efficient and reliable new approach for reservoir dissolved oxygen prediction. Future work can extend this framework to the prediction of other key water quality parameters such as ammonia nitrogen and total phosphorus, and further explore the integration of natural evolutionary strategies to improve computational efficiency and generalization ability.

Key words

water quality prediction / singular spectrum analysis / dung beetle optimizer / gated recurrent unit / dissolved oxygen

Cite this article

Download Citations
GUO Li-jin , CHEN Jian-zheng. Water Quality Prediction Model Based on Residual Correction and Optimization of Gated Recurrent Unit and Its Application[J]. Journal of Changjiang River Scientific Research Institute. 2026, 43(3): 46-54 https://doi.org/10.11988/ckyyb.20250127

References

[1]
黎煜昭, 刘启亮, 邓敏, 等. 基于物理约束GRU神经网络的河流水质预测模型[J]. 地球信息科学学报, 2023, 25(1):102-114.
Abstract
河流水质预测对于水环境管理与水污染防治具有重要意义。近年来,以神经网络为代表的非机理性水质预测模型已被广泛应用于河流水质预测领域。然而,此类模型不考虑水质因子变化的物理机理,导致预测结果难以解释、稳定性差。为此,本文将水质因子变化的物理规律视为一种先验知识约束,建模于门控循环单元神经网络(Gated Recurrent Unit, GRU)之中,以河流水质预测的重要参数溶解氧为例,提出了一种物理约束的门控循环单元网络(Physics-constrained Gated Recurrent Unit, PHY_GRU)。以美国亚特兰大市2021年河流溶解氧预测为例进行实例验证,结果表明:① PHY_GRU与差分自回归移动平均模型、多层感知机和门控循环单元模型相比,预测精度和稳定性明显提升,其中预测均方根误差分别降低了94.8%,62.9%和37.2%;② 综合考虑多种物理规律约束可以提升PHY_GRU的预测精度和稳定性;③ PHY_GRU采用门控循环单元模型训练样本的30%,其预测精度和稳定性即可超过门控循环单元模型。本文提供了一种在神经网络模型中融入水质先验知识的研究思路,有助于提升水质预测模型辅助决策的水平。
(LI Yu-zhao, LIU Qi-liang, DENG Min, et al. A Physics-constrained GRU Neural Network for River Water Quality Prediction[J]. Journal of Geo-Information Science, 2023, 25(1):102-114. (in Chinese))
[2]
樊敏, 顾兆林. 非机理性水质模型研究综述[J]. 环境科学与管理, 2009, 34(9): 63-67.
(FAN Min, GU Zhao-lin. Overview on Research Methods for Non-mechanism Water Quality Model[J]. Environmental Science and Management, 2009, 34(9): 63-67. (in Chinese))
[3]
刘永, 蒋青松, 梁中耀, 等. 湖泊富营养化响应与流域优化调控决策的模型研究进展[J]. 湖泊科学, 2021, 33(1): 49-63.
(LIU Yong, JIANG Qing-song, LIANG Zhong-yao, et al. Lake Eutrophication Responses Modeling and Watershed Management Optimization Algo-rithm: A Review[J]. Journal of Lake Sciences, 2021, 33(1): 49-63. (in Chinese))
[4]
TIYASHA, TUNG T M, YASEEN Z M. A Survey on River Water Quality Modelling Using Artificial Intelligence Models: 2000—2020[J]. Journal of Hydrology, 2020, 585: 124670.
[5]
秦梓萱, 郭健, 许模. 基于ARIMA-BP模型的北京市平谷区地下水水质双尺度预测[J]. 兰州大学学报(自然科学版), 2023, 59(1):121-128.
(QIN Zi-xuan, GUO Jian, XU Mo. Dual-scale Prediction of Groundwater Quality Indexes in Pinggu District of Beijing Using the ARIMA-BP Model[J]. Journal of Lanzhou University (Natural Sciences), 2023, 59(1): 121-128. (in Chinese))
[6]
李金泽, 叶春, 李春华, 等. 基于神经网络与马尔可夫链预测地表水净化装置总氮降解的效果[J]. 净水技术, 2018, 37(12): 107-112.
(LI Jin-ze, YE Chun, LI Chun-hua, et al. Effect of Surface Water Purification Device on TN Degradation Based on Prediction of Neural Network and Markov Chain[J]. Water Purification Technology, 2018, 37(12): 107-112. (in Chinese))
[7]
都好. 基于模糊数学和灰色系统理论的太湖流域水质研究[J]. 水利技术监督, 2022(2):187-189,244.
(DU Hao. Research on Water Quality in the Taihu Lakebasinbased on Fuzzy Mathematics and Grey System Theory[J]. Technical Supervision in Water Resources, 2022(2):187-189,244.(in Chinese))
[8]
王凤艳, 汤玉福. 人工神经网络法在大清河水质评价中的应用[J]. 东北水利水电, 2019, 37(6):25-26,35.
(WANG Feng-yan, TANG Yu-fu. Application of Artificial Neural Network Method in Water Quality Evaluation for Daqinghe River[J]. Water Resources & Hydropower of Northeast China, 2019, 37(6):25-26,35.(in Chinese))
[9]
王渤权, 金传鑫, 周论, 等. 基于长短期记忆网络的西丽水库水质预测[J]. 长江科学院院报, 2023, 40(6):64-70.
Abstract
西丽水库是深圳重要饮水源之一,水库的水质影响着全市人民的供水安全。为及时准确预测西丽水库水质结果,以指导水库水厂供水计划的制定,在利用自适应噪声的完备集合经验模态分解方法进行数据分解的基础上,利用长短期记忆网络(LSTM)模型,建立了基于LSTM的西丽水库水质预测模型。通过模拟计算发现,模型模拟效果较好,其中水质预测模型中总氮、氨氮及总磷的预测结果与实测结果吻合度均较高,能够很好地模拟水库水质浓度变化过程;且对于总氮和氨氮,模型的相对预报误差能控制在10%以下,说明了所建模型的合理性。研究成果可为西丽水库的水质预测及供水计划的制定提供重要模型与技术支撑。
(WANG Bo-quan, JIN Chuan-xin, ZHOU Lun, et al. Water Quality Prediction for Xili Reservoir Based on Long-Short Term Memory[J]. Journal of Changjiang River Scientific Research Institude, 2023, 40(6):64-70 (in Chinese)
[10]
鲁言波, 陈湛峰, 李晓芳. 基于粒子群优化的GRU广东省跨境断面水质预测模型研究[J]. 生态环境学报, 2023, 32(9): 1673-1681.
Abstract
水质预测是跨界断面环境风险分析的重要方法,对水质监控和水源保护具有重要作用。GRU是水质预测的常规模型,但广东跨界断面众多、水质数据变化较大,不同断面不同时间段的GRU水质预测需要对超参数进行多次训练调整,以保证模型获得较高的精度。为快速简便地实现GRU模型的迁移使用,提出了PSO-GRU水质预测模型,引入粒子群优化算法,对GRU的超参数进行优化,减少了超参数设置的经验性和随机性,提高模型预测精度。构建PSO-GRU水质预测模型的步骤主要为,1)分析水质特征,确定滑动窗口,构建数据集(训练集、验证集、测试集);2)设置PSO-GRU的相关参数的初始值,通过计算PSO的适应度值来获得新的GRU超参数,经过迭代,追踪超参数局部最优解和全局最优解,最终得到全局最优超参数;3)将最优超参数构建GRU模型进行水质预测。将PSO-GRU用于8个跨境断面水质预测,并与LSTM、GRU模型进行对比,结果表明,1)PSO-GRU模型拥有较好的泛化性,能够在8个跨境断面水质预测中迁移使用,并取得较好的预测结果,达到应用要求。2)LSTM、GRU超参数的设置需要经过多次试验,且难以获得超参数的全局最优值,PSO-GRU能够自适应调试超参数,预测结果优于其他模型,S<sub>RMSE</sub>、S<sub>MAE</sub>、S<sub>MAPE</sub>较LSTM、GRU分别降低了39.6%、35.6%、38.6%和39.1%、34.8%、37.8%。3)降雨量作为输入能够提高PSO-GRU的预测精度,与历史数据组合输入能取得更高的精度。PSO-GRU结构简单,易于实现,且泛化能力强,能够快速迁移到其他断面进行水质预测,为快速简便水质预测提供了实践依据。
(LU Yan-bo, CHEN Zhan-feng, LI Xiao-fang. A Study on Water Quality Prediction Model of Cross-boundary Sections in Guangdong Province Based on GRU Improved with Particle Swarm Optimization[J]. Ecology and Environment Sciences, 2023, 32(9): 1673-1681. (in Chinese))

The downstream of many cross-boundary sections in Guangdong Province serves as an important drinking water source. Water quality prediction is important for environmental risk analysis of cross-boundary sections and plays an important role in water quality monitoring and water source protection. The GRU model is commonly used for water quality prediction. However, with many cross sections and significant variations in water quality data in Guangdong Province, multiple training and adjustment of hyperparameters are required to ensure higher accuracy of the model in predicting water quality for different sections and time periods. For quick and easy transfer of GRU models, the PSO-GRU model was proposed. The particle swarm optimization algorithm was introduced to optimize the hyperparameters of GRU, which reduced the experience and randomness of the setting of hyperparameters and improved the prediction accuracy of the model. The steps to construct the PSO-GRU model are as follows: 1) analyzing the water quality characteristics, determining the sliding window, and building the data set (training set, verification set, test set); 2) setting the initial values of related parameters of PSO-GRU, and obtaining new hyperparameters of GRU by calculating the fitness value of PSO. After iteration, tracing the local optimal solution and global optimal solution of the hyperparameters, and finally obtaining the global optimal hyperparameters; 3) the optimal hyperparameters were used to construct a GRU model for water quality prediction. The PSO-GRU model was applied to predict water quality in 8 cross-boundary sections, and compared with LSTM and GRU models. The results showed that 1) the PSO-GRU model met the application requirement and has good generalization and achieved accurate predictions, surpassing the performance of other models. 2) The configuration of LSTM and GRU hyperparameters requires many tests, and it is difficult to obtain the globally optimal values. PSO-GRU, on the other hand, exhibits adaptability in fine-tuning the hyperparameters, resulting in superior prediction outcomes compared to other models. Compared with LSTM and GRU, PSO-GRU demonstrates a significant reduction in RMSE, MAE and MAPE by 39.6%, 35.6%, and 38.6% and 39.1%, 34.8% and 37.8%, respectively. 3) The inclusion of rainfall data as an input improved the prediction accuracy of the PSO-GRU model, and combining with historical data can achieve higher accuracy. PSO-GRU is simple in structure, easy to implement, and has strong generalization ability. It provides a practical basis for fast and simple water quality prediction, allowing for quick migration to other sections.

[11]
徐倩文. 基于GRU的水质数据预测[J]. 中国新通信, 2020, 22(22):123-124.
(XU Qian-wen. Prediction of Water Quality Data Based on GRU[J]. China New Telecommunications, 2020, 22(22):123-124. (in Chinese))
[12]
ZHOU S, SONG C, ZHANG J, et al. A Hybrid Prediction Framework for Water Quality with Integrated W-ARIMA-GRU and LightGBM Methods[J]. Water, 2022, 14(9): 1322.
[13]
刘芊彤, 邢远秀. 基于VMD-PSO-GRU模型的锂离子电池剩余寿命预测[J]. 储能科学与技术, 2023, 12(1): 236-246.
Abstract
准确预测锂电池的剩余使用寿命(remaining useful life, RUL)对降低电池使用风险和保证系统的安全运行起着非常重要的作用。为了消除电池容量序列受容量再生等影响,提高预测结果的准确性和稳定性,提出了一种基于变分模态分解(variational modal decomposition,VMD)与参数优化的门控循环神经网络(gate recurrent unit,GRU)相结合的RUL预测模型。首先采用VMD算法将锂电池的容量序列分解为一系列平稳分量;然后采用多层GRU网络对各分量进行预测,针对预测结果不稳定的问题,在模型训练前利用粒子群算法(particle swarm optimization, PSO)对GRU模型的参数进行优化;最后叠加各分量的预测值作为最终预测结果。在NASA数据集上对本模型进行了验证,当采用20个已知电池序列数据预测时,预测结果的最大平均绝对百分比误差和均方根误差控制在0.88%和0.0148以内,RUL预测的最大误差不超过2个充电周期,具有较高的鲁棒性和预测精度。
(LIU Qian-tong, XING Yuan-xiu. Remaining Life Prediction of Lithium-ion Battery Based on VMD-PSO-GRU Model[J]. Energy Storage Science and Technology, 2023, 12(1): 236-246. (in Chinese))

Accurately predicting the remaining useful life (RUL) of lithium batteries plays a significant role in reducing battery risk and ensuring the safe operation of the system. To reduce the influence of battery capacity regeneration, and improve the accuracy and stability of RUL prediction, an integrated prediction model of variational modal decomposition and gate recurrent unit (GRU) network with particle swarm optimization algorithm was proposed. First, the capacity sequence of the lithium battery was decomposed into a series of stationary components using the variational modal decomposition algorithm. Then, the multiple GRU network was used to predict the capacity component on each sub-sequence. To deal with inconsistent prediction results, particle swarm optimization was used to optimize the parameters of the GRU model before model training. Finally, the predicted results of each sub-sequences were integrated as the final battery capacity estimation, followed by the prediction of RUL. The experimental results on the National Aeronautics and Space Administration dataset showed that the maximum mean absolute percentage error and root mean square error of the results were controlled within 0.88% and 0.0148, respectively, and the maximum error of RUL prediction was less than two charging cycles. It has high robustness and prediction accuracy.

[14]
杨坪宏, 胡奥, 崔东文, 等. 基于数据处理与若干群体算法优化的GRU/LSTM水质时间序列预测[J]. 水资源与水工程学报, 2023, 34(4): 45-53.
(YANG Ping-hong, HU Ao, CUI Dong-wen, et al. Prediction of GRU/LSTM Water Quality Time Series Based on Data Processing and Optimization of Several Swarm Intelligence Algorithms[J]. Journal of Water Resources and Water Engineering, 2023, 34(4): 45-53. (in Chinese))
[15]
王文州, 魏文华, 卫德林. 基于EMD-DBO-GRU的降水预测模型研究及应用[J]. 甘肃水利水电技术, 2023, 59(9): 9-13.
(WANG Wen-zhou, WEI Wen-hua, WEI De-lin. Research and Application of Precipitation Prediction Model Based on EMD-DBO-GRU[J]. Gansu Water Resources and Hydropower Technology, 2023, 59(9): 9-13. (in Chinese))
[16]
XUE J, SHEN B. Dung Beetle Optimizer: A New Meta-heuristic Algorithm for Global Optimization[J]. The Journal of Supercomputing, 2023, 79(7): 7305-7336.
[17]
CHO K, VAN MERRIËNBOER B, BAHDANAU D, et al. On the Properties of Neural Machine Translation: Encoder-Decoder Approaches[C]// Proceedings of SSST-8, Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation. Doha, Qatar Association for Computational Linguistics,2014:103-111.
[18]
COLEBROOK J M. ContinuousPlankton Records:Zooplankton and Environment, Northeast Atlantic and North-Sea,1948—1975[J]. Oceanologica Acta, 1978, 1(1):9-23.
[19]
戴豪民, 许爱强, 孙伟超. 基于改进奇异谱分析的信号去噪方法[J]. 北京理工大学学报, 2016, 36(7): 727-732, 759.
(DAI Hao-min, XU Ai-qiang, SUN Wei-chao. Signal Denoising Method Based on Improve Singular Spectrum Analysis[J]. Transactions of Beijing Institute of Technology, 2016, 36(7): 727-732, 759.(in Chinese))
[20]
KAZIMIPOUR B, LI X, QIN A K. A Review of Population Initialization Techniques for Evolutionary Algorithms[C]//2014 IEEE Congress on Evolutionary Computation (CEC). July 6-11, 2014, Beijing, China. New York: IEEE Press, 2014: 2585-2592.
[21]
TIZHOOSH H R. Opposition-based Learning: A New Scheme for Machine Intelligence[C]// International Conference on Computational Intelligence for Modelling, Control and Automation and International Conference on Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC'06). November 28-30, 2005, Vienna, Austria. New York: IEEE Press, 2006: 695-701.
[22]
LOURENÇO H R, MARTIN O C, STÜTZLE T. Iterated Local Search[M]// Handbook of Metaheuristics. Boston: Kluwer Academic Publishers, 2006: 320-353.
[23]
徐江, 李艳, 纪晶华. 统计学基础[M]. 2版. 北京: 机械工业出版社, 2015: 33-58.
(XU Jiang, LI Yan, JI Jing-hua. Statistics Essentials[M]. Ed.2.Beijing: China Machine Press, 2015: 33-58.(in Chinese))
PDF(2130 KB)

Accesses

Citation

Detail

Sections
Recommended

/