Target Circularity and Geographic Generalisation in Machine-Learning Prediction of a Water Quality Index: A Simulation-Based Methodological Critique for the Pra River Basin, Ghana
Abstract
This methodological study uses a controlled simulation, not a new empirical assessment of Pra River Basin water quality, to examine two validation pitfalls that inflate apparent machine-learning performance in predicting a Water Quality Index (WQI): target circularity, where a model is scored on the variables used to construct the index, and optimistic within-domain validation, where random splits mask poor performance outside the sampled domain. A synthetic, 150-record benchmark was generated for the Birim, Offin and Pra sub-basins, with WQI calibrated as a near-deterministic function of pH, TSS, TDS and electrical conductivity. A full-feature model was compared with an auxiliary-only model using XGBoost, Random Forest, linear and Ridge regression, assessed via five-fold and leave-one-sub-basin-out validation. Full-feature XGBoost performed well within sub-basins (R² = 0.729–0.830) but dropped to negative R² when index-defining variables were removed. Transfer was weak for every model: XGBoost produced R² of 0.078 to 22.982 − − out-of-basin, and Ridge showed comparably negative transfer, confirming the failure was not confined to tree ensembles. Reduced auxiliary models did not recover transferable skill. Findings show strong local WQI prediction can coexist with poor geographic transfer and is not resolved by using linear rather than tree-based models, supporting validation aligned with intended deployment.