Air Pollution Forecasting Banner

Python PyTorch TensorFlow CUDA LightGBM XGBoost CatBoost University Course

CO5420: Neural Networks & Deep Learning β€” Course Project
Department of Computer Engineering, Faculty of Engineering, University of Peradeniya, Sri Lanka


πŸ‘₯ Project Team & Contributors

Team VectorX Logo

Team VectorX

Faculty of Engineering, University of Peradeniya

Team Members

H.M.H.N. Aberathna
H.M.H.N. Aberathna
E/22/001
e22001@eng.pdn.ac.lk
T.H. Abeywickrama
T.H. Abeywickrama
E/22/008
e22008@eng.pdn.ac.lk
M.A.N.P. Anawarathna
M.A.N.P. Anawarathna
E/22/027
e22027@eng.pdn.ac.lk
S.H.S. Hansara
S.H.S. Hansara
E/22/130
e22130@eng.pdn.ac.lk
W.A.H. Sathsarani
W.A.H. Sathsarani
E/22/362
e22362@eng.pdn.ac.lk

Project Supervisors

Dr. Damayanthi Herath
Dr. Damayanthi Herath
Senior Lecturer, Department of Computer Engineering
damayanthiherath@eng.pdn.ac.lk
Dr. Sampath Deegalla
Dr. Sampath Deegalla
Senior Lecturer, Department of Computer Engineering
sampath@eng.pdn.ac.lk

πŸ“‘ Table of Contents

  1. Executive Summary
  2. Project Progression & Breakthroughs
  3. Dataset & Problem Formulation
  4. Advanced Feature Engineering Pipeline
  5. Model Architectures
  6. Convex SLSQP Ensembling & Blending
  7. Experimental Results & Benchmark Tracking
  8. Hardware Acceleration & Compute Infrastructure
  9. Repository Structure
  10. Getting Started & Reproduction
  11. Academic Links & Resources

🌟 Executive Summary

Airborne fine particulate matter with aerodynamic diameter under 2.5 micrometers (PM2.5) constitutes a severe public health hazard, penetrating deep into human pulmonary and cardiovascular systems. Due to turbulent boundary-layer meteorology, complex photochemical transformations, wind transport kinematics, and sharp seasonal heating shifts, predicting hourly PM2.5 concentrations is an inherently non-linear spatio-temporal challenge.

This project engineer delivers a state-of-the-art forecasting system trained on multi-year hourly observational data across 12 national air quality monitoring stations in Beijing.

Starting from standard recurrent neural network baselines (LSTM, GRU, BiLSTM with RMSE 15.09 – 15.71), our solution progressed into an industry-grade Advanced SOTA Pipeline combining:


πŸš€ Project Progression & Breakthroughs

flowchart TD
    A[Initial RNN Baselines<br/>BiLSTM / GRU / LSTM<br/>RMSE: 15.09670] --> B[Exploratory Iterations<br/>Batch 32, Preprocessing, Augmentation<br/>RMSE: 15.16 - 15.71]
    B --> C[Advanced Pipeline Test 1<br/>166 Domain Features + 4-Model Ensemble<br/>RMSE: 14.36675]
    C --> D[Advanced Pipeline Test 2<br/>5-Model SLSQP Blending<br/>Score: 13.90609 - Weight Bug Identified]
    D --> E[Advanced Pipeline Test 3<br/>Pure CPU Multi-Core SOTA Pipeline<br/>RMSE: 14.04457 πŸ† Best Verified]
    E --> F[Advanced Pipeline Test 4 & 5<br/>NVIDIA RTX 6000 Ada GPU In-Memory<br/>RMSE: 14.29812]

πŸ“Š Dataset & Problem Formulation

1. Dataset Overview

The dataset contains continuous, multi-year hourly meteorological and air pollutant records across 12 air quality monitoring stations in Beijing:

2. Task Formulation

Given an hourly sliding observation window $X_{t-24:t}$ over the preceding 24 hours of atmospheric and chemical observations at station $s$, forecast the 1-hour ahead particulate concentration:

\[\hat{y}_{t+1} = f(X_{t-24:t}, s)\] \[\text{RMSE} = \sqrt{\frac{1}{N} \sum_{i=1}^N (y_i - \hat{y}_i)^2}\]

πŸ”¬ Advanced Feature Engineering Pipeline

The final pipeline converts raw multivariate inputs into an information-dense 166-dimensional feature space grounded in atmospheric science and time-series kinematics:

Category Engineered Features Domain Rationale / Mathematical Formula
Wind Vector Kinematics Wx, Wy Decomposes circular wind angle $\theta$ into orthogonal Cartesian velocities:
Wx = WSPM * sin(ΞΈ), Wy = WSPM * cos(ΞΈ)
Physical Meteorology dew_point_depression, relative_humidity, ventilation_index β€’ Dew Point Depression: Ξ”T = TEMP - DEWP
β€’ Magnus Relative Humidity (RH):
RH = 100 * exp((17.625 * DEWP) / (243.04 + DEWP) - (17.625 * TEMP) / (243.04 + TEMP))
β€’ Ventilation Index: VI = WSPM * (Ξ”T + 15.0)
Photochemical & Particle Ratios PM2.5 / PM10, PM2.5 / CO, NO2 / O3, coarse_pm β€’ Coarse particulate separation: coarse_pm = max(PM10 - PM2.5, 0)
β€’ Combustion efficiency & secondary aerosol proxy ratios
Cyclical Trigonometric Time hour_sin, hour_cos, month_sin, month_cos, dayofweek_sin, dayofweek_cos Continuous periodic coordinate representations preserving cyclical boundaries (23:00 to 00:00; Dec to Jan).
Seasonal Indicator is_heating_season Binary indicator for central urban heating season (November–March) reflecting major coal emission shifts.
Temporal Lags PM2.5_lag_1 to PM2.5_lag_24 Autoregressive memory at 1, 2, 3, 4, 5, 6, 12, 18, and 24-hour delays.
Velocity & Acceleration PM2.5_diff_k, PM2.5_accel, PM2.5_diff_ratio β€’ 1st order velocity: diff_k = x_t - x_{t-k} for $k \in \{1, 2, 3, 4, 6, 12, 24\}$
β€’ 2nd order acceleration: (x_t - x_{t-1}) - (x_{t-1} - x_{t-2})
β€’ Relative surge rate: (x_t - x_{t-1}) / (x_{t-1} + 1)
Multi-Window Rolling Statistics Mean, Std, Min, Max, Range, Deviations Rolling windows over 3h, 6h, 12h, and 24h to capture sudden accumulation spikes.
Exponential Moving Averages PM2.5_ema_3, PM2.5_ema_6, PM2.5_ema_12 Decaying-weight smoothing tracking immediate concentration momentum.
Target Encodings station_target_mean, station_target_std Out-of-fold historical station baseline distributions mitigating spatial bias.

🧠 Model Architectures

End-to-End Deep Learning Architecture

1. PyTorch Deep ResNet-1D BiLSTM

To leverage both localized feature abstractions and long-range sequential memory, we designed a custom Deep ResNet-1D BiLSTM in PyTorch:

2. TensorFlow/Keras Bidirectional LSTM & GRU Baseline

Built in Air_Pollution_Forecasting_Using_Temporal_NN_new.ipynb for initial benchmark analysis:

3. Gradient Boosted Decision Trees (GBDTs)


βš–οΈ Convex SLSQP Ensembling & Blending

Rather than naive uniform averaging, we applied Sequential Least Squares Programming (SLSQP) convex optimization to find the mathematically optimal weight vector $\mathbf{w} = [w_1, w_2, \dots, w_M]^T$:

\[\min_{\mathbf{w}} \sqrt{\frac{1}{N} \sum_{i=1}^N \left( y_i - \sum_{m=1}^M w_m \hat{y}_{i, m} \right)^2} \quad \text{subject to} \quad \sum_{m=1}^M w_m = 1, \quad 0 \le w_m \le 1 \quad \forall m\]

SLSQP Optimal Ensemble Weights

Model Component Out-of-Fold (OOF) RMSE SLSQP Optimal Weight
CatBoost Regressor 14.34932 35.46%
LightGBM Regressor 14.38512 30.47%
XGBoost Regressor 14.46854 17.79%
PyTorch ResNet-BiLSTM 15.75860 16.28%
ExtraTrees Regressor 16.08155 0.00%
Optimal Hybrid Ensemble (OOF) 14.14202 100.00%

⚠️ Diagnostic Note on Test 2 (13.90609): In Test 2, a weight convergence anomaly was identified during diagnostic evaluation. Hence, Test 3 (14.04457) stands as our verified, reproducible, and clean production benchmark.


πŸ“ˆ Experimental Results & Benchmark Tracking

Benchmark Performance Comparison

Experiment Architecture & Strategy Highlights Validation / Test RMSE Key Observations
Baseline 3-Model Keras BiLSTM + GRU + Ensemble Baseline 15.09670 Standard 24h sliding window with raw tabular features.
Batch 32 Test Batch size reduced from 64 to 32 15.46692 Increased stochastic gradient noise degraded generalization.
Preprocessing Exp 1 Station interpolation + one-hot encodings 15.59510 Imputation without physical wind decomposition plateaued.
Preprocessing Exp 2 Extra pollutant polynomial combinations 15.71107 Feature collinearity without regularizers led to drift.
Augmentation Exp Training distribution expansion 15.16439 Improved extreme tail behavior but lacked lag velocities.
Advanced Test 1 166 Physics Features + 5-Fold LightGBM, XGBoost, CatBoost, CNN-BiGRU 14.36675 Major breakthrough: RMSE dropped by > 0.73.
Advanced Test 2 5-Model SLSQP Blending 13.90609* Experimental: Weight adjustment issue identified.
Advanced Test 3 πŸ† Pure CPU Multi-Threaded SOTA Pipeline with Checkpoints 14.04457 Best Verified Benchmark: Fully reproducible with complete domain physics features.
Advanced Test 5 NVIDIA RTX 6000 Ada In-Memory Pipeline 14.29812 105,000 estimators with strict patience early stopping.
Advanced Test 7 Alternate validation weighting setup 14.55754 Robust baseline cross-validation comparison.

⚑ Hardware Acceleration & Compute Infrastructure

Training 105,000 boosting estimators across 5 folds and deep recurrent neural networks over 315,000+ time-series records demands specialized compute:


πŸ“ Repository Structure

Air-Pollution-Forecasting-Using-Temporal-NNs/
β”‚
β”œβ”€β”€ README.md                                          # Root repository documentation
β”œβ”€β”€ powershell.cmd                                     # Environment execution shim
β”‚
β”œβ”€β”€ docs/                                              # 🌐 Live GitHub Pages Documentation
β”‚   β”œβ”€β”€ README.md                                      # Site home page
β”‚   β”œβ”€β”€ _config.yml                                    # Jekyll site configuration
β”‚   β”œβ”€β”€ images/                                        # Assets (Banner, Logo, SVGs)
β”‚   β”‚   β”œβ”€β”€ VectorX.png                                # Official Team Logo
β”‚   β”‚   β”œβ”€β”€ project_banner.svg                         # High-res project banner
β”‚   β”‚   β”œβ”€β”€ architecture_pipeline.svg                  # Model architecture
β”‚   β”‚   β”œβ”€β”€ ensemble_weights.svg                       # SLSQP weights breakdown
β”‚   β”‚   └── benchmark_chart.svg                        # Experimental performance chart
β”‚   └── data/                                          # Portal metadata & cover images
β”‚       β”œβ”€β”€ index.json                                 # Project card metadata
β”‚       β”œβ”€β”€ cover_page.jpg                             # Panoramic cover banner (940x352)
β”‚       └── thumbnail.jpg                              # Project thumbnail (640x360)
β”‚
└── code/                                              # πŸ”¬ Core Codebase & Experimental Pipelines
    β”œβ”€β”€ train_raw.csv                                  # Primary Beijing air quality dataset
    β”œβ”€β”€ Air_Pollution_Forecasting_Using_Temporal_NN_new.ipynb  # RNN Baseline (LSTM, GRU, BiLSTM)
    β”‚
    β”œβ”€β”€ advanced pipeline model/                       # 🌟 SOTA High-Performance Pipeline
    β”‚   β”œβ”€β”€ test 1/                                    # 166 Features + 4-Model Ensemble (14.36675)
    β”‚   β”œβ”€β”€ test 2/                                    # 5-Model SLSQP Ensemble (13.90609)
    β”‚   β”œβ”€β”€ test 3/                                    # Pure CPU SOTA Pipeline (14.04457 πŸ†)
    β”‚   β”œβ”€β”€ test 4/                                    # GPU Ada CUDA Diagnostics
    β”‚   β”œβ”€β”€ test 5/                                    # In-Memory GPU Ada Pipeline (14.29812)
    β”‚   └── test 7/                                    # Alternative Validation Setup (14.55754)
    β”‚
    β”œβ”€β”€ 3 model/                                       # Baseline 3-model exploration
    β”œβ”€β”€ 3 model with 32 batch/                         # Batch size 32 test
    β”œβ”€β”€ new mdel with pre processing steps/            # Preprocessing iteration 1
    β”œβ”€β”€ add more pre procesing steps/                  # Preprocessing iteration 2
    └── increased train data with test data/           # Augmented training set test

πŸ› οΈ Getting Started & Reproduction

1. Environment Setup

# Clone the repository
git clone https://github.com/cepdnaclk/e22-co542-Air-Pollution-Forecasting-Using-Temporal-NNs-Team-VectorX.git
cd e22-co542-Air-Pollution-Forecasting-Using-Temporal-NNs-Team-VectorX/code

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install required dependencies
pip install lightgbm xgboost catboost scikit-learn pandas numpy torch tensorflow matplotlib seaborn scipy joblib

Open code/advanced pipeline model/test 3/new-cpu-pipeline.ipynb to execute the verified CPU benchmark:

jupyter notebook "advanced pipeline model/test 3/new-cpu-pipeline.ipynb"

3. Running the GPU High-Power Pipeline (CUDA Mode)

Open code/advanced pipeline model/test 5/gpu_ada (2).ipynb in a CUDA-enabled GPU environment:

jupyter notebook "advanced pipeline model/test 5/gpu_ada (2).ipynb"


Developed with ❀️ by Team VectorX for Academic & Research Excellence in Neural Networks and Environmental Intelligence.