Linear regression analysis on Kenya long climate data
# Kenya Climate Regression Project
## Goal & business context
This project predicts Kenya's Long Rains (March–April–May) seasonal rainfall totals using historical climate data.
The Long Rains season is critical for Kenya’s agriculture, water security, and food supply. Accurate seasonal forecasts can support:
- Early farming & planting decisions
- Drought & flood risk mitigation
- Agricultural advisory & water resource planning
- Policy-making & early warning systems
## Dataset
This project uses Kenya climate data for 1991–2016 from openAFRICA.
- Dataset: Kenya Climate Data | 1991–2016
- Source attribution: World Bank Climate Change Knowledge Portal
## Key result
The best-performing model in this notebook was Polynomial Regression (degree 2) with:
- Test R² = 0.645
- MAE = 18.50 mm
- RMSE = 23.68 mm
## Methodology overview
1. Loaded rainfall and temperature CSV files
2. Merged them by year and month
3. Filtered the data to the MAM season (March, April, May)
4. Built seasonal and lag-based features
5. Split the data into train and test sets
6. Trained and compared several models:
- Linear Regression
- Polynomial Regression
- Random Forest Regressor
- Gradient Boosting Regressor
7. Evaluated performance using **MAE, RMSE, R²**, cross-validation, and residual analysis