Real-Time COD Prediction in Full-Scale Wastewater Treatment Using Ensemble Learning Models and Systematic Feature Selection

Document Type : Research Article

Authors

1 Department of Chemical Engineering, Shahid Nikbakht School of Engineering, University of Sistan and Baluchestan, Zahedan, Iran

2 Department of Chemical Engineering, Shahid Nikbakht Faculty of Engineering, University of Sistan and Baluchestan, Zahedan, Iran

Abstract

Accurate and timely prediction of Chemical Oxygen Demand (COD) is essential for efficient wastewater treatment plant (WWTP) operation; however, conventional laboratory-based COD measurements are time-consuming and unsuitable for real-time process monitoring. This study develops and compares three ensemble machine learning models—Random Forest (RF), XGBoost, and LightGBM—for COD prediction using six years of operational data collected from the full-scale Melbourne Eastern Treatment Plant. A multi-stage feature selection framework combining Average Rank aggregation, Pearson correlation analysis, and Sequential Backward Elimination was employed to reduce the original 19-variable input space to an optimal subset of five predictors: Total Nitrogen (TN), Biological Oxygen Demand (BOD), year, mean air temperature, and minimum air temperature. Model hyperparameters were optimized using Randomized Search with Time Series Split cross-validation, and predictive performance was evaluated using a chronological train–test split. The results demonstrated that feature selection improved model generalization while reducing model complexity. Among the evaluated algorithms, LightGBM achieved the highest predictive performance on the test dataset (R² = 0.716, RMSE = 76.30 mg/L, and MAE = 56.59 mg/L), outperforming XGBoost (R² = 0.682) and RF (R² = 0.653). TN and BOD consistently emerged as the most influential predictors across all models, highlighting their strong relationship with COD dynamics in wastewater treatment processes. Overall, the findings indicate that LightGBM combined with a systematic feature selection strategy provides an efficient and practically deployable framework for near-real-time COD prediction, offering a promising alternative to conventional laboratory analyses for WWTP monitoring and control.

Highlights

  • A multi-stage feature selection framework reduced 19 input variables to 5 optimal predictors, improving COD prediction accuracy across all ensemble models.
  • LightGBM achieved the best generalization performance with the smallest train-test gap, outperforming XGBoost and Random Forest.
  • TN and BOD were unanimously identified as dominant COD predictors, enabling near-real-time estimation without time-consuming laboratory analysis.

Keywords


[1] Hernández-Chover, V., Bellver-Domingo, Á., Hernández-Sancho, F., 2018. Efficiency of wastewater treatment facilities: the influence of scale economies, Journal of Environmental Management, 228, 77–84. http://dx.doi.org/10.1016/j.jenvman.2018.09.014
[2] Zhao, L., Dai, T., Qiao, Z., Sun, P., Hao, J., Yang, Y., 2020. Application of artificial intelligence to wastewater treatment: a bibliometric analysis and systematic review of technology, economy, management, and wastewater reuse, Process Safety and Environmental Protection, 133, 169–182. http://dx.doi.org/10.1016/j.psep.2019.11.014
[3] Çimen Mesutoğlu, Ö., Gök, O., 2024. Prediction of COD in industrial wastewater treatment plant using an artificial neural network, Scientific Reports, 14, 13750. http://dx.doi.org/10.1038/s41598-024-64634-z
[4] Balogun, S., Ogwueleka, T.C., 2023. Performance prediction for wastewater treatment plant effluent COD using artificial neural network, International Journal of Environmental Science and Technology, 20, 12659–12668. http://dx.doi.org/10.1007/s13762-023-04823-x
[5] An, T., Feng, K., Cheng, P., Li, R., Zhao, Z., Xu, X., Zhu, L., 2024. Adaptive prediction for effluent quality of wastewater treatment plant: improvement with a dual-stage attention-based LSTM network, Journal of Environmental Management, 359, 120887. http://dx.doi.org/10.1016/j.jenvman.2024.120887
[6] Xie, Y., Chen, Y., Wei, Q., Yin, H., 2024. A hybrid deep learning approach to improve real-time effluent quality prediction in wastewater treatment plant, Water Research, 250, 121092. http://dx.doi.org/10.1016/j.watres.2023.121092
[7] Newhart, K.B., Holloway, R.W., Hering, A.S., Cath, T.Y., 2019. Data-driven performance analyses of wastewater treatment plants: a review, Water Research, 157, 498–513. http://dx.doi.org/10.1016/j.watres.2019.03.030
[8] Wang, X., Kvaal, K., Ratnaweera, H., 2019. Explicit and interpretable nonlinear soft sensor models for influent surveillance at a full-scale wastewater treatment plant, Journal of Process Control, 77, 1–6. http://dx.doi.org/10.1016/j.jprocont.2019.03.005
[9] Cong, Q.-M., Bo, G.-H., Shi, H.-Y., 2022. Integrated soft sensor of COD for WWTP based on ASP model and RBF neural network, Measurement and Control, 56, 1–12. http://dx.doi.org/10.1177/00202940221089272
[10] Nair, A., Hykkerud, A., Ratnaweera, H., 2022. Estimating phosphorus and COD concentrations using a hybrid soft sensor: a case study in a full-scale WWTP, Water, 14, 332. http://dx.doi.org/10.3390/w14030332
[11] Bagherzadeh, F., Shojaei Nouri, A., Mehrani, M.-J., Thennadil, S., 2021. Prediction of energy consumption and evaluation of affecting factors in a full-scale WWTP using a machine learning approach, Process Safety and Environmental Protection, 154, 458–466. http://dx.doi.org/10.1016/j.psep.2021.08.040
[12] Jarmondi, K.D.S., Tarinejad, R., Pourali, H., Hosseinpour Salehi, A., Nourani, V., 2025. Advancing wastewater treatment plant for monitoring BOD and COD through explainable AI and feature engineering techniques, Journal of Water Process Engineering, 80, 109237. http://dx.doi.org/10.1016/j.jwpe.2025.109237
[13] Nasr, M., Moustafa, M., Seif, H., El Kobrosy, G., 2012. Application of artificial neural network (ANN) for the prediction of EL-AGAMY wastewater treatment plant performance-Egypt, Alexandria Engineering Journal, 51, 37–43. http://dx.doi.org/10.1016/j.aej.2012.07.005
[14] Lou, I., Zhao, Y., 2012. Sludge bulking prediction using principal component regression and artificial neural network, Mathematical Problems in Engineering, 2012, 917071. http://dx.doi.org/10.1155/2012/237693
[15] Abba, S.I., Elkiran, G., 2017. Effluent prediction of chemical oxygen demand from the wastewater treatment plant using artificial neural network application, Procedia Computer Science, 120, 156–163. http://dx.doi.org/10.1016/j.procs.2017.11.223
[16] Ruben, G.B., Zhang, K., Bao, H., Ma, X., 2018. Application and sensitivity analysis of artificial neural network for prediction of chemical oxygen demand, Water Resources Management, 32, 273–283. http://dx.doi.org/10.1007/s11269-017-1809-0
[17] Dantas, M.S., Christofaro, C., Oliveira, S.C., 2023. Artificial neural networks for performance prediction of full-scale wastewater treatment plants: a systematic review, Water Science and Technology, 88, 1447–1470. http://dx.doi.org/10.2166/wst.2023.276
[18] Pattanayak, A.S., Pattnaik, B.S., Udgata, S.K., Panda, A.K., 2020. Development of chemical oxygen demand (COD) soft sensor using edge intelligence, IEEE Sensors Journal, 20, 14912–14921. http://dx.doi.org/10.1109/JSEN.2020.3010134
[19] Liu, H.-I., Liu, K.F.-R., Chen, S.-H., 2024. Hybrid soft sensing model for accurate COD and DO prediction: integrating PLS regression and time-series forecasting with Kalman filtering, Proceedings of the 2024 IEEE 16th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), 2024. http://dx.doi.org/10.1109/HNICEM64917.2024.11258650
[20] Mahanna, H., El-Rashidy, N., Kaloop, M.R., El-Sapakh, S., Alluqmani, A., Hassan, R., 2024. Prediction of wastewater treatment plant performance through machine learning techniques, Desalination and Water Treatment, 319, 100524. http://dx.doi.org/10.1016/j.dwt.2024.100524
[21] Sahu, P., Londhe, S.N., Kulkarni, P.S., 2023. Prediction of water quality parameters using support vector regression, Innovative Infrastructure Solutions, 8, 229. http://dx.doi.org/10.1007/s41062-023-01195-6
[22] Liu, Z.-J., Wan, J.-Q., Ma, Y.-W., Wang, Y., 2019. Online prediction of effluent COD in the anaerobic wastewater treatment system based on PCA-LSSVM algorithm, Environmental Science and Pollution Research, 26, 12828–12841. http://dx.doi.org/10.1007/s11356-019-04671-8
[23] Pörhö, H., Tomperi, J., Sorsa, A., Juuso, E., Ruuska, J., Ruusunen, M., 2023. Data-based modelling of chemical oxygen demand for industrial wastewater treatment, Applied Sciences, 13, 7848. http://dx.doi.org/10.3390/app13137848
[24] Balogun, S., Ogwueleka, T.C., Arudi, I.S., Olu, A.L., 2026. Machine learning-based modelling of effluent quality of Wupa municipal wastewater treatment plant, Abuja, Nigeria, Cleaner Water, 6, 100238. http://dx.doi.org/10.1016/j.clwat.2026.100238
[25] Ching, P.M.L., Zou, X., Wu, D., So, R.H.Y., Chen, G.H., 2022. Development of a wide-range soft sensor for predicting wastewater BOD5 using an eXtreme gradient boosting (XGBoost) machine, Environmental Research, 210, 112953. http://dx.doi.org/10.1016/j.envres.2022.112953
[26] Yang, S., Kim, J., Eom, J., Kim, M., Lee, M., Lee, K.H., 2025. Machine learning based prediction of waste activated sludge generation for optimization of WWTP operational efficiency, Environmental Research, 286, 122990. http://dx.doi.org/10.1016/j.envres.2025.122990
[27] Wang, Z., Man, Y., Hu, Y., Li, J., Hong, M., Cui, P., 2019. A deep learning based dynamic COD prediction model for urban sewage, Environmental Science: Water Research & Technology, 5, 2210–2218. http://dx.doi.org/10.1039/C9EW00505F
[28] Xu, B., Pooi, C.K., Tan, K.M., Huang, S., Shi, X., Ng, H.Y., 2023. A novel long short-term memory artificial neural network (LSTM)-based soft-sensor to monitor and forecast wastewater treatment performance, Journal of Water Process Engineering, 54, 104041. http://dx.doi.org/10.1016/j.jwpe.2023.104041
[29] Li, J., Lin, S., Zhang, L., Zhong, L., Ding, L., 2025. Innovative multistep and synchronous soft sensing prediction of COD and NH3 in WWTPs via multimodal data and multiple attention mechanisms, Water Research, 278, 123405. http://dx.doi.org/10.1016/j.watres.2025.123405
[30] Samadianfard, S., Aras, E., Yılmaz Çelik, D., Sattari, M.T., Gündüz, O., 2026. Hybrid CEEMDAN-deep learning models for COD prediction in wastewater treatment plants, Environmental Science: Water Research & Technology, 12, 1–15. http://dx.doi.org/10.1039/D6EW00014B
[31] Qiu, C., Huang, F.-Q., Zhong, Y.-J., Wu, J.-Z., Li, Q.-L., Zhan, C.-H., 2025. Comparative analysis and application of soft sensor models in domestic wastewater treatment for advancing sustainability, Environmental Technology, 46, 1959–1980. http://dx.doi.org/10.1080/09593330.2024.2415722
[32] Hassnain, M., Lee, S.M.W., Azhar, M.R., 2025. Soft sensing of biological oxygen demand in industrial wastewater using machine learning models, Journal of Water Process Engineering, 78, 108699. http://dx.doi.org/10.1016/j.jwpe.2025.108699
[33] Lv, J., Wang, H., Chen, Y., Zhang, X., 2024. Enhancing effluent quality prediction in wastewater treatment plants through the integration of factor analysis and machine learning, Bioresource Technology, 393, 130008. http://dx.doi.org/10.1016/j.biortech.2023.130008
[34] Yang, X., Wei, J., Ye, G., Zhao, Y., Li, Z., Qiu, G., Li, F., Wei, C., 2020. The correlations among wastewater internal energy, energy consumption and energy recovery/production potentials in wastewater treatment plant, Science of the Total Environment, 714, 136655. http://dx.doi.org/10.1016/j.scitotenv.2020.136655
[35] Ke, G., Meng, Q., Finley, T., Wang, T., Chen, W., Ma, W., Ye, Q., Liu, T.-Y., 2017. LightGBM: a highly efficient gradient boosting decision tree, in: Advances in Neural Information Processing Systems, 30, 3146–3154.
[36] Melbourne Water, 2021. Melbourne Water. https://www.melbournewater.com.au/about/strategies-and-reports/annual-report
[37] Chen, T., Guestrin, C., 2016. XGBoost: a scalable tree boosting system, Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ACM, New York, 785–794. http://dx.doi.org/10.1145/2939672.2939785
[38] Yu, Y., Zou, Z., Wang, S., 2019. Statistical regression modeling for energy consumption in wastewater treatment, Journal of Environmental Sciences, 75, 201–208. http://dx.doi.org/10.1016/j.jes.2018.03.023