# 🇩🇿 Climate Forecasting System for Algeria
> Long-term climate forecasting (2024–2040) using an ensemble of ML models, an RL-based model selector, and a RAG-powered conversational interface — built for the Algiers region.
---
## 🏗️ System Architecture
The system is organized as a four-stage pipeline:
```
Raw Data (Open-Meteo)
│
▼
┌──────────────────────────┐
│ DATA PIPELINE │ Preprocessing → Monthly Aggregation → Feature Engineering
│ src/preprocessing.py │ Drought indices (SPI, SPEI), anomalies, rolling stats
└──────────┬───────────────┘
│
▼
┌──────────────────────────┐
│ FORECASTING MODELS │ SARIMA │ LSTM │ Ridge │ Prophet
│ Forecasting_Models/ │ Each produces 204-month forecasts (→ 2040)
└──────────┬───────────────┘
│
▼
┌──────────────────────────┐
│ RL AGENT │ Q-Learning agent trained on 2019–2023 backcasts
│ RL Agent/ │ Selects BEST model per month (dual-variable reward)
└──────────┬───────────────┘
│
▼
┌──────────────────────────┐
│ RAG + UI │ ChromaDB + e5-small-v2 + Groq (Kimi K2)
│ src/rag.py + app.py │ Streamlit dashboard with streaming answers
└──────────────────────────┘
```
---
## ✨ Features
| Feature | Description |
| -------------------------- | --------------------------------------------------------------------------------------------- |
| 📊 **Data Pipeline** | Missing value handling, monthly aggregation, drought indices (SPI, SPEI), anomaly calculation |
| 📈 **Trend Analysis** | Mann-Kendall test (with autocorrelation correction), Sen's slope estimation |
| 🔬 **Stationarity** | ADF + KPSS tests with automatic differencing order recommendation |
| 🔮 **4 Forecasting Models** | SARIMA (auto-tuned), Bidirectional LSTM, Ridge Regression (polynomial), Prophet |
| 🤖 **RL Model Sele …