Skip to content

[BUG] Fix y not being normalized when using EncoderNormalizer - #2393

Open
AmjadAAYD wants to merge 4 commits into
sktime:mainfrom
AmjadAAYD:fix-encoder-normalizer-decoder-target
Open

[BUG] Fix y not being normalized when using EncoderNormalizer#2393
AmjadAAYD wants to merge 4 commits into
sktime:mainfrom
AmjadAAYD:fix-encoder-normalizer-decoder-target

Conversation

@AmjadAAYD

Copy link
Copy Markdown

Fixes #2360. When using EncoderNormalizer (fit per encoder window, not globally), target_past was normalized at getitem time but the decoder target y was left raw, so the model was trained to predict the raw scale while being fed a normalized encoder input. Fixed by transforming y with the same per-sequence-fitted normalizer used for target_past. For the multi-target case, added a transform_sequence() method on ScalerAdapter mirroring fit_transform_sequence()'s per-column logic (only transform sub-normalizers that are fit_per_sequence, leave the globally-normalized ones untouched) instead of naively calling the top-level transform(), which broke GroupNormalizer sub-adapters that need group columns X. Added a regression test (test_encoder_normalizer_scales_decoder_target) verifying y now matches normalizer.transform() of the raw decoder target. Full test_data_module.py suite passes (43 passed).

@phoeenniixx phoeenniixx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you please make sure that code quality is passing?

@phoeenniixx phoeenniixx changed the title Fix y not being normalized when using EncoderNormalizer [BUG] Fix y not being normalized when using EncoderNormalizer Aug 23, 2026
@AmjadAAYD
AmjadAAYD force-pushed the fix-encoder-normalizer-decoder-target branch from 84d5de1 to 661f414 Compare August 23, 2026 20:09
@AmjadAAYD

Copy link
Copy Markdown
Author

Fixed, was just line-length + a formatting nit. Rebased on main too. Code-quality should pass now.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@062aeb4). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2393   +/-   ##
=======================================
  Coverage        ?   88.14%           
=======================================
  Files           ?      196           
  Lines           ?    11063           
  Branches        ?        0           
=======================================
  Hits            ?     9751           
  Misses          ?     1312           
  Partials        ?        0           
Flag Coverage Δ
cpu 88.14% <100.00%> (?)
pytest 88.14% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AmjadAAYD

AmjadAAYD commented Aug 24, 2026

Copy link
Copy Markdown
Author

Fixed the coverage gap too, turned out to be dead code (a shape guard that could never actually trigger for real multi-target data), removed it .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] y not being normalized when using EncoderNormalizer in EncoderDecoderDataModule

2 participants