# Forecasting-Air-Quality-In-Africa
# 🌍 Air Quality Forecasting in Nairobi 🇰🇪 & Dar es Salaam 🇹🇿
This project was completed as part of the **Applied Data Science Lab by WorldQuant University**. It focuses on **time series forecasting** of PM2.5 pollution levels across two major African cities — **Nairobi** and **Dar es Salaam** — using real-world data from **OpenAfrica**.
We developed, tuned, and validated models to predict hourly air pollution levels, while applying best practices in time series modeling, diagnostics (ACF/PACF), and walk-forward validation.
---
## 🧠 Project Overview
In this end-to-end data science project, we:
- Connected to a **MongoDB database** hosting air sensor data
- Cleaned and resampled the data to hourly PM2.5 readings
- Built and compared several models: **Linear Regression**, **AutoReg**, and **ARIMA**
- Tuned hyperparameters (lags, `p`, and `q`)
- Validated model performance using **walk-forward prediction**
- Evaluated results using plots, residuals, and correlation diagnostics
This project offers insights into modeling **time-dependent data for public health**, and the techniques here apply directly to domains like **finance**, **NLP**, and **environmental monitoring**.
---
## 🗃️ Data Source
The dataset comes from OpenAfrica.net, one of the largest open data platforms in Africa. We used collections for:
- **Nairobi, Kenya**
- **Dar es Salaam, Tanzania**
Data is stored in a **MongoDB database**, accessible and queried using `pymongo`.
---
## 💻 Technologies Used
- **Languages**: Python
- **Libraries**:
- Data: `pandas`, `numpy`, `gzip`, `json`, `pickle`
- Plotting: `matplotlib`, `seaborn`, `plotly.express`
- Modeling: `statsmodels`, `scikit-learn`
- Database: `pymongo`
- **Environment**: Jupyter Notebook
---
## 🔧 Project Structure
This project is organized into 4 main lessons and a final assignment:
| Notebook | Description …