machine-learning chad africa food-security crop-yield-prediction early-warning xgboost python data-science agriculture sahel.
# πΎ Chad Crop Yield Early Warning System
> **Can we predict a bad harvest year in Chad before it happens?**
> This project builds a machine learning early warning system for
> millet and sorghum β Chad's two staple crops β using 43 years
> of FAO yield data and NASA climate observations.
---
## π Why This Matters
Chad has one of the highest food insecurity rates in the world.
In 2024, over **6 million Chadians** faced acute food insecurity.
Yet most humanitarian responses are **reactive** β food aid
arrives months after a harvest has already failed.
**This project asks: can we predict bad harvest years in advance
using climate data β giving WFP, FAO, and the government of Chad
time to act before the crisis hits?**
---
## π Data Sources
| Source | Data | Coverage |
|--------|------|----------|
| FAO FAOSTAT | Millet & Sorghum yield, area, production | Chad 1961β2024 |
| NASA POWER MERRA-2 | Rainfall, Temp Mean/Max/Min | Chad 1981β2025 |
**Modeling period:** 1982β2024 (43 years after lag feature creation)
---
## π¬ Methodology
```
FAO Crop Data + NASA Climate Data
β
Data Cleaning & Merging (43 years overlap)
β
EDA β Yield trends, rainfall patterns, correlation analysis
β
Feature Engineering
(Lag features, rainfall anomaly, temperature range,
rainfall category)
β
Regression Models β Poor performance β Problem reframed
β
Binary Classification
(Bad year = below median yield)
β
7 Classifiers benchmarked (LOO Cross-Validation)
β
Early Warning System
```
---
## π¨ Key Findings
### 1. Rainfall alone cannot predict crop failure
Bad harvest years had almost identical rainfall to good years
(548mm vs 557mm average). **Rainfall is not the primary driver
of crop failure in Chad.**
### 2. Drought is the default condition
**65% of years between 1981β2024 had below-average rainfall.**
Chad's farmers operate under chronic water stress, not
occasional drought.
### 3. Cascading failures are real
Last year's yield is the strongest predictor of this year's
yield for b β¦