← all work

Electricity Load Forecasting (Time Series)

forecasts a full day of 15-minute load (96 steps), and rebuilds a research algorithm as an R package.

  • scikit-learn
  • XGBoost
  • SARIMA
  • LSTM
  • R
time-series-electricity-forecasting / WNN_Package/R/wnn_forecast.R
dists <- apply(model$X, 1, function(row) euclidean_distance(row, window))
idx <- order(dists)[1:model$k]
weights <- 1/(dists[idx] + 1e-8)
weights <- weights / sum(weights)
sum(weights * model$y[idx])
why
most demos stop at one-step-ahead forecasts, which hide how error compounds. i wanted a model that still held up 96 steps out.
how it works
exponential smoothing, SARIMA, random forest, XGBoost, SVR, MLP and LSTM are compared with TimeSeriesSplit on lag, rolling and calendar features. the weighted nearest neighbours method (Talavera-Llames et al., 2016) is implemented from the paper as an installable R package.
what i learned
recursive multi-step forecasting punishes small early errors, feature engineering mattered more than model choice.
results
a final 96-step forecast, plus the wnnforecast R package with roxygen docs and a vignette.

still testing how far the recursive horizon can stretch before error compounds too much.