Explainable machine learning for spatial modelling of groundwater nitrate contamination: a multi-year analysis in the Duero basin
Year: 2026
Type: article
Abstract: Groundwater nitrate contamination is a major water-quality concern, with implications for drinking water supplies and groundwater-dependent ecosystems. This study assesses the Duero River basin (Spain), where groundwater nitrate concentrations have increased in recent decades due to intensive agriculture and livestock farming. The probability of elevated groundwater nitrate concentrations was predicted using machine learning, formulated as a binary classification problem with a threshold of 37.5 mg/L. Monitoring data were combined with spatially derived environmental and anthropogenic predictors. Several tree-based algorithms were evaluated, with Random Forest selected for its consistent predictive performance. Model performance was assessed through repeated nested cross-validation and the use of metrics suitable for imbalanced datasets, achieving an AUC of 0.79-0.88 and an F1-score of 0.56-0.70 for the minority class across the three analysed hydrological years. SHAP analysis identified precipitation, diffuse agricultural pressures, distance to surface water bodies, NDVI, and soil properties as the main contributing predictors. Multi-year probability maps showed substantial spatial coherence with officially designated Nitrate Vulnerable Zones (46.9-64.9%), while identifying additional high-probability areas outside them (12.7-23.6%). The integration of explainable machine learning, multi-year spatial modelling, and regulatory comparison provides a framework to support groundwater monitoring, review vulnerable-zone delineation, and prioritise mitigation measures.
Source: Figshare
Language: English
Subfield: Water Science and Technology
Field: Environmental Science
Domain: Physical Sciences
Keywords: groundwater nitrate contamination, Duero basin, explainable machine learning, SHAP analysis, random forest, nitrate vulnerable zones, agricultural non-point source pollution, animal husbandry, NDVI, soil properties, precipitation, imbalanced classification, groundwater monitoring, water quality
Open Access status: green
OpenAlex ID: W7221068176
