ml powered yield prediction platform for cameroon agriculture combining soil, weather, and satellite data across 8 agroecological zones.
# Agri-Harvest
End-to-end yield prediction platform for Cameroon agriculture. Ingests soil, climate, satellite, and crop survey data through two ML pipelines (scikit-learn and LightGBM/XGBoost/PyTorch) to predict harvest yields across 8 agroecological zones and 27 crop types.
## Quick start
```bash
git clone
github.com
cd agri-harvest-cameroon
python -m venv .venv && source .venv/bin/activate
pip install -e ".[ml,geo,climate,dev]"
cp .env.example .env
```
Requires Python 3.12+.
Train a model:
```python
from models.v1.trainer import YieldModelTrainer
trainer = YieldModelTrainer("data/features.parquet")
comparison = trainer.run(["lightgbm"], optimize=True)
```
## Dataset
The training dataset (3M rows) is hosted on Hugging Face:
**synthi-ai/cameroon-agricultural-data**
| Property | Value |
|---|---|
| Rows | 3,000,000 |
| Columns | 36 raw / 66 engineered |
| Crops | 27 types across 7 groups (cereals, legumes, root & tubers, vegetables, tree crops, industrial, cash crops) |
| Zones | 8 agroecological zones |
| Period | 2018 -- 2024 |
| Sources | Field measurements, weather stations, lab analyses, TerraClimate, CHIRPS |
```python
from datasets import load_dataset
ds = load_dataset("synthi-ai/cameroon-agricultural-data", split="train")
df = ds.to_pandas()
```
Three Jupyter notebooks walk through the data pipeline:
| Notebook | Purpose |
|---|---|
| `01_data_exploration.ipynb` | Exploratory data analysis |
| `02_feature_engineering.ipynb` | Feature engineering (36 raw -> 66 features) |
| `data_generation_notebook.ipynb` | Synthetic data generation |
## Models
### v0 -- scikit-learn (up to ~500K rows)
Spatial train/test split on `agroecological_zone` via `GroupShuffleSplit` (no zone leaks across sets). `StandardScaler` on 40 continuous features, passthrough for 22 binary + 4 ordinal.
| Model | Type | Hyperparameters |
|---|---|---|
| Stacking | Ensemble | RF + HGB base, Ridge meta-learner |
| Hist Gra …