Machine Learning and Time-Series Foundation Models for Day-Ahead Electricity Forecasting in a University Building
Abstract
Day-ahead electricity forecasts can help building operators schedule heating, ventilation, and other services around anticipated demand. Choosing a forecasting model also requires balancing accuracy with its forecast-time inputs, local training, and computational requirements. We benchmark statistical, machine-learning, recurrent neural-network, and pretrained TimesFM models for a university building. We use chronological validation and evaluate all configurations on the same 57 test days, comparing accuracy across workdays, weekends, and holidays alongside local fitting and forecasting time. Weather covariates use retrospective observations. TimesFM 3.0 with covariates achieves the lowest overall errors, reducing mean absolute error by approximately 43% relative to weekly seasonal-naive forecasting. XGBoost remains competitive, although paired daily comparisons do not establish a clear mean-absolute-error advantage for TimesFM. TimesFM also performs strongly using only past electricity consumption. Adding covariates improves its holiday forecasts but slightly worsens workday and weekend forecasts, leaving overall mean absolute error almost unchanged. TimesFM requires no building-specific weight training, while XGBoost offers rapid local fitting and inference. The evaluated LSTM takes longer to fit without outperforming either approach. An exploratory historical evaluation reveals seasonal variation, while a separate weather-source comparison produces only small changes in the selected TimesFM configuration's accuracy. These results support pretrained TimesFM as a strong initial forecasting baseline for this building, with XGBoost as a competitive locally fitted alternative. Covariates are particularly useful when improved holiday forecasts justify the additional input preparation.
Figures & tables
| Source | Product | Role in the comparison |
|---|---|---|
| KNMI | Observations at Rotterdam Airport station 344 | Observed-weather reference |
| ERA5 | Gridded reanalysis | Retrospective weather reconstruction |
| Historical IFS | Archived ECMWF IFS forecasts from Open-Meteo | Forecast-product substitution |
| Domain | Covariates (number) | Units | Availability |
|---|---|---|---|
| Calendar and schedule (21) | Hour, year, month, week, day, day of week (6) | Calendar indices | Known in advance |
| Sine/cosine pairs for hour, day, day of week, week, month (10) | Dimensionless | Known in advance | |
| Work-week, weekend, holiday, opening-hours, examination-week indicators (5) | Binary | Calendar known; schedules assumed known | |
| Weather (7) | Air and dew-point temperatures (2) | °C | Retrospective |
| Relative humidity; sea-level pressure (2) | %; hPa | Retrospective | |
| Hourly precipitation (1) | mm | Retrospective |
| Configuration | Forecast-time inputs | Building-specific fitting |
|---|---|---|
| Seasonal-naive 24 h | Previous day’s consumption at the corresponding hour | None |
| Seasonal-naive 168 h | Previous week’s consumption at the corresponding hour | None |
| Ridge | 30 covariates | Standardisation and regression fitted at each origin |
| XGBoost | 30 covariates | Regression trees fitted at each origin |
| Prophet base | Past consumption and native calendar/holiday components | Trend, seasonality, and holiday effects fitted at each origin |
| Prophet with regressors | Past consumption, 29 external covariates, and native holiday effects | Prophet and its regressors fitted jointly at each origin |
| Stage | Target interval in UTC | Forecast days | Hourly targets | Purpose |
|---|---|---|---|---|
| Initial history | 4 September 2022, 23:00–4 November 2023, 22:00 | 426 | 10,224 | Supply past observations for subsequent forecasts |
| Validation | 4 November 2023, 23:00–2 February 2024, 22:00 | 90 | 2,160 | Select hyperparameters |
| Test | 2 February 2024, 23:00–30 March 2024, 22:00 | 57 | 1,368 | Evaluate the selected configurations |
| Group | Hourly observations | Mean (kWh) | Median (kWh) | SD (kWh) | Minimum (kWh) | Maximum (kWh) |
|---|---|---|---|---|---|---|
| Full series | 13752.0 | 140.31 | 112.15 | 76.86 | 13.90 | 452.00 |
| Holiday | 2760 | 87.77 | 77.10 | 33.57 | 13.90 | 374.30 |
| Weekday | 8040 | 176.23 | 161.25 | 79.16 | 56.30 | 452.00 |
| Weekend | 2952 | 91.58 | 83.00 | 30.47 | 46.10 | 306.10 |
| Model | Forecast-time inputs | MAE (kWh) | RMSE (kWh) | R² | MAPE (%) | sMAPE (%) |
|---|---|---|---|---|---|---|
| TimesFM 3.0 with covariates | Calendar, lags and observed weather | 19.97 | 30.26 | 0.798 | 16.94 | 15.27 |
| TimesFM 3.0 target-only | Past consumption | 20.01 | 32.45 | 0.768 | 16.99 | 14.94 |
| TimesFM 2.5 target-only | Past consumption | 21.07 | 31.85 | 0.777 | 18.50 | 16.09 |
| XGBoost | Calendar, lags and observed weather | 22.45 | 31.11 | 0.787 | 18.98 | 16.86 |
| Prophet with regressors | Calendar, lags and observed weather | 24.91 | 34.22 | 0.742 | 21.39 | 19.73 |
| Ridge | Calendar, lags and observed weather | 27.18 | 37.87 | 0.684 | 22.93 | 20.43 |
| Model | Reference | Mean daily-MAE difference (kWh) | 95% percentile CI (kWh) | Paired days |
|---|---|---|---|---|
| Seasonal-naive 24 h | XGBoost | 15.12 | [8.338, 22.252] | 57 |
| Seasonal-naive 168 h | XGBoost | 12.82 | [8.421, 17.742] | 57 |
| Ridge | XGBoost | 4.73 | [2.841, 6.671] | 57 |
| Prophet base | XGBoost | 7.76 | [4.260, 10.958] | 57 |
| Prophet with regressors | XGBoost | 2.46 | [0.422, 4.622] | 57 |
| TimesFM 2.5 target-only | XGBoost | -1.38 | [-4.636, 2.218] | 57 |
| Model | Workday MAE (kWh) | Workday RMSE (kWh) | Non-workday MAE (kWh) | Non-workday RMSE (kWh) |
|---|---|---|---|---|
| TimesFM 3.0 with covariates | 18.85 | 26.00 | 21.63 | 35.63 |
| TimesFM 3.0 target-only | 16.65 | 23.00 | 24.98 | 42.75 |
| TimesFM 2.5 target-only | 17.71 | 23.25 | 26.03 | 41.41 |
| XGBoost | 22.88 | 32.15 | 21.81 | 29.50 |
| Prophet with regressors | 23.18 | 31.56 | 27.47 | 37.80 |
| Ridge | 27.41 | 37.88 | 26.84 | 37.85 |
| Scenario | n | MAE | RMSE | R² | p95 absolute error |
|---|---|---|---|---|---|
| TimesFM 3.0 with covariates | 13584 | 16.6 | 26.74 | 0.879 | 48.52 |
| Seasonal-naive 168 h | 13584 | 29.16 | 49.03 | 0.593 | 115.38 |
| Source | Target hours | MAE (kWh) | RMSE (kWh) | R² | MAPE (%) | sMAPE (%) |
|---|---|---|---|---|---|---|
| KNMI station 344 | 1368 | 19.9682 | 30.2878 | 0.7981 | 16.9134 | 15.2548 |
| ERA5 reanalysis | 1368 | 19.968 | 30.2208 | 0.799 | 16.9045 | 15.2468 |
| Historical IFS | 1368 | 20.1373 | 30.4094 | 0.7965 | 17.1393 | 15.389 |
| Model | Fit/update median / p95 (s) | Warm 24-h inference median / p95 (s) | Peak RSS (MiB) | Peak GPU allocated (MiB) |
|---|---|---|---|---|
| TimesFM 3.0 with covariates | 0.000000 / 0.000000 | 0.9215 / 0.9680 | 4402.73 | 2470.39 |
| TimesFM 3.0 target-only | 0.000000 / 0.000000 | 0.4047 / 0.4566 | 4402.73 | 1308.73 |
| TimesFM 2.5 target-only | 0.000000 / 0.000000 | 0.1197 / 0.1394 | 2435.05 | 898.29 |
| XGBoost | 0.8418 / 3.43 | 0.001232 / 0.004213 | 378.00 | not applicable |
| Prophet with regressors | 4.19 / 5.97 | 0.3201 / 0.3582 | 254.04 | not applicable |
| Ridge | 0.0302 / 0.0359 | 0.002373 / 0.003514 | 191.07 | not applicable |
| Source identifier(s) | Scientific meaning | Domain | Unit or encoding |
|---|---|---|---|
| Exam_weeks | Exam-week indicator | calendar/schedule | binary |
| Opening_hours | Opening-hours indicator | calendar/schedule | binary |
| Hour | Hour label | calendar/schedule | hour |
| Year | Calendar year | calendar/schedule | year |
| Month | Calendar month | calendar/schedule | month |
| Week | ISO week number | calendar/schedule | week |
| Model | Validation trials | Validation MAE (kWh) | Validation RMSE (kWh) | Validation R² | Selected parameter details |
|---|---|---|---|---|---|
| TimesFM 3.0 with covariates | 64 | 19.98 | 28.90 | 0.861 | context_values=8760; make_positive=False; point_forecast=median_quantile_index_4; return_quantiles=True; use_symmetric_averaging=True; use_znorm=False |
| TimesFM 3.0 target-only | 64 | 19.37 | 28.64 | 0.863 | context_values=8760; make_positive=False; point_forecast=median_quantile_index_4; return_quantiles=True; use_symmetric_averaging=True; use_znorm=False |
| TimesFM 2.5 target-only | 8 | 23.38 | 36.26 | 0.781 | context_values=672; normalize_inputs=False |
| XGBoost | 96 | 21.27 | 28.76 | 0.862 | colsample_bytree=0.6239; learning_rate=0.01401; max_depth=7; min_child_weight=0.999; n_estimators=1350; reg_alpha=0.4845; reg_lambda=0.05573; subsample=0.7332 |
| Prophet with regressors | 96 | 24.13 | 32.16 | 0.827 | changepoint_prior_scale=0.01784; changepoint_range=0.8846; daily_fourier_order=10; daily_mode=additive; holidays_prior_scale=4.843; regressor_prior_scale=0.02489; seasonality_prior_scale=0.1609; weekly_fourier_order=7; weekly_mode=additive |
| Ridge | 25 | 26.82 | 35.69 | 0.787 | alpha=215.4 |
| Configuration | Validation MAE (kWh) | Validation RMSE (kWh) | Test MAE (kWh) | Test RMSE (kWh) |
|---|---|---|---|---|
| TimesFM 2.5 target-only | 23.38 | 36.26 | 21.07 | 31.85 |
| TimesFM 2.5 + ridge residual (jointly tuned) | 23.77 | 36.30 | 20.88 | 31.44 |
| Ridge + TimesFM 2.5 residual (jointly tuned) | 22.54 | 31.66 | 25.14 | 34.91 |
| Group | Level | Model | Target hours | MAE (kWh) | RMSE (kWh) |
|---|---|---|---|---|---|
| Day type | holiday | TimesFM 3.0 with covariates | 2760 | 17.887 | 34.969 |
| Day type | weekend | TimesFM 3.0 with covariates | 2904 | 14.648 | 25.227 |
| Day type | workday | TimesFM 3.0 with covariates | 7920 | 16.863 | 23.81 |
| Day type | holiday | Seasonal-naive 168 h | 2760 | 40.62 | 69.059 |
| Day type | weekend | Seasonal-naive 168 h | 2904 | 20.574 | 35.139 |
| Day type | workday | Seasonal-naive 168 h | 7920 | 28.317 | 44.806 |
| UTC month | Target hours | Context min | Context max | MAE (kWh) | RMSE (kWh) | Naive MAE (kWh) | Naive RMSE (kWh) |
|---|---|---|---|---|---|---|---|
| 2022-09 | 457 | 168 | 624 | 10.519 | 14.674 | 10.82 | 14.428 |
| 2022-10 | 744 | 624 | 1368 | 10.169 | 19.31 | 18.163 | 35.337 |
| 2022-11 | 720 | 1368 | 2088 | 19.474 | 31.703 | 30.046 | 45.45 |
| 2022-12 | 744 | 2088 | 2832 | 17.181 | 23.717 | 44.034 | 68.687 |
| 2023-01 | 744 | 2832 | 3576 | 19.842 | 26.994 | 40.608 | 59.109 |
| 2023-02 | 672 | 3576 | 4248 | 18.398 | 27.194 | 30.404 | 46.698 |
| Contrast | Origin days | Estimate (kWh) | 95% CI low (kWh) | 95% CI high (kWh) |
|---|---|---|---|---|
| ERA5 reanalysis − KNMI station 344 | 57 | -0.0002 | -0.1672 | 0.1706 |
| Historical IFS − KNMI station 344 | 57 | 0.1691 | 0.0071 | 0.3305 |
| Historical IFS − ERA5 reanalysis | 57 | 0.1693 | 0.0027 | 0.3249 |
| Source | Day type | Target hours | MAE (kWh) | RMSE (kWh) |
|---|---|---|---|---|
| KNMI station 344 | holiday | 264 | 24.741 | 39.332 |
| KNMI station 344 | weekend | 288 | 18.783 | 31.84 |
| KNMI station 344 | workday | 816 | 18.842 | 26.069 |
| ERA5 reanalysis | holiday | 264 | 24.965 | 39.621 |
| ERA5 reanalysis | weekend | 288 | 18.461 | 31.488 |
| ERA5 reanalysis | workday | 816 | 18.883 | 25.948 |
| Source | UTC month / season | Target hours | MAE (kWh) | RMSE (kWh) |
|---|---|---|---|---|
| KNMI station 344 | February 2024 / DJF | 649 | 23.0108 | 34.7614 |
| KNMI station 344 | March 2024 / MAM | 719 | 17.2218 | 25.5866 |
| ERA5 reanalysis | February 2024 / DJF | 649 | 23.061 | 34.7231 |
| ERA5 reanalysis | March 2024 / MAM | 719 | 17.1761 | 25.4828 |
| Historical IFS | February 2024 / DJF | 649 | 23.1571 | 34.7774 |
| Historical IFS | March 2024 / MAM | 719 | 17.4115 | 25.8402 |
Electricity Load Forecasting
Electricity load forecasting predicts future power demand to support grid operation, planning, and energy management.
See all 46 papers