# Kenya Crop Yield Prediction
**AISIP Cohort 1 — Pathway 4: AI Engineering Capstone**
**Africa AI Hub | Victor Chogo | May 2026**
---
## Problem Statement
Kenya's 7 million+ smallholder farming households produce 75% of the country's food but
have almost no access to data-driven yield forecasting tools. Without yield estimates, farmers
cannot plan storage, negotiate fair prices, or make informed decisions about fertilizer
investment. This project builds a machine learning model that predicts crop yield (kg/ha)
before harvest, using climate, soil, and agronomic inputs available to any farmer.
---
## Live Demo
> **Deployed app:**
kenya-crops-yield-predictio…
> **GitHub:**
github.com
> Run locally: `streamlit run app.py`
---
## Quick Start
```bash
# Clone the repo
git clone
github.com
cd kenya-crops-yield-prediction
# Install dependencies
pip install -r requirements.txt
# Generate dataset
python data/generate_data.py
# Train models (creates models/ and plots/)
python train_models.py
# Launch the Streamlit app
streamlit run app.py
```
---
## Project Structure
```
kenya-crop-yield-prediction/
├── data/
│ ├── generate_data.py # Synthetic dataset generator
│ └── crop_yield_kenya.csv # Generated dataset (2,500 records)
├── models/ # Saved model artifacts (auto-created)
│ ├── best_model.pkl
│ ├── model_meta.json
│ └── le_*.pkl # Label encoders
├── plots/ # Visualisations (auto-created)
│ ├── model_comparison.png
│ ├── actual_vs_predicted.png
│ ├── feature_importance.png
│ └── yield_distributions.png
├── app.py # Streamlit web application
├── train_models.py # Full training pipeline
├── model_card.md # Model documentation
├── requirements.txt
└── README.md
```
---
## Dataset
| Field | Desc …