# Yield Africa — Reproducibility Package
**Paper:** *Do Foundation Model Embeddings Improve Cross-Country Crop Yield Generalisation? A Leave-One-Country-Out Evaluation in Sub-Saharan Africa*
**Author:** Yaw Osei Adjei, Department of Computer Science, KNUST, Ghana
---
## Overview
This repository contains the full code pipeline to reproduce all experiments and figures in the paper. The pipeline evaluates 18 experimental conditions (3 feature sets × 3 regressors × 2 CV schemes) for smallholder maize yield prediction across Kenya, Malawi, Nigeria, Rwanda, and Tanzania.
**Key result:** All LOCO R² are negative. Frozen Prithvi-EO embeddings do not outperform 10-band Sentinel-2 spectral features for cross-country yield prediction.
---
## Repository Structure
```
yield_africa/
├── scripts/
│ ├── 01_download.py # download GROW-Africa labels from Zenodo
│ ├── 01b_gee_extract.py # export S2 patches via Google Earth Engine
│ ├── 01c_chirps.py # extract CHIRPS rainfall features
│ ├── 01d_harveststat.py # merge HarvestStat Africa (Nigeria coverage)
│ ├── 01e_sample.py # stratified sampling for GEE export
│ ├── 02_preprocess.py # build master_dataset.parquet
│ ├── 03_extract_embeddings.py # extract Prithvi-EO and ViT-Base embeddings
│ ├── 04_train_eval.py # train + evaluate all 18 conditions
│ ├── 05_figures.py # generate all paper figures
│ └── prithvi_mae.py # Prithvi-EO model architecture (from HF repo)
├── data/
│ ├── raw/ # raw downloads (not tracked by git)
│ └── processed/ # results_all.csv, results_loco_country.csv (tracked)
├── figures/ # all 6 paper figures (PDF)
├── models/ # Prithvi model weights (not tracked — download below)
├── paper/
│ ├── main.tex # LaTeX source
│ └── references.bib # BibTeX references
├── requirements.txt
└── run_all.sh # end-to- …