-
混凝是水处理中应用最广泛的技术之一,混凝药剂投加量的控制是影响混凝效果、提升出水水质的关键。实现对混凝过程药剂投加量的快速准确预测对于给水处理厂节约运行成本和控制水质安全稳定具有重要意义[1]。
传统的混凝药剂投加量控制多采用烧杯试验法和经验目测法[2],具有时间滞后和受人为干扰大等特点[3],且伴有化学试剂的二次污染等问题。随着人工智能技术的发展,由数据驱动的机器学习模型被广泛应用于混凝投药量预测。张凯[4]提出多模型Stacking与时序特征的混凝剂投加量预测方法,并利用水厂运行3年的15×104条数据进行验证。LIN等[5]在时间序列模型的基础上引入了图注意力网络,对水厂11年的6×104条数据进行学习和预测。刘洪波等[6]提出贝叶斯优化BP神经网络的混凝剂加药量预测方法,并以华东地区某给水厂的31×104条数据进行建模和验证。以上研究均为基于长时间序列和充足的样本数据量开展的。然而,由于数据采集方式和传感器设备测量精度的限制,许多水厂从实际运行或者模拟实验中获取的数据量往往难以满足机器学习模型的大数据要求[7-9],这导致所建立预测模型的精度较低,无法指导实际工艺运行。同时,混凝药剂投加量受温度和原水水质的季节性变化影响大,冬季低温和夏季高浊度时水处理难度增大,对混凝剂的需求量相比其他时期也有所增加[10-11]。极端天气变化和水位升高会导致水体浊度增加,为达到快速降浊的目的,混凝剂投加量也会相应增加[12]。对不同水质条件数据进行分类建模与预测有助于提高药剂投加量的预测准确度,然而已有的研究很少在模型构建过程中考虑不同水质条件的影响。
集成学习能够将若干学习器组合得到更全面的学习器,在提高小样本预测的泛化能力问题方面具有良好的表现[13-14]。K-Means聚类是一种无监督学习算法,能够根据指定特征将数据划分为若干类别[15]。因此,为了提高小样本数据下混凝投药量的预测精度,本研究提出一种K-Means聚类结合集成学习的混凝投药量预测方法。根据原水水质特征进行数据分类,结合分类结果采用分层抽样划分测试集和训练集,利用Bagging方法构建包含多种学习器的PAC投加量集成预测模型,并与其他常用模型进行对比分析。研究结果可为小样本数据下的水厂混凝投药量的建模与预测提供参考。
小样本数据下基于K-Means聚类和集成学习的混凝投药预测
Research on coagulation dosing prediction based on K-Means clustering and ensemble learning under small sample data
-
摘要: 为了解决混凝投药预测过程中的小样本问题,提出基于K-Means聚类和集成学习的PAC投加量预测方法。首先,根据原水浊度和水温2个特征采用K-Means聚类将水质分为3类,利用分层抽样从3类水质数据中抽取训练集和测试集;其次,基于Bagging集成学习算法,构建由支持向量机、随机森林、Adaboost、GBDT、Catboost、XGBoost和LightGBM共7种学习器组成的PAC投加量集成预测模型(KM-Bagging);最后,以银川市某给水厂2021—2022年的运行数据为例进行验证。结果表明,KM-Bagging模型对小样本的PAC投加量具有较高预测精度,R2超过0.8,MAPE小于5%。采用6个月和9个月的日监测数据预测PAC投加量,适合数据监测时间短、精度要求不高的情况,预测结果可为原水水质发生突变时的PAC投加量调整提供参考。采用1年的日监测数据预测PAC投加量,预测精度能够满足工程应用的要求,可为水厂实际PAC投加提供辅助指导。研究结果对小样本数据下的混凝药剂投加建模与预测具有参考价值。
-
关键词:
- 混凝投药量预测 /
- 小样本数据 /
- Bagging集成学习 /
- K-Means聚类
Abstract: A PAC dosage prediction method was proposed to address small sample size issues in coagulant dosage prediction. The method was based on K-Means clustering and ensemble learning. Firstly, Water quality was divided into three categories using K-Means clustering based on raw water turbidity and water temperature. The training and test sets were then extracted from the data using stratified sampling. Secondly, a PAC dosage ensemble prediction model (KM-Bagging) was constructed based on the Bagging ensemble learning algorithm. The model consisted of seven learners: Support Vector Machine, Random Forest, Adaboost, Gradient Boosting Decision Tree, Catboost, XGBoost, and LightGBM. The method was validated using operational data from a water supply plant in Yinchuan City from 2021 to 2022. The results showed that the KM-Bagging model had high prediction accuracy for small sample sizes, with an R2 exceeding 0.8 and MAPE less than 5%. When 6- and 9-month daily monitoring data were used to predict PAC dosing, the model was suitable for cases where monitoring time was short and high accuracy was not required. The predicted results can be used as a reference for adjusting the PAC dosage when there was a sudden change in raw water quality. When one year of daily monitoring data was used to predict PAC dosing, the prediction accuracy met the requirements for engineering applications and provided auxiliary guidance for actual PAC dosage in water treatment plants. The results of study can provide reference value for modeling coagulant dosage prediction with small sample data. -
表 1 预处理后各变量的变化范围
Table 1. The range of changes in each variable after preprocessing
原水浊度/NTU 原水pH值 水温/ ℃ 流量/m3 PAM投加量
/(mg·L−1)出水浊度/NTU PAC投加量/(mg·L−1) 23.2±21.8 8.34±0.28 12.8±11.8 2 005±1 205 0.10±0.06 1.7±1.5 2.62±0.88 表 2 数据集划分结果
Table 2. Results of data set partitioning
水质类别 数据量占比/% 训练集数据量/组 测试集数据量/组 Ⅰ 45.5 398 100 Ⅱ 48.5 425 106 Ⅲ 6.0 53 13 表 3 PAC投加量的预测结果对比
Table 3. Comparison of the prediction results of PAC dosage
模型 训练集 测试集 R2 MAPE RMSE R2 MAPE RMSE SVM 0.94 1.56 0.067 0.70 5.07 0.164 RF 0.95 1.86 0.060 0.70 5.14 0.169 adaboost 1.00 0.01 0.002 0.74 4.04 0.156 GBDT 0.99 0.27 0.008 0.77 4.35 0.145 Catboost 0.97 1.54 0.049 0.76 4.79 0.151 XGBoost 0.99 0.30 0.011 0.76 4.42 0.147 LightGBM 0.97 1.35 0.032 0.74 4.79 0.153 Bagging — — — 0.78 4.36 0.141 KM-Bagging — — — 0.81 4.23 0.134 表 4 不同长度数据集下的PAC投加量预测结果对比
Table 4. Comparison of PAC dosing prediction results under different length data sets
数据集长度 模型 R2 MAPE RMSE 100% KM-Bagging 0.81 4.23 0.134 BP 0.42 16.70 0.226 RBF 0.50 5.84 0.183 SVM 0.71 4.49 0.147 RF 0.77 4.18 0.135 75% KM-Bagging 0.69 5.07 0.156 BP 0.54 6.37 0.192 RBF 0.51 6.33 0.185 SVM 0.63 5.33 0.169 RF 0.65 5.24 0.156 50% KM-Bagging 0.64 5.73 0.168 BP 0.41 6.73 0.189 RBF 0.40 6.52 0.198 SVM 0.58 6.32 0.166 RF 0.60 6.01 0.168 25% KM-Bagging 0.52 6.48 0.198 BP 0.41 7.21 0.234 RBF 0.42 6.89 0.217 SVM 0.47 6.58 0.213 RF 0.47 6.56 0.208 -
[1] 程方, 秦涛, 赵现勇, 等. 加药量和水力搅拌速度对雨水混凝效果的影响[J]. 环境工程学报, 2012, 6(11): 3905-3909. [2] 何嘉莉, 袁耀芬, 周沛良, 等. 自来水厂混凝剂自动精准投加系统建设与运行[J]. 中国给水排水, 2021, 37(18): 139-143. [3] 王涛, 吴福雨, 程紫微, 等. 基于5参数GA-BP模型的出水水质预测——以宁夏某水厂为例[J/OL]. 环境保护科学: 1-10. [4] 张凯. 集成学习框架下的水厂混凝剂智慧投加预测模型构建 [J/OL]. 工业水处理, 1-11[2024-01-17] https://doi.org/10.19965/j.cnki.iwt.2023-0257. [5] LIN S B, KIM J, HUA C, et al. Coagulant dosage determination using deep learning-based graph attention multivariate time series forecasting model[J]. Water Research, 2023, 232: 119665. doi: 10.1016/j.watres.2023.119665 [6] 刘洪波, 黄剑虹, 张国荣, 等. 给水厂混凝剂智能投加模型构建与应用[J]. 上海理工大学学报, 2022, 44(4): 351-356+387. [7] MAIER H R, MORGAN N, CHOW C W K. Use of artificial neural networks for predicting optimal alum doses and treated water quality parameters[J]. Environmental Modelling and Software, 2004, 19(5): 485-494. doi: 10.1016/S1364-8152(03)00163-4 [8] VINITHA E V, AHAMMED M, GADEKAR M R. Chemical coagulation of greywater: modelling using artificial neural networks[J]. Water Science and Technology, 2018, 2017(3): 869-877. doi: 10.2166/wst.2018.263 [9] 余峰, 王珂佳, 张文龙, 等. 基于遗传算法优化BP神经网络的水生态修复原位控浊混凝投药预测[J]. 环境工程, 2023, 41(4): 154-163. [10] 王涛, 张俊, 王坪, 等. 基于高效絮凝沉淀池与翻板滤池组合工艺的工程案例[J]. 环境工程学报, 2023, 17(3): 1043-1050. [11] DAYARATHNE H N P, ANGOVE M J, JEONG S, et al. Effect of temperature on turbidity removal by coagulation: Sludge recirculation for rapid settling[J]. Journal of Water Process Engineering, 2022, 46: 102559. doi: 10.1016/j.jwpe.2022.102559 [12] ZHANG P, CAI Y, WANG J. A simulation-based real-time control system for reducing urban runoff pollution through a stormwater storage tank[J]. Journal of Cleaner Production, 2018, 183: 641-652. doi: 10.1016/j.jclepro.2018.02.130 [13] 王增帅. 基于集成学习的不平衡数据分类问题研究[D]. 北京: 北京交通大学, 2022. [14] 王雪晴, 刘小军, 刘艳, 等. 采用最优集成学习的小样本电磁脉冲信号分类[J]. 振动与冲击, 2023, 42(11): 193-198. [15] YU S W, WEI Y M, FAN J L, et al. Exploring the regional characteristics of inter-provincial CO2 emissions in China: An improved fuzzy clustering analysis based on particle swarm optimization[J]. Applied Energy, 2012, 92: 552-562. [16] 徐琛辉, 马明辉. 基于拉依达准则的交通数据粗大误差处理优化方法[J]. 上海工程技术大学学报, 2018, 32(1): 4. [17] 梁曦文, 肖峰, 闵昊凌, 等. 基于ESMD-LSSVM模型的径流式水电站出力预测研究[J]. 中国农村水利水电, 2023(9): 224-229+235. [18] LU C, DEVOS A, SUYKENS J, et al. Bagging linear sparse Bayesian learning models for variable selection in cancer diagnosis[J]. IEEE Transactions on Information Technology in Biomedicine, 2001, 11(3): 338-347. [19] 陈俊彦, 卢贤涛, 黄雪锋, 等. 基于Double-Bagging特征降维异质集成入侵检测[J]. 计算机工程与科学, 2023, 45(6): 1011-1019. [20] 丁世飞, 齐丙娟, 谭红艳. 支持向量机理论与算法研究综述[J]. 电子科技大学学报, 2011, 40(1): 2-10. [21] CHEN K Y, CHEN H X, ZHOU C L, et al. Comparative analysis of surface water quality prediction performance and identification of key water parameters using different machine learning models based on big data[J]. Water Research, 2020, 171: 115454. doi: 10.1016/j.watres.2019.115454 [22] 鲁淑霞, 张振莲, 翟俊海. 代价敏感惩罚AdaBoost算法的非平衡数据分类[J]. 南京航空航天大学学报, 2023, 55(2): 339-346. [23] 徐玲, 景向楠, 杨英, 等. 基于SMOTE-GA-CatBoost算法的全国地表水水质分类评价[J]. 中国环境科学, 2023, 43(7): 3848-3856. [24] WEI S, CHEN Z, ARUMUGASAMY S K, et al. Data augmentation and machine learning techniques for control strategy development in bio-polymerization process[J]. Environment Science and Ecotechnology, 2022, 11: 100172. doi: 10.1016/j.ese.2022.100172 [25] 阎有运, 常波, 刘建国, 等. ANFIS在混凝投药前馈控制器中应用的仿真研究[J]. 环境工程学报, 2010, 4(6): 1357-1362. [26] 庹婧艺, 徐冰峰, 徐悦, 等. 优化RBF神经网络控制水厂混凝剂投加的研究[J]. 中国农村水利水电, 2021(8): 212-215+220. doi: 10.3969/j.issn.1007-2284.2021.08.036 [27] 伊学农, 韦秋梅, 何通, 等. 基于GA-BP网络混凝投药系统预测模型的研究[J]. 化工自动化及仪表, 2009, 36(2): 75-78.