Cherryann Yang

Cherryann Yang

Applied Data Science
Penn State, class of 2028

State College

Project

Beijing PM2.5 Forecasting

A model that forecasts PM2.5 at 12 Beijing monitoring stations 24 hours ahead. I built it in R with data.table and XGBoost for a Kaggle competition.

  1. Stack Training and test hours go on one timeline per station, so lags line up.
  2. Features Citywide averages, 24 and 48 hour lags, and time of day as a cycle.
  3. Hold out Fit on the hours before March 2015, score the hours after.
  4. Refit Same settings on every training hour, then predict the test hours.

Features

Everything is built from readings available at the hour the forecast is made:

  • the citywide average of each pollutant and weather reading at that hour, across all 12 stations
  • the same station’s readings 24 and 48 hours earlier
  • the 24-hour change in PM10, and the gap between a station’s PM10 and the city’s
  • hour and month as sine and cosine, so hour 23 sits next to hour 0 and December next to January
  • station and wind direction as indicator columns, with a flag for missing wind

The target itself, PM2.5 24 hours ahead, is never lagged or averaged into a feature.

Validation

I used a temporal holdout instead of random folds. The model is fit on hours before March 1, 2015 and scored on the hours after, because random rows would let later hours leak into the fit.

Early stopping on that holdout picks the number of trees, stopping after 40 rounds without improvement. The holdout score is checked against a null model that always predicts the average from the fit period.

Model

Gradient boosted trees in XGBoost with squared-error loss, a learning rate of 0.05, depth 7, and row and column sampling at 0.8. After tuning, the model is refit on every training row with the chosen number of trees. Predictions are clipped at zero, since PM2.5 cannot be negative.