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 …