# 🌾 Africa-Wide Crop Yield & Climate Analysis
**APT3010A — Introduction to Artificial Intelligence | Group**
Project 9: *Weather Impact Predictor on Agricultural Yield*
Predicts crop yield (kg/ha) across African countries using 25 years (2000–2024)
of FAOSTAT agricultural records combined with NASA POWER monthly climate data,
and ships as a working prediction tool an extension officer or farmer can
actually click through — no notebook required.
## Deployed site:
uxtpode3fo94gwpsbazskm.stre…
## What's in this repo
| Path | What it is |
|---|---|
| `G7_Africa_Crop_Yield_Climate_Analysis.ipynb` | Full analysis: data collection, cleaning, feature engineering, model training/comparison, evaluation, and model export |
| `crop_yield_app/app.py` | Streamlit UI wrapping the trained model in a clickable prediction tool |
| `crop_yield_app/requirements.txt` | Python dependencies for the app |
| `*.joblib` | Trained model + supporting lookup tables, exported by the notebook (Step 13) |
## Project overview
- **Data sources:** FAOSTAT crop yield records (Maize, Wheat, Rice, Beans,
Sorghum, Potatoes, Sugar cane) and NASA POWER monthly temperature/rainfall,
pulled for 50 African countries using capital-city coordinates as a
country-level proxy.
- **Unit of analysis:** Country Ă— Crop Ă— Year.
- **Feature engineering:** seasonal indicators derived from monthly data
(peak-quarter rainfall, rainfall variability, temperature range) plus
country-crop-specific anomalies and prior-year lag features.
- **Modeling:** Linear Regression, Decision Tree, Random Forest, and Gradient
Boosting compared on a **country-grouped** train/test split (evaluated on
countries the model never saw during training, not a random split).
- **Deliverable:** a prediction tool where a user picks a country and crop,
enters expected seasonal temperature and rainfall, and gets a predicted
yield, a comparison to that country-crop's historical average, and a
plain-language outlook (drought / hot / …