A production-grade machine learning pipeline delivering 1-, 3-, and 6-month SPEI drought forecasts for Algeria's Oran region β with 95.1% explained variance and 98.3% directional accuracy.
# Drought-Forcasting_Prediction
# π΅ SPEI Drought Forecasting & Intelligence Platform
> Multi-horizon drought prediction for Northwestern Algeria using 76 years of climate data.
---
## Overview
This project builds a complete end-to-end machine learning pipeline to **forecast drought conditions** using the **Standardised Precipitation-Evapotranspiration Index (SPEI)** at a grid point in Northwestern Algeria (35.75Β°N, 0.75Β°E).
The dataset spans **January 1950 to February 2026** β 914 monthly observations across 48 SPEI accumulation windows. The primary target is **SPEI-12**, the 12-month accumulation window and the international standard for hydrological drought monitoring.
---
## Live Demo
**β drought-intelligence.streamlit.app**
Upload the CSV file and the full pipeline β data exploration, model performance, uncertainty quantification, and feature intelligence β runs automatically in the browser.
---
## What is SPEI?
SPEI is a dimensionless z-score measuring the balance between precipitation and atmospheric water demand. Values follow N(0,1) by construction.
| SPEI-12 Value | Classification |
|:---:|:---|
| +1.0 | π΅ Wet conditions |
---
## Repository Structure
```
Drought-Forcasting_Prediction/
β
βββ drought_forecasting_.ipynb # Full ML pipeline (10 stages)
βββ app.py # Streamlit interactive dashboard
βββ SPEI_0.75_35.75.csv # Raw SPEI data (Jan 1950 β Feb 2026)
βββ model_results.pkl # Trained model objects + predictions
βββ metrics_comparison.csv # RMSE, MAE, RΒ², MAPE, Bias, Hit Rate
βββ classification_report.csv # WMO drought class precision/recall/F1
```
---
## Pipeline β 10 Stages
| Stage | Description |
|:---:|:---|
| 1 | Data ingestion & datetime parsing |
| 2 | Exploratory data analysis β 6 publication-quality plots |
| 3 | Feature engineering β lags, rolling statistics, interactions |
| 4 | Chronological train / validation / test split |
| 5 | Model training β Ridge, XGBoost β¦