# 🌱 Shamba Signal
**An honest machine-learning study of Kenya's county-level maize yields.**
Shamba Signal asks a simple question:
> Can a small set of annual ERA5 weather features improve maize-yield prediction enough to beat transparent historical baselines?
The answer was **no—not enough**. Instead of hiding that result or searching endlessly for a better-looking model, the project publishes the no-go and makes the evidence explorable.
## 🎯 The result
The study reconciled a private panel of **564 county-year rows** across all **47 Kenyan counties** for 2012–2023. Of those, 563 yield labels were usable.
The temporal split was fixed before evaluation:
- **2012–2021:** training
- **2022:** model selection
- **2023:** one-time final test; official labels are provisional
| Model on provisional 2023 | MAE t/ha ↓ | RMSE t/ha ↓ |
| --- | ---: | ---: |
| **County historical mean** | **0.2998** | **0.3982** |
| Weather Ridge | 0.3370 | 0.4537 |
| Temporal Ridge | 0.3615 | 0.4783 |
| Previous year | 0.4651 | 0.6057 |
Weather Ridge improved on Temporal Ridge, but remained **0.0372 t/ha behind** the county historical mean on MAE. The scientifically correct decision was therefore **no-go** for this feature set.
## 🧠 What the ML pipeline does
```mermaid
flowchart LR
A[Official county maize data] --> B[Reconciled 47-county panel]
W[Open-Meteo ERA5] --> C[4 annual weather features]
B --> D[Leakage-safe temporal split]
C --> D
D --> E[Previous year]
D --> F[County historical mean]
D --> G[Temporal Ridge]
D --> H[Weather Ridge]
E --> I[Provisional 2023 test]
F --> I
G --> I
H --> I
I --> J[FastAPI evidence dashboard]
```
The weather model uses:
- annual precipitation total;
- wet-day count, where daily precipitation is greater than 1 mm;
- annual mean 2 m temperature; and
- annual maximum 2 m temperature.
Same-year production and harvested area are excluded because yield is derived from them and including them would leak the answer.
## 🖥️ What the dashboard can …