Document Type
Article
Publication Date
2026
Abstract
Maintaining water quality is crucial for both public health and environmental sustainability. This study proposes a machine-learning- (ML-) and Internet-of-Things- (IoT-) based approach to water quality prediction that utilizes explainable artificial intelligence (XAI) and data classification techniques. The proposed approach integrates IoT devices to enhance real-time data collection, facilitating continuous monitoring and early anomaly detection. Ten different ML classifiers—Decision Trees, K-Nearest Neighbors, XGBoost, Naïve Bayes, Logistic Regression, AdaBoost, Random Forests, Support Vector Machines, Voting, and Multi-Layer Perceptron—were evaluated to find out which one works best for predicting water quality. We used three distinct approaches for feature selection: analysis of variance (ANOVA), mutual information (MI), and chi-square, to ensure the most relevant features. We assessed the predictive model using three datasets of varying sizes (5000, 3600, and 1850 records), employing multiple cross-validation techniques to enhance reliability. The Synthetic Minority Oversampling Technique (SMOTE) was used to fix the data imbalance. Experimental findings showed that XGBoost outperformed other classifiers, achieving the highest accuracy across all dataset sizes. Specifically, for the largest dataset, XGBoost achieved 97.12% accuracy, 99.67% AUC (Area under the Curve), 97.95% specificity, 95.95% precision, 95.50% sensitivity, and an F1 score of 95.73%. Similarly, for the mid-sized dataset, XGBoost attained 93.22% accuracy, and for the smallest dataset, it reached 95.46% accuracy. The key contribution of this work is the application of an XAI method using SHAP (SHapley Additive exPlanations), which enhances the model's interpretability by emphasizing key water quality factors that influence predictions. Unlike traditional black-box ML models, this approach provides transparency and facilitates informed decision-making for environmental scientists and policymakers. An efficient, scalable, and time-saving method for predicting water quality is provided by the proposed model, making it suitable for large-scale environmental monitoring and resource-limited settings. This study improves how we manage water resources by providing a clear and accurate prediction model that uses real-time monitoring from IoT and analytics from ML. To promote environmental sustainability and guarantee safer water resources, the results show that AI-powered water quality assessment can support proactive interventions.
Recommended Citation
Abou El-Seoud, M. Samir; Karam, Omar H. 2; and El-Sofany, Hosam 3, "Machine-Learning- and IoT-Based Approach for Predicting Water Quality Using Data Classification and Explainable AI Technique" (2026). Computer Science. 90.
https://buescholar.bue.edu.eg/comp_sci/90