Ensuring safe and sustainable water resources requires advanced analytical approaches capable of managing the chemical complexity and spatiotemporal variability of natural aquatic systems. This study applies ensemble learning and explainable artificial intelligence (XAI) to predict and interpret the Water Quality Index (WQI) of the Ziz Basin, Morocco, an arid region where geogenic processes and anthropogenic pressures influence water chemistry. We trained a set of ensemble learning models (Gradient Boosting, Random Forest, and XGBoost) on a dataset comprising 26 physicochemical parameters, including major ions (Ca²⁺, Mg²⁺, Na⁺, K⁺, Cl⁻, SO₄²⁻, HCO₃⁻), nutrients (NO₃⁻, NO₂⁻, NH₄⁺, PO₄³⁻), organic load indicators (BOD₅, DCO), heavy metals (Pb2+, Cd2+, Ni2+, Fe2+, Cu2+, Al3+, Zn2+), and general water quality parameters (pH, EC, TDS, turbidity, temperature), collected from 80 monitoring stations in the basin. Among these models, Gradient Boosting achieved the best performance with an R2 score of 0.91 and a low root mean square error (RMSE), confirming its suitability for accurate WQI estimation. To address the challenge of model interpretability, we employed SHAP (SHapley Additive exPlanations) to analyze both global and local feature contributions. The results reveal a strong chemical signal in the prediction process: lead (Pb²⁺) is the most influential parameter with a mean SHAP value of 30.01, followed by cadmium (Cd²⁺, 7.34) and nitrate (NO₃⁻, 4.26), confirming the significant impact of heavy metal contamination and nutrient enrichment in the basin. Moderate contributions were observed for organic load indicators (BOD₅ = 1.24), salinity-related ions (Na⁺ = 0.99; Cl⁻ = 0.45; HCO₃⁻ = 0.33), and transition metals (Ni²⁺ = 0.68; Fe²⁺ = 0.48). The findings demonstrate the potential of XAI-driven analytics to support environmental chemists, hydrologists, and decision-makers in diagnosing pollution sources, prioritizing interventions, and improving sustainable water resource management in data-scarce regions
Bouziane et al. (Sat,) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: