# ๐ฉ๐ฟ 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 โฆ