Anomaly Detection of Water Physicochemical Indicators Based on an Isolation Forest–Random Forest Fusion Algorithm
Main Article Content
Abstract
To overcome the challenges of limited abnormal samples, diverse anomaly patterns, and the insufficient capability of conventional threshold-based methods in detecting multivariate water quality abnormalities, this study develops an anomaly detection approach based on an Isolation Forest–Random Forest fusion algorithm. Hourly automatic monitoring data from an urban river section during 2021–2023 were used to construct a multivariate dataset covering thermal, acid–base, oxygen-related, optical, ionic, nutrient, and organic pollution characteristics. In the proposed framework, standardized water quality samples were first processed by the Isolation Forest model for unsupervised anomaly screening, through which anomaly scores were obtained. These scores were then introduced as enhanced features and combined with the original physicochemical variables as the input of the Random Forest model for anomaly reclassification and key factor identification. Experimental results show that the proposed IF-RF fusion model performed better than conventional threshold-based detection and several representative machine learning methods, demonstrating stronger overall performance across multiple evaluation metrics. Specifically, the F1-score and AUC of the fusion model reached 0.902 and 0.962, respectively. The feature importance results indicate that the anomaly score generated by Isolation Forest contributed most to the final classification, while dissolved oxygen, turbidity, ammonia nitrogen, and COD were identified as the dominant physicochemical factors affecting anomaly detection. Overall, this study provides a practical data-driven method for automatic water quality monitoring, anomaly warning, and refined management of urban rivers.
Downloads
Article Details

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
References
N. Mokua, C. W. Maina, and H. Kiragu, “Anomaly detection for raw water quality: A comparative analysis of the local outlier factor algorithm and the random forest algorithms,” International Journal of Computer Applications, vol. 174, no. 26, pp. 47–54, 2021.
H. Xu, G. Pang, Y. Wang, and Y. Wang, “Deep isolation forest for anomaly detection,” IEEE Transactions on Knowledge and Data Engineering, vol. 35, no. 12, pp. 12591–12604, 2023.
D. Balta, K. A. Balta Kaç, M. Balta, and S. Eken, “Water quality estimation and anomaly detection: A review,” EAI Endorsed Transactions on Internet of Things, vol. 9, no. 4, p. e2, 2023.
E. El-Shafeiy, M. Alsabaan, M. I. Ibrahem, and H. Elwahsh, “Real-time anomaly detection for water quality sensor monitoring based on multivariate deep learning technique,” Sensors, vol. 23, no. 20, p. 8613, 2023.
X. Yan, T. Zhang, W. Du, Q. Meng, X. Xu, and X. Zhao, “A comprehensive review of machine learning for water quality prediction over the past five years,” Journal of Marine Science and Engineering, vol. 12, no. 1, p. 159, 2024.
M. K. Nallakaruppan, E. Gangadevi, M. L. Shri, B. Balusamy, S. Bhattacharya, and S. Selvarajan, “Reliable water quality prediction and parametric analysis using explainable AI models,” Scientific Reports, vol. 14, p. 7520, 2024.
Q. Tian, W. Luo, and L. Guo, “Water quality prediction in the Yellow River source area based on the DeepTCN-GRU model,” Journal of Water Process Engineering, vol. 59, p. 105052, 2024.
R. Hanifa, M. Cha, W. Kang, J. Yu, K. J. Kim, Y. M. Yun, and S. Kim, “Development of water quality analysis for anomaly detection and correlation with case studies in water supply systems,” Electronics, vol. 14, no. 10, p. 1933, 2025.
W. Li, M. Deng, C. Liu, and Q. Cao, “Analysis of key influencing factors of water quality in Tai Lake Basin based on XGBoost-SHAP,” Water, vol. 17, no. 11, p. 1619, 2025.
R. Choudhary, A. Kumar, C. Priyadharsini, M. M. Naik, M. Choudhury, and N. A. Khan, “Predicting water quality index using stacked ensemble regression and SHAP based explainable artificial intelligence,” Scientific Reports, vol. 15, p. 31139, 2025.
X. Rigueira, D. Olivieri, M. Araujo, A. Saavedra, and M. Pazo, “Multivariate functional data analysis and machine learning methods for anomaly detection in water quality sensor data,” Environmental Modelling & Software, vol. 190, p. 106443, 2025.
P. Prabu, A. S. Alluhaidan, R. Aziz, et al., “Comparative analysis of machine learning models for detecting water quality anomalies in treatment plants,” Scientific Reports, vol. 15, p. 30453, 2025.
G. Man, Q. Yun, Q. Zhang, Y. Liu, and Z. Zhang, “Surface water quality classification and prediction model based on multiple machine learning algorithms,” Scientific Reports, vol. 15, p. 39907, 2025.
M. A. A. M. Hridoy, A. I. Shawkat, C. Bordin, et al., “Advanced machine learning models for accurate water quality classification and WQI prediction: Implications for aquatic disease risk management,” Science of the Total Environment, vol. 1008, p. 180965, 2025.
X. Rigueira, D. Olivieri, M. Araujo, and M. Pazo, “An explainable AI model for anomaly detection in water quality data,” Water Resources Management, vol. 40, p. 305, 2026.