TRUSTWORTHY CROP YIELD PREDICTION UNDER SPATIAL DISTRIBUTION SHIFT: AN INTERPRETABLE, UNCERTAINTY-AWARE GRADIENT BOOSTING FRAMEWORK
Keywords:
crop yield prediction; gradient boosting; SHAP; uncertainty quantification; spatial cross-validation; out-of-distribution generalisation; precision agriculture; explainable AI.Abstract
Accurate forecasts of crop yield support food security, agricultural planning and climate-resilient farm decisions. Although machine learning is widely used for yield prediction, three problems persist: random train–test splits that ignore the spatial clustering of farms and therefore overstate performance; point predictions that carry no calibrated uncertainty; and opaque models whose outputs are hard to audit. A fourth problem, confounding of total-yield prediction by farm area, is rarely examined. This study addresses all four in a single reproducible pipeline applied to 3,870 rice farms from four districts and nine blocks of Bihar, India (54 features). We integrate (a) spatially blocked validation (Block GroupKFold-5 and Leave-One-District-Out) with random 5-fold cross-validation retained only as a reference, (b) Optuna-based Bayesian hyperparameter optimisation of XGBoost, LightGBM and Random Forest learners, (c) a Ridge meta-learner stacking ensemble, (d) 90% prediction intervals from XGBoost quantile regression, with and without conformalised quantile regression (CQR), (e) SHapley Additive exPlanations (SHAP), and (f) an area-normalised target analysis. On the log1p scale, the stacking ensemble reaches R² = 0.902 under random 5-fold CV, whereas the best model under spatial block CV (XGBoost) reaches R² = 0.635 and under leave-one-district-out evaluation (LightGBM) R² = 0.454. Withholding a whole district lowers log-scale R² by 0.34–0.39 on average across models, and the Vaishali district is almost untransferable (R² ≤ 0.16). Prediction intervals achieve 90.6% empirical coverage under random CV but only 81.6% under block CV and 76.3% under district hold-out, and CQR does not repair this shift-induced under-coverage. Farm area alone accounts for 36.3% of total SHAP attribution, and R² for yield per acre is 0.14 under random CV but negative under spatial CV, showing that much of the apparent skill reflects area scaling rather than agronomic productivity. The framework is openly released as Kaggle notebooks to support reproducibility.


