Skip to content

fix: Fix length mismatch bug in combiner fit#834

Merged
MvLieshout merged 1 commit intorelease/v4.0.0from
fix/Fix-length-mismatch-combiner-fit-bug
Mar 12, 2026
Merged

fix: Fix length mismatch bug in combiner fit#834
MvLieshout merged 1 commit intorelease/v4.0.0from
fix/Fix-length-mismatch-combiner-fit-bug

Conversation

@MvLieshout
Copy link
Collaborator

@MvLieshout MvLieshout commented Mar 12, 2026

This pull request addresses a regression in the WeightsCombiner model by ensuring that label indices are properly aligned with the combined dataset when additional features have fewer rows than the ensemble dataset. It also adds a targeted regression test to verify this behavior.

Regression fix for label alignment:

  • Updated the fit method in learned_weights_combiner.py to reindex labels based on the index of the combined dataset, preventing shape mismatches during sample weight computation.

Testing improvements:

  • Added a regression test in test_learned_weights_combiner.py to confirm that fitting works correctly when additional_features has a shorter index than the ensemble dataset, and that no shape mismatch errors are raised.
  • Imported ForecastInputDataset, numpy, and pandas in the test file to support the new test case.

Signed-off-by: Marnix van Lieshout <marnix.van.lieshout@alliander.com>
@MvLieshout MvLieshout requested a review from a team March 12, 2026 07:53
@github-actions github-actions bot added the fix Something isn't working label Mar 12, 2026
@sonarqubecloud
Copy link

Copy link
Collaborator

@egordm egordm left a comment

Choose a reason for hiding this comment

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

LGTM!

@MvLieshout MvLieshout merged commit 1ee49d4 into release/v4.0.0 Mar 12, 2026
5 checks passed
@MvLieshout MvLieshout deleted the fix/Fix-length-mismatch-combiner-fit-bug branch March 12, 2026 08:30
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.

2 participants