Delhi AQI Prediction
Spatio-temporal air quality forecasting
Overview
A leakage-safe ML pipeline that forecasts hourly concentrations of six pollutants across Delhi and renders 7-day, city-wide AQI heatmaps using gradient-boosted models. Won the IIT Kanpur research hackathon.
The problem
Delhi's air quality swings violently and sensor data is full of holes, stations drop offline for hours or days. Forecasting on top of that is easy to get wrong: naive interpolation and careless validation leak future information and produce models that look great in testing and fail in reality.
Approach
- Built a unified hourly dataset from 40 monitoring stations spanning 2009 to 2023, around 1.75M rows over 42 engineered features.
- Forecast six pollutants independently: PM2.5, PM10, NOx, SO2, CO, and O3.
- Used a duration-aware imputation strategy instead of a single fill method (see challenges).
- Validated with a strict 60-day test window that always follows the training data, so no future information leaks backward.
Architecture
- Feature engineering combines temporal (hour, day, season), lag-based (1h, 24h, 48h, 72h), rolling-average (24h, 72h), and spatial (coordinates, station id) signals.
- LightGBM and XGBoost models trained per pollutant, with LightGBM selected after it edged out XGBoost on most targets.
- Inverse Distance Weighting interpolates between stations to produce city-wide spatial heatmaps.
- Outputs include station-level time-series validation plots, feature-importance analysis, and 7-day hourly forecasts.
Challenges solved
Severe, uneven data missingness
Gaps ranged from a single hour to weeks, so one imputation method could not fit all of them.
I used a tiered strategy: linear interpolation for gaps up to 6 hours, Kalman smoothing up to 72 hours, and spatial Inverse Distance Weighting from neighbouring stations beyond that.
Avoiding temporal data leakage
Random train/test splits on time-series quietly leak the future into training and inflate scores.
The validation set is a contiguous 60-day window that strictly follows the training period, which keeps the reported error honest.
Performance & optimizations
- IDW power parameter cross-validated per pollutant (p around 0.20 to 0.46), revealing strong regional spatial coherence.
- Gradient-boosted trees over deep nets kept training fast and the model interpretable via feature importance.
- Tiered imputation preserved far more usable data than dropping incomplete rows.
What I learned
- On real sensor data, the imputation and validation design matter more than the model choice.
- Honest, leakage-free validation is worth the lower-but-real accuracy numbers.
- LightGBM gave the best accuracy-to-effort ratio here, slightly ahead of XGBoost.
Future work
- A live dashboard to serve the forecasts and heatmaps interactively.
- Incorporate meteorological forecasts (wind, temperature) as exogenous inputs.
- Extend the horizon and add uncertainty bands to each prediction.