Using ensemble machine learning to predict and understand spatiotemporal water quality variations across diverse watersheds in coastal urbanized areas
Fangnan Xiao, Runche Zhang, Zhanqiang Jian, Wei Liu, Taotao Sun, Weicheng Pang, Han Long, Huapeng Qin
Abstract
In the coastal urbanized areas, watersheds exhibit diverse geographic and pressure factors that drive spatiotemporal variations in water quality. However, existing studies are more focused on single watersheds and lack modeling and attribution frameworks that can integrate data from multiple watersheds. Modeling across watersheds helps capture patterns of sharing and variability in data from different watersheds. There is also a lack of studies that guide large-scale, long-term monitoring based on the importance of monitoring samples. In this study, 105,368 weekly measurements of water quality data during 2021–2023 were collected from 432 sites in 12 Shenzhen and Hong Kong watersheds in the southeast coastal areas of China. An Ensemble Across-watersheds machine learning Model (EAM) was proposed and compared with Single Watershed machine learning Model (SWM) and Grouped Watershed machine learning Model (GWM). EAM can fuse the outputs across watersheds from multiple base models via model stacking. The interpretable Shapley additive explanations (SHAP) method was used to identify the significance of various factors and to interpret the spatiotemporal predictions of water quality. The absolute SHAP value for each sample was used to characterize its significance for spatiotemporal variations in water quality, forming the basis of an optimization strategy for water quality monitoring. The results showed that: (1) the R-square of EAM in the test set of dissolved oxygen, ammonia nitrogen, and total phosphorus was 0.62, 0.74, and 0.65, respectively. The accuracy and generalization of the modeling strategy of EAM were better than those of SWM and GWM. (2) Thresholds and nonlinear relationships with water quality were determined for important geographic factors (tree cover (55 %), distance from the sea (10 km)) and pressure factors (temperature (17–25 °C) and daily rainfall (10 mm)). (3) 20 %-40 % of all samples had higher than average factor contributions; these samples were distributed in coastal areas or under extreme urbanization levels, and during extreme temperatures or heavy rainfall periods. These samples were recommended to be prioritized for collection in large-scale, long-term monitoring. Therefore, the methodology and results in this study contribute to the prediction and attribution of water quality in urbanized coastal watersheds and support integrated watershed management and sustainable ecosystem monitoring.