Spain Electricity Forecasting

Hourly forecasts for generation, demand, and prices using a stacking ensemble of XGBoost, LightGBM, Ridge, and Random Forest — trained on 3 years of Spanish electricity and weather data, tested across all of 2018.

35,056hours
5cities
80features
2015–2018period

Results

Model Selection

We evaluated multiple architectures — gradient boosting, DeepAR, TFT, PatchTST, and stacking ensembles. The Stacking Ensemble achieved the lowest MAE across all five targets (solar, wind, load, residual load, price) and is shown throughout this site. It combines out-of-fold predictions from four base learners with a Ridge meta-learner, trained per forecast horizon (24 models total per target).

TargetMAE
Solar203.7 MW
Wind Onshore501.3 MW
Load649.0 MW
Residual Load651.0 MW
Price4.58 EUR/MWh