# Spatiotemporal SHAP Analysis for Agricultural Drought Prediction
## A Multi-Source Machine Learning Framework in Semi-Arid Tunisia
---
## π Overview
This repository contains the full reproducible codebase for the research paper:
> **Spatiotemporal SHAP Analysis for Agricultural Drought Prediction: A Multi-Source Machine Learning Framework in Semi-Arid Tunisia** > *Frontiers in Artificial Intelligence β Section: AI in Food, Agriculture and Water* >
> **Authors:** Argoubi Majdi, Khaled Mili
> **Paper DOI:** [Pending Publication]
> **Dataset DOI:** 10.5281/zenodo.18733246
### Study Area
Five semi-arid governorates of central Tunisia: **Kairouan, Kasserine, Sidi Bou Zid, Gafsa, and Siliana**.
### Objectives
1. Predict agricultural drought (SSMI) using multi-source environmental and socioeconomic data.
2. Evaluate 6 ML/DL models (XGBoost, LightGBM, CatBoost, RF, BPNN, LSTM) with a focus on extreme event generalization (2021β2022).
3. Use **Tree SHAP** to explain global drivers and spatiotemporal drought dynamics.
---
## Key Results
| Model | Test RΒ² | Test SDI | Val RΒ² (2021β22) | Val SDI |
|-------|---------|----------|------------------|---------|
| **BPNN** | **0.860** | **0.626** | 0.655 | 0.421 |
| XGBoost | 0.817 | 0.572 | **0.696** | **0.448** |
| LightGBM | 0.807 | 0.561 | β | β |
| LSTM | 0.790 | 0.541 | 0.667 | β |
| CatBoost | 0.756 | β | β | β |
| RF | 0.681 | β | β | β |
**Top SHAP predictors (XGBoost):**
- MERRA-2 Surface SM: 26.0%
- Temperature (T2M): 14.2%
- Sand content: 10.0%
- Precipitation: 8.6%
---
## Repository Structure
```
drought-prediction-tunisia/
βββ data/ # Raw and processed data (see data/README.md)
βββ notebooks/ # Jupyter notebooks (exploration β figures)
βββ src/ # Python source modules
β βββ data/ # Download and preprocessing scripts
β βββ models/ # Training, evaluation, metrics
β βββ shap/ # SHAP global, dependence, spatiotemporal
β βββ figures β¦