[BUG] normalize y when using EncoderNormalizer - #2396
Open
CodingSelim wants to merge 1 commit into
Open
Conversation
EncoderDecoderTimeSeriesDataModule fitted the per-sequence normalizer on the encoder window and normalized target_past, but left y on the raw scale. Adds ScalerAdapter.transform_sequence so the decoder window reuses the state fitted on the encoder window instead of refitting, and applies it to y.
CodingSelim
requested review from
benHeid,
fkiraly,
jdb78 and
phoeenniixx
as code owners
August 26, 2026 17:47
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2396 +/- ##
=======================================
Coverage ? 88.16%
=======================================
Files ? 196
Lines ? 11065
Branches ? 0
=======================================
Hits ? 9756
Misses ? 1309
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Fixes #2360.
What does this implement/fix? Explain your changes.
ycame out raw when the target normalizer is fitted per sequence. the encoder window gets normalized throughfit_transform_sequencebut the decoder indices were never touched, so withEncoderNormalizerthe model trains against targets on a completely different scale to its inputs:the decoder cant just call
fit_transform_sequencetoo, that would refit on the decoder window and leak. it needs to reuse whatever was fitted on the encoder window a few lines up, so i addedScalerAdapter.transform_sequenceas the transform only counterpart, same shape asfit_transform_sequence, per sequence sub normalizers transform and everything else passes through since those already had their global state applied during preprocessing. thenygoes through it.going through the whole
MultiNormalizerinstead doesnt work, aGroupNormalizersub wants the group columns and throwseither target_scale or X has to be passed, which is whattest_multivariate_target[normalizer_list2]catches.What should a reviewer concentrate their feedback on?
transform_sequencebelongs onScalerAdapteror somewhere elseDid you add any tests for the change?
yes,
test_encoder_normalizer_normalizes_y. it fails on main withassert tensor(270.) < 10.0and passes here. uses a linear series so the check is exact,yhas to be off the raw scale and carry on from the last encoder value by the same constant step.pytest tests/test_data/gives 177 passed on main and 178 with this, so just the one new test and nothing else moved. ruff format and check clean on the pinned 0.6.9.Any other comments?
PR checklist