Skip to content

fix(STEF-2802): skip RollingAggregatesAdder when no aggregation functions#813

Merged
egordm merged 1 commit intorelease/v4.0.0from
fix/STEF-2802-rolling-aggregates-empty-fit
Feb 20, 2026
Merged

fix(STEF-2802): skip RollingAggregatesAdder when no aggregation functions#813
egordm merged 1 commit intorelease/v4.0.0from
fix/STEF-2802-rolling-aggregates-empty-fit

Conversation

@egordm
Copy link
Collaborator

@egordm egordm commented Feb 20, 2026

Problem

`RollingAggregatesAdder` is always added to the forecasting workflow pipeline, even when `rolling_aggregate_features` is empty (e.g., for ato_regions and grid_losses origins). While `transform()` has an early-return guard for empty aggregation functions, `fit()` does not — causing `pandas.rolling().agg([])` to raise `ValueError: No objects to concatenate`.

Fix

Conditionally add `RollingAggregatesAdder` to the feature_adders list in `create_forecasting_workflow()` only when `config.rolling_aggregate_features` is non-empty. When empty, the transform is simply not created, avoiding the crash entirely.

Impact

  • Fixes crash for origins configured with `rolling_aggregate_features=[]`
  • No behavior change for origins that use rolling aggregates
  • 313 model tests pass

@egordm egordm requested a review from a team February 20, 2026 09:13
@github-actions github-actions bot added the fix Something isn't working label Feb 20, 2026
@egordm egordm requested a review from bartpleiter February 20, 2026 09:14
…ions

When rolling_aggregate_features is empty (e.g., ato_regions, grid_losses),
the RollingAggregatesAdder transform is no longer added to the pipeline.
Previously it was always added, and fit() would crash with
ValueError: No objects to concatenate when calling pandas rolling().agg([]).

Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
@egordm egordm force-pushed the fix/STEF-2802-rolling-aggregates-empty-fit branch from a2101df to 955dc66 Compare February 20, 2026 09:15
Copy link
Member

@JanMaartenvanDoorn JanMaartenvanDoorn left a comment

Choose a reason for hiding this comment

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

Looks like a good fix! Do you want to add a test to lock in this behavior?

@egordm
Copy link
Collaborator Author

egordm commented Feb 20, 2026

@JanMaartenvanDoorn Not sure. We didn't add tests on presets cause they deem as kind of configurations. Making tests on those might make them too specific to certain defaults which might change.

@egordm egordm merged commit 23d207c into release/v4.0.0 Feb 20, 2026
2 checks passed
@egordm egordm deleted the fix/STEF-2802-rolling-aggregates-empty-fit branch February 20, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments