Data science project for identifying optimal beehive placement in Kenya using climate, vegetation, and environmental data.
# 🐝 Bee Optimal Placement Project
## Machine-Learning Suitability Analysis – Kenya
---
## Project overview
This project uses a multi-criteria ML pipeline to predict the most
suitable locations for honeybee hive placement across Kenya.
**Data inputs:**
| Layer | Files | Purpose |
|-------|-------|---------|
| Temperature | `climatology-tas-…nc` | ERA5 monthly mean (°C) |
| Wind speed | `climatology-sfcwind-…nc` | ERA5 surface wind (m/s) |
| Precipitation | `natvar-pr-…nc` | ERA5 seasonal rain (mm/yr) |
| Solar radiation | `natvar-rsds-…nc` | ERA5 shortwave down (W/m²) |
| Water bodies | `gis_osm_water_a_free_1.shp` + `gis_osm_waterways_free_1.shp` | Proximity to water |
| Land cover | `gis_osm_landuse_a_free_1.shp` + `gis_osm_natural_a_free_1.shp` | Vegetation quality |
| Roads | `gis_osm_roads_free_1.shp` | Accessibility |
| Buildings | `gis_osm_buildings_a_free_1.shp` | Urban buffer |
**ML pipeline:**
1. 0.1° (~11 km) grid sampled over Kenya
2. Climate variables interpolated via `scipy.RegularGridInterpolator`
3. Spatial distances computed with `scipy.cKDTree` (fast KD-tree)
4. Physics-based suitability score computed as weighted sum
5. Random Forest (300 trees) + Gradient Boosting (200 iters) trained
6. Ensemble prediction applied to full grid
7. Two interactive Folium HTML maps generated
---
## Quick start
### 1. Install dependencies
```bash
pip install -r requirements.txt
```
Tested on Python 3.10/3.11. If you hit conflicts, use a virtual env:
```bash
python -m venv bee_env
bee_env\Scripts\activate # Windows
source bee_env/bin/activate # Linux/Mac
pip install -r requirements.txt
```
### 2. Verify your data directory
Open `config.py` and check:
```python
DATA_DIR = r"C:\Users\ZUPLO\Desktop\BEE PROJECT"
```
Change this if your data is elsewhere.
### 3. Run the pipeline
```bash
cd "C:\Users\ZUPLO\Desktop\BEE PROJECT"
python main.py
```
This will take **15–40 minutes** the first time (the road and building
shapefiles are large – 1. …