Given a farm’s location (lat/lon, district) and basic attributes, can we predict its annual farm sales value? This is the African analog of the Calgary geospatial demand forecasting project — same spatial-regression toolkit applied to agricultural output across multiple African countries.
Use cases:
dropna on (lat, lon, farmsalev). After the subset, the district column collapses to a single value (“Unknown”), so the district OHE in the current pipeline carries no signal. The long-term climate-shift features are mostly imputed to a single median in the subset and contribute little.Run python download_data.py.
farmsalev (annual farm sales) on the modeled subset| Family | Model |
|---|---|
| Linear baseline | OLS on log-sales with lat/lon + farm-size features |
| Non-parametric geo baseline | KNeighborsRegressor(n_neighbors=10) |
| Non-linear challenger | GradientBoostingRegressor with lat/lon + farm features |
(lat, lon) (same-village observations); random splitting lets the GBM memorize village-level lookup tables. Retained in the notebook only to make the leakage visible.GroupKFold on 1-degree lat/lon cells, 5 folds (honest): OLS R² 0.22 ± 0.38 · KNN R² 0.14 ± 0.44 · GBM R² 0.12 ± 0.34. 35 spatial cells, median 27 obs/cell. The GBM’s R² collapses from 0.66 to 0.12 — the +0.54 under random splitting was memorization, not generalization. All models have very wide fold variance; the honest signal across unseen spatial cells is weak.