View code on Github

Providing public holidays as regressors to forecasting

From our journey to build forecasting as a feature within FlexMeasures: Good forecasting models are usually the result of small iterations.

Here is one of those iterations: the image shows the improvement from telling your model during training (and in production) what days are public holidays.

The difference made in forecasts with holiday annotations
The difference made in forecasts with holiday annotations

In this example, energy prices are much lower than on a normal Thursday afternoon. That's because it is Ascension Day's afternoon (and thus much lower energy demand).

The model we trained with knowledge on what a holiday is caught this correctly.

Now, integrating a correct list of holidays for all regions of the world (or maybe Europe, to start with), is of course needed. But we already solved that, too :) FlexMeasures can automatically import public holidays (per country) using the specific flexmeasures add holidays command.

In FlexMeasures, training a forecaster with holidays as regressor is shipping soon (already on main). Here is the CLI command:

flexmeasures add forecasts--sensor 14 \ --start 2026-05-11T00:00:00+02:00 \ --end 2026-05-18T00:00:00+02:00 \ --annotation-regressors '{"asset": 8, "annotation-type": "holiday"}'

So ― under the hood, the annotation feature is used here. the add holidays command creates annotations, which the add forecast command uses to learn. 

As you should be used to by now, everything can also happen in the API. We talked about forecasting in another post. Here is an example how to add annotations:

You can post annotation from API:

POST /api/v3_0/assets/<id>/annotations

{
  "content": "Factory shutdown",
  "start": "2026-05-14T00:00:00+02:00",
  "end": "2026-05-18T00:00:00+02:00",
  "type": "holiday"
    }

Annotations are also visible in the UI, if you view their asset or sensor's graphs.

They are actually a versatile tool. There is more them. Read up on annotations in the docs.