Abstract
This study addresses the challenge of detecting anomalies in water-quality monitoring data, where traditional approaches often lack sufficient temporal and spatial resolution. A data-driven framework integrating ensemble machine-learning models (Random Forest and XGBoost) with residual-based anomaly detection was developed and evaluated using open surface-water monitoring data from Ukraine for 2022. The models were trained to predict key hydrochemical indicators, including nitrogen concentration and dissolved oxygen, using chemical, spatial, and seasonal features. Model robustness was assessed through 5-fold cross-validation, which demonstrated stable predictive performance for both indicators. Anomalies were identified as statistically significant deviations between observed and predicted values. Recurrent anomaly hotspots were subsequently analyzed and spatially mapped, with hotspot locations independently confirmed by both Random Forest and XGBoost models. The results demonstrate that the proposed framework can effectively identify statistically unusual observations and reveal spatially persistent anomaly hotspots across multiple river basins. However, the detected anomalies should be interpreted as statistical deviations rather than confirmed pollution events, as independent pollution-source information was not available. The study highlights the potential of combining ensemble learning, residual analysis, and spatial hotspot identification to support data-driven environmental assessment and monitoring activities.
Subjects
- Engineering
- Environmental sciences
- Hydrology
- Mathematics and computing
- Water resources
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
Reprints and permissions
About this article
Cite this article
Mashkina, I., Nosenko, T. Machine learning-based anomaly detection in surface water quality data using ensemble models with residual analysis.
Sci Rep (2026). https://doi.org/10.1038/s41598-026-64153-z
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-026-64153-z
Keywords
- Artificial intelligence (AI)
- Machine learning (ML)
- Anomaly detection
- Water pollution monitoring
- Ensemble models
- Random forest
- XGBoost
Source: Resources - nature.com
