Skip to content

[BUG] Normalize decoder targets with encoder statistics - #2362

Open
mig-builds wants to merge 2 commits into
sktime:mainfrom
mig-builds:contrib/issue-2360-normalize-decoder-target
Open

[BUG] Normalize decoder targets with encoder statistics#2362
mig-builds wants to merge 2 commits into
sktime:mainfrom
mig-builds:contrib/issue-2360-normalize-decoder-target

Conversation

@mig-builds

@mig-builds mig-builds commented Jul 29, 2026

Copy link
Copy Markdown

Reference Issues/PRs

Fixes #2360.

What does this implement/fix? Explain your changes.

EncoderDecoderTimeSeriesDataModule previously fitted
EncoderNormalizer on each encoder window and normalized target_past, but
returned the corresponding decoder target y without the sequence-local
normalization.

This PR:

  • Adds ScalerAdapter.transform_sequence() to transform data using an
    already-fitted sequence-local normalizer.
  • Fits normalization parameters exclusively on the encoder target window.
  • Reuses those parameters to transform the decoder target.
  • Preserves existing behavior for non-sequence normalizers and mixed
    multi-target configurations.
  • Documents the normalization behavior in the v2 data documentation and API
    docstring.

The decoder target is never used when fitting the normalizer, preventing future
target leakage.

What should a reviewer concentrate their feedback on?

  • Whether transform_sequence() has the appropriate behavior for single and
    multi-target normalizers.
  • Whether reusing encoder-fitted statistics for the decoder target is consistent
    with the intended EncoderNormalizer semantics.
  • Whether mixed MultiNormalizer configurations continue to preserve the
    existing behavior for non-sequence target columns.

Did you add any tests for the change?

Yes. Added test_encoder_normalizer_applies_to_decoder_target, which verifies
that:

  • Decoder y uses the normalization parameters fitted on the encoder window.
  • The normalized decoder target matches an independent transformation using the
    fitted state.
  • The returned decoder target differs from the raw target.

The complete data-module test file passes:

  • 43 tests passed
  • Ruff checks passed
  • git diff --check passed

Any other comments?

The documentation now explicitly states that sequence-local normalization is
fitted exclusively on encoder observations and then reused for both
target_past and decoder y.

PR checklist

  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG].
  • Added/modified tests.
  • Used pre-commit hooks to ensure that the code complies with repository
    hooks.

Fit sequence-local normalizers exclusively on encoder windows and reuse the fitted state for decoder targets. This prevents scale mismatches without leaking future target values.

Add regression coverage and document the normalization behavior.

Refs sktime#2360
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2362   +/-   ##
=======================================
  Coverage        ?   87.37%           
=======================================
  Files           ?      171           
  Lines           ?    10096           
  Branches        ?        0           
=======================================
  Hits            ?     8821           
  Misses          ?     1275           
  Partials        ?        0           
Flag Coverage Δ
cpu 87.37% <100.00%> (?)
pytest 87.37% <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.

Exercise one-dimensional MultiNormalizer input and the global-normalizer passthrough path added for decoder target normalization.
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

1 participant