Limits to the Spatial Transferability of Machine-Learning Models for Farm-Record-Level Maize Yield Prediction in Manabí, Ecuador
Abstract
Farm-level yield models are commonly evaluated using random train–test partitions; however, spatial dependence among geographically related observations can lead to overly optimistic estimates of predictive performance and may not adequately reflect generalization to unseen locations. This study evaluated whether supervised machine-learning models could predict farm-level hard dry maize yield in previously unseen parishes of Manabí, Ecuador. The response variable was record-level maize yield, while predictors included survey-derived farm, crop, producer, management, socioeconomic, and digital-access characteristics. Climate-enhanced models additionally included crop-season cumulative precipitation, longest dry spell, mean 2 m air temperature, and mean upper-layer soil moisture. The analysis comprised 518 sole-crop hard dry maize records representing 433 producers in 45 parishes. Elastic Net, Random Forest, and histogram-based gradient boosting models were compared with a training-fold mean benchmark using nested cross-validation grouped by parish. The mean observed yield was 4.09 t ha−1. The benchmark achieved a mean absolute error (MAE) of 1.534 t ha−1, whereas the best survey-only and survey-plus-climate models achieved MAE values of 1.535 and 1.548 t ha−1, respectively. For histogram-based gradient boosting, the estimated climate-related MAE reduction was −0.013 t ha−1 (−0.85%; parish-cluster bootstrap 95% CI: −0.061 to 0.036). All model configurations produced negative pooled R2 values. Random record-level validation yielded more favorable results, indicating potential spatial optimism. The findings do not imply that management practices or climate conditions are agronomically unimportant; rather, they indicate that the available survey data and parish-level climate variables were insufficient to support reliable yield prediction for individual crop records in previously unseen parishes.