Skip to content

Conversation

@Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Jan 14, 2026

Description

  • Stop relying on start-date to be set by the user
  • Stop relying on end-date to be set by the user
  • Start testing the ForecasterParametersSchema directly to validate derivation of timing parameters
  • Added changelog item in documentation/changelog.rst

Look & Feel

possible to run forecasting cli command without start_date or end_date:

Examples:

  • flexmeasures add forecasts --sensor 20 --start-date "2025-01-01T00:00:00+01"
  • flexmeasures add forecasts --sensor 20 --end-date "2025-01-15T00:00:00+01"
  • flexmeasures add forecasts --sensor 20

How to test

pytest flexmeasures/data/schemas/tests/test_forecasting.py

...

Further Improvements

  • Clarify train-period vs max-training-window in cli.data_add.train_predict_pipeline (and for our first example in forecasting.rst we should mention train-period rather than max-training-window).
  • Rename def train_predict_pipeline -> def add_forecast

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x added this to the 0.31.0 milestone Jan 14, 2026
@read-the-docs-community
Copy link

read-the-docs-community bot commented Jan 14, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31085330 | 📁 Comparing fa098f9 against latest (64e6040)


🔍 Preview build

Show files changed (5 files in total): 📝 5 modified | ➕ 0 added | ➖ 0 deleted
File Status
changelog.html 📝 modified
genindex.html 📝 modified
_autosummary/flexmeasures.utils.config_defaults.html 📝 modified
api/v3_0.html 📝 modified
features/forecasting.html 📝 modified

@Flix6x Flix6x requested a review from BelhsanHmida January 15, 2026 08:49
Flix6x and others added 24 commits January 15, 2026 11:49
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…t_timing_parameters_of_forecaster_parameters_schema"`)

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…ameter in expected_timing_output

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…hema

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…ParametersSchema

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…riod)

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…ncy (predict_period)

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…metersSchema validation

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…f FutureWarning: 'H' is deprecated

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…n forecasting docs.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida self-assigned this Jan 20, 2026
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…Schema. this allows for default values to be loaded

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…n data_add

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida marked this pull request as ready for review January 20, 2026 21:40
Copy link
Contributor Author

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's so nice to have these new test cases to lead the discussion! They will provide a lot of clarity, and I imagine they will find there way into the docs, too, at some point.

My remarks right now are mainly ideas to add more clarity on intent and expectations to those test cases.

@pytest.mark.parametrize(
["timing_input", "expected_timing_output"],
[
# Test defaults when no timing parameters are given
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the (not floored) belief time to the expectations as well.

"train_period_in_hours": 720, # from start_date to predict_start
"predict_period_in_hours": 120, # from predict_start to end_date
# default values
"max_forecast_horizon": pd.Timedelta(hours=48),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that as a user I would have expected 5 days here.

What is the retrain frequency? The retrain frequency governs the number of cycles, right? Let's add an expectation for that parameter, too.

@pytest.mark.parametrize(
["timing_input", "expected_timing_output"],
[
# Test defaults when no timing parameters are given
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And let's already mention 3 main characteristics in each test case comment:

  1. Duration of training period (for 1st cycle)
  2. Duration of prediction period
  3. Number of cycles / (unique) belief times we expect.

"max_forecast_horizon": pd.Timedelta(hours=48),
"train_period_in_hours": 720,
"max_training_period": pd.Timedelta(days=365),
"forecast_frequency": pd.Timedelta(hours=1),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This governs how much each horizon is apart, right, rather than the number of cycles.

"forecast_frequency": pd.Timedelta(hours=1),
},
),
# Test when only start date is given with a training period
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Let's explicitly mention that for this case we expect the predict start to be computed with respect to the start date.

"forecast_frequency": pd.Timedelta(hours=1),
},
),
# Test when only end date is given with a training period
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Let's explicitly mention that for this case we expect the train start to be computed with respect to (floored) now.

"forecast_frequency": pd.Timedelta(hours=1),
},
),
# Test when only end date is given with a training period
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more suggested case:

# Test when only end date is given with a prediction period: we expect the train start and predict start to both be computed with respect to the end date.

"forecast_frequency": pd.Timedelta(hours=1),
},
),
# Test when only start date is given with a retrain frequency (prediction period)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting case. What would the user's intended effect be?

@pytest.mark.parametrize(
["timing_input", "expected_timing_output"],
[
# Test defaults when no timing parameters are given
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also prepend a comment stating the user's intent. For instance, in this case, I just need forecasts within my current planning horizon.

Actually, once having formulated that just now, I immediately recognize that it would make a lot of sense to tie the default prediction window to the app's default planning horizon.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants