Seasonal Spatio-Temporal Machine Learning with Conformal Uncertainty for Forecasting Nitrate, Ammonia, and Orthophosphate in Surface Waters

Authors

  • Rabia Tehseen Department of Computer Science, University of Central Punjab, Lahore, Pakistan
  • Anam Mustaqeem Department of Software Engineering, University of Central Punjab, Lahore, Pakistan
  • Muhammad Inam Ul Haq Department of Computer Science and Bioinformatics, Khushal Khan Khattak University, Karak
  • Maham Mehr Awan Department of Computer Science, University of Central Punjab, Lahore, Pakistan
  • Uzma Omer Department of Information Sciences, University of Education, Lahore, Pakistan
  • Wasif Inayat Diviners & Bitmen International, Lahore, Pakistan
  • Summaya Rafaqat Department of Data Science, University of Central Punjab, Lahore, Pakistan

Keywords:

Water Quality, XGBoost, Random Forest, Forecasting, Anova

Abstract

Proper prediction of nutrient contents in organizations is critical to safeguarding water bodies as well as sustainable environmental management. This article introduces a seasonal spatio-temporal prediction framework of nutrients based on machine learning and estimation of uncertainty. Based on the large-scale monitoring data in 2010-2025, monthly concentrations of nitrate, ammonia, and orthophosphate were modeled at thousands of sampling sites. Fast features: Feature engineering. The temporal dynamics were modeled using seasonal encoding, lag values, and rolling statistics. Three prediction methods were considered: the Random Forest regression, the XGBoost regression, the feed-forward neural networks, and the hybrid model that concluded with the combination of the Random Forest and the neural network learning. Conformal prediction was used to measure prediction uncertainty to produce statistically sound 90 percent prediction intervals. Mean absolute error, root mean square error, coefficient of determination, and interval coverage were used to determine model performance. It was found that the overall performance of Random Forest with conformal prediction (MAE = 0.1008, RMSE = 0.2294, R2 = 0.7746) is the best, followed by the hybrid residual model, presenting the reported results are averaged across nutrients. XGBoost and neural network models also showed a high predictive power, but the accuracy of the models and the uncertainty confidence limits were lower. Significantly lower performance was exhibited by baseline persistence and climatology methods. ANOVA was required to test whether the performance difference of the models was due to statistically significant variation. The solution offered by the suggested framework is accurate, interpretable, and error-aware in the long-term nutrient forecasting. The methodology provides credible data concerning environmental risks and sound decisions on water quality management through the combination of ensemble learning and conformal uncertainty estimation.

References

Kakoli Banerjee, Vikram Bali, “A Machine-Learning Approach for Prediction of Water Contamination Using Latitude, Longitude, and Elevation,” Water, vol. 14, no. 5, p. 728, 2022, [Online]. Available: https://www.mdpi.com/2073-4441/14/5/728

Cris Edward F. Monjardin, Christopher Power, “Application of Machine Learning for Prediction and Monitoring of Manganese Concentration in Soil and Surface Water,” Water, vol. 15, no. 13, p. 2318, 2023, [Online]. Available: https://www.mdpi.com/2073-4441/15/13/2318

Gourab Saha, Chaopeng Shen, Jonathan Duncan, Raj Cibin, “Performance evaluation of deep learning based stream nitrate concentration prediction model to fill stream nitrate data gaps at low-frequency nitrate monitoring basins,” J. Environ. Manage., vol. 357, p. 120721, 2024, [Online]. Available: https://www.sciencedirect.com/science/article/abs/pii/S0301479724007072

Victoria Barcala, Joachim Rozemeijer, Kevin Ouwerkerk, Laurens Gerner, “Value and limitations of machine learning in high-frequency nutrient data for gap-filling, forecasting, and transport process interpretation,” Environ. Monit. Assess., vol. 195, 2023, [Online]. Available: https://link.springer.com/article/10.1007/s10661-023-11519-9

G. Gorski, L. Larsen, J. Wingenroth, L. Zhang, D. Bellugi, A. P. Appling, “Stream Nitrate Dynamics Driven Primarily by Discharge and Watershed Physical and Soil Characteristics at Intensively Monitored Sites: Insights From Deep Learning,” Water Resour. Res., 2024, [Online]. Available: https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2023WR036591

J. M. S. Xindi C. Hu, Mona Dai, “The Utility of Machine Learning Models for Predicting Chemical Contaminants in Drinking Water: Promise, Challenges, and Opportunities,” Curr. Environ. Heal. Reports, vol. 10, 2023, [Online]. Available: https://link.springer.com/article/10.1007/s40572-022-00389-x

Melinda L. Erickson, Sarah M. Elliot, “Machine-Learning Predictions of High Arsenic and High Manganese at Drinking Water Depths of the Glacial Aquifer System, Northern Continental United States,” Environ. Sci. Technol., vol. 55, no. 9, 2021, [Online]. Available: https://pubs.acs.org/doi/10.1021/acs.est.0c06740#Abstract

Divas Karimanzira, Jonas Weis, “Application of machine learning and deep neural networks for spatial prediction of groundwater nitrate concentration to improve land use management practices,” Front. water, vol. 12, 2023, [Online]. Available: https://www.frontiersin.org/journals/water/articles/10.3389/frwa.2023.1193142/full

Julius Caesar Kwio-Tamale; Charles Onyutha, “Space–time prediction of residual chlorine in a water distribution network using artificial intelligence and the EPANET hydraulic model,” Water Pract. Technol., vol. 19, no. 10, pp. 4049–4061, 2024, [Online]. Available: https://iwaponline.com/wpt/article/19/10/4049/104680/Space-time-prediction-of-residual-chlorine-in-a

Jayesh Soni, Himanshu Upadhyay, “Machine Learning Approach for Groundwater Contamination Spatiotemporal Relationship Exploration,” Water, vol. 17, no. 1, p. 121, 2025, [Online]. Available: https://www.mdpi.com/2073-4441/17/1/121

Qiong Wu, Xinghui Xia, “Trends of water quantity and water quality of the Yellow River from 1956 to 2009: implications for the effect of climate change,” Environ. Syst. Res., vol. 3, 2014, [Online]. Available: https://link.springer.com/article/10.1186/2193-2697-3-1

Vassilis Z. Antonopoulos, Dimitris M. Papamichail and Konstantina A. Mitsiou, “Statistical and trend analysis of water quality and quantity data for the Strymon River in Greece,” Hydrol. Earth Syst. Sci., vol. 5, no. 4, pp. 679–691, 2001, [Online]. Available: https://hess.copernicus.org/articles/5/679/2001/hess-5-679-2001.pdf

Furqan Rustam, Abid Ishaq, “An Artificial Neural Network Model for Water Quality and Water Consumption Prediction,” Water, vol. 14, no. 21, p. 3359, 2022, [Online]. Available: https://www.mdpi.com/2073-4441/14/21/3359

Feng Lin, Xu Li, Yang Su, “Water quality prediction model based on improved long short-term memory neural network and empirical mode decomposition,” Discov. Artif. Intell., vol. 5, no. 199, 2025, [Online]. Available: https://link.springer.com/article/10.1007/s44163-025-00454-y

J. C. Zhenyu Gao, “A novel multivariate time series prediction of crucial water quality parameters with Long Short-Term Memory (LSTM) networks,” J. Contam. Hydrol., vol. 259, 2023, [Online]. Available: https://pubmed.ncbi.nlm.nih.gov/37944201/

P. Prabu, Ala Saleh Alluhaidan, Romana Aziz, “Comparative analysis of machine learning models for detecting water quality anomalies in treatment plants,” Sci. Rep., vol. 15, 2025, [Online]. Available: https://www.nature.com/articles/s41598-025-15517-4

E. Abascal, L. Gómez-Coma, “Nitrate prediction in groundwater of data scarce regions: The futuristic fresh-water management outlook,” Sci. Total Environ., vol. 905, p. 166863, 2023, [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0048969723054888

Jialin Dong, Gabriel Tsai, “Prediction of 35 target per-and polyfluoroalkyl substances (PFASs) in California groundwater using multilabel semisupervised machine learning,” ACS ES T Water, 2023, [Online]. Available: https://pubs.acs.org/doi/10.1021/acsestwater.3c00134

Andrea K. Tokranov, Katherine M. Ransom, “Predictions of groundwater PFAS occurrence at drinking water supply depths in the United States,” Science (80-. )., 2024, [Online]. Available: https://www.science.org/doi/10.1126/science.ado6638

B. T. N. K. M. Ransom, “Machine learning predictions of nitrate in groundwater used for drinking supply in the conterminous United States,” Sci. Total Environ., vol. 807, 2022, [Online]. Available: https://pubmed.ncbi.nlm.nih.gov/34673076/

Jeimmy Adriana Muñoz-Alegría, Jorge Núñez, “A Bibliometric-Systematic Literature Review (B-SLR) of Machine Learning-Based Water Quality Prediction: Trends, Gaps, and Future Directions,” Water, vol. 17, no. 20, p. 2994, 2025, [Online]. Available: https://www.mdpi.com/2073-4441/17/20/2994

Hankun He, Takuya Boehringer, Benjamin Schäfer, Kate Heppell, Christian Beck, “Analyzing spatio-temporal dynamics of dissolved oxygen for the River Thames using superstatistical methods and machine learning,” Sci. Rep., vol. 24, 2014, [Online]. Available: https://www.nature.com/articles/s41598-024-72084-w

C. Onyutha, “Multiple Statistical Model Ensemble Predictions of Residual Chlorine in Drinking Water: Applications of Various Deep Learning and Machine Learning Algorithms,” J. Environ. Public Health, 2022, [Online]. Available: https://onlinelibrary.wiley.com/doi/10.1155/2022/7104752

N. Mahesh, J. Jagan Babu, “Water quality prediction using LSTM with combined normalizer for efficient water management,” Desalin. Water Treat., vol. 317, no. 1, p. 100183, 2024, [Online]. Available: https://www.researchgate.net/publication/379576510_Water_quality_prediction_using_LSTM_with_combined_normalizer_for_efficient_water_management

Leslie A. DeSimone, “Preliminary Machine Learning Models of Manganese and 1,4-Dioxane in Groundwater on Long Island, New York,” Sci. Investig. Rep., 2023, [Online]. Available: https://pubs.usgs.gov/publication/sir20225120

Adewale Ajao, “Application Of Machine Learning To Understand Pfas Occurrence, Distribution, Transport And Removal In Water,” Preprints, 2024, [Online]. Available: https://www.preprints.org/manuscript/202403.0627/v1

Tae June Choi, Hyung Eun An, “Machine Learning Models for Identification and Prediction of Toxic Organic Compounds Using Daphnia magna Transcriptomic Profiles,” Life, vol. 12, no. 9, p. 1443, 2022, [Online]. Available: https://www.mdpi.com/2075-1729/12/9/1443

A. M. S. R. A. Gangani Dharmarathne, “A review of machine learning and internet-of-things on the water quality assessment: Methods, applications and future trends,” Results Eng., vol. 26, no. 1, p. 105182, 20252, [Online]. Available: https://www.researchgate.net/publication/391383955_A_review_of_machine_learning_and_internet-of things_on_the_water_quality_assessment_methods_applications

_and_future_trends

Md Saiful Alam, Mohammed M. Rahman, “Predictive modeling of PFAS behavior and degradation in novel treatment scenarios: A review,” Process Saf. Environ. Prot., vol. 196, p. 106869, 2025, [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0957582025001363

Chao Liu, Mingshuang Xu, “Predicting Groundwater Indicator Concentration Based on Long Short-Term Memory Neural Network: A Case Study,” Int. J. Environ. Res. Public Heal., vol. 9, no. 23, p. 15612, 20221, [Online]. Available: https://www.mdpi.com/1660-4601/19/23/15612

A. Cislaghi, P. Fogliata, E. Morlotti, and G. B. Bischetti, “Towards a better understanding of river dynamics in semi-urbanised areas: a machine learning analysis on time-series satellite images,” Mar. 2021, doi: 10.5194/EGUSPHERE-EGU21-3069.

Chak Hau Michael Tso, Eugene Magee, “River reach-level machine learning estimation of nutrient concentrations in Great Britain,” Front. water, 2023, [Online]. Available:https://www.frontiersin.org/journals/water/articles/10.3389/frwa.2023.1244024/full

Mengjie He, Qin Qian, “Recent Progress on Surface Water Quality Models Utilizing Machine Learning Techniques,” Water, vol. 16, no. 24, p. 3616, 2024, doi: https://doi.org/10.3390/w16243616.

T. D. Mrunmayee Dhapre, Shrikant Jadhav, Debanjana Das, Jehanzeb Khan, Youngsoo Kim, Sen Chiao, “A systematic review of machine learning in groundwater monitoring,” Environ. Model. Softw., vol. 192, p. 106549, 2025, [Online]. Available: https://www.sciencedirect.com/science/article/pii/S1364815225002336

Jae Min Lee, Kyung-Seok Ko, Keunje Yoo, “A machine learning-based approach to predict groundwater nitrate susceptibility using field measurements and hydrogeological variables in the Nonsan Stream Watershed, South Korea,” Appl. Water Sci., vol. 13, 2023, [Online]. Available: https://link.springer.com/article/10.1007/s13201-023-02043-9

Heng Yang, Panlei Wang, Anqiang Chen, Yuanhang Ye, Qingfei Chen, Rongyang Cui, Dan Zhang, “Prediction of phosphorus concentrations in shallow groundwater in intensive agricultural regions based on machine learning,” Chemosphere, vol. 313, p. 137623, 2023, doi: https://doi.org/10.1016/j.chemosphere.2022.137623.

Downloads

Published

2026-01-22

How to Cite

Rabia Tehseen, Anam Mustaqeem, Muhammad Inam Ul Haq, Maham Mehr Awan, Omer, U., Wasif Inayat, & Summaya Rafaqat. (2026). Seasonal Spatio-Temporal Machine Learning with Conformal Uncertainty for Forecasting Nitrate, Ammonia, and Orthophosphate in Surface Waters. International Journal of Innovations in Science & Technology, 8(1), 179–195. Retrieved from https://journal.50sea.com/index.php/IJIST/article/view/1695

Most read articles by the same author(s)

<< < 1 2