Logo Lanfrica

onigemoazeezat1-code/Nairobi-Air-Quality-Predictive-Modeling-

Domaine:

environment and energy

Type de record:

project
Créateur:
oni
Hôte:
An end-to-end data science and time-series machine learning project designed to extract, clean, analyze, and predict air quality in Nairobi, Kenya. This repository demonstrates how to build a robust predictive modeling workflow using MongoDB as the data warehouse and state-of-the-art auto-regressive statistical algorithms. # Nairobi-Air-Quality-Predictive-Modeling- An end-to-end data science and time-series machine learning project designed to extract, clean, analyze, and predict air quality in Nairobi, Kenya. This repository demonstrates how to build a robust predictive modeling workflow using MongoDB as the data warehouse and state-of-the-art auto-regressive statistical algorithms. # Project Overview Air pollution, particularly fine particulate matter (\(PM_{2.5}\)), poses severe risks to respiratory health in growing urban centers like Nairobi. Managing and mitigating these risks requires precise local forecasts. This project implements a complete time-series pipeline: 1. Data Ingestion: Loads raw unstructured air-quality environmental datasets directly into a locally hosted MongoDB instance. 2. Data Wrangling: Pulls data from MongoDB, handles missing entries, converts timestamps into the local timezone (Africa/Nairobi), re-samples data to chronological order, and handles variable cleaning using Pandas method chaining. 3. Statistical Baseline: Computes a persistence model baseline to evaluate model skill.Machine Learning & Time-Series 4. Machine Learning & Time-Series Modeling: Implements and optimizes Autoregressive (AR) and AutoRegressive Integrated Moving Average (ARIMA/ARMA) architectures via walk-forward validation to perform hourly \(PM_{2.5}\) forecasting. # Architecture & Tech Stack * Language: Python 3 * Database: MongoDB (via pymongo API) * Data Processing: Pandas, NumPyStatistical * Modeling & Machine Learning: scikit-learn, statsmodels * Data Visualization: Matplotlib # Methodology & Modeling Workflow 1. Data Ingestion & Wrangling Unclean data is extracted dynamically from MongoDB. The custom function wrangle_data queries records specifically indicating particle type P2 (\(PM_{2.5}\)), maps timestamps into explicit datetime types, adjusts UTC datetimes into the localized Nairobi timezone, handles sparse data via drop protocols, and names targeted columns for downstre …