fix: preserve target scale in MFLES fallback - #1239
Open
Dresden (DresdenGman) wants to merge 1 commit into
Open
Dresden (DresdenGman) wants to merge 1 commit into
Dresden (DresdenGman) wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
Keep the original target scale in MFLES's existing short/constant-series fallback. The fallback currently runs after normalization/log transformation, overwrites the saved additive transform parameters, and returns transformed fitted values without applying the inverse transform.
For example, on
mainat99f2408:The existing fallback is intended to repeat the last observation, so these cases should return 7 on the original target scale. With
multiplicative=True, a short history such as[5, 7]also returns log-scale fitted values even though its forecasts are inverse-transformed.Changes
predictapplies the correct inverse transform.This is independent of #911's forward/update design and #1215's multi-seasonal cycle fix. It does not add a forward method or change seasonal-cycle construction.
Validation
Python 3.12.12, NumPy 2.5.3, SciPy 1.18.1, pandas 2.3.3 and scikit-learn 1.9.1; StatsForecast built from
99f2408.d31d8ab: 39 failed, 7 passed. The affected upstream code is unchanged at99f2408, where the minimal examples above still reproduce.99f2408: 48 passed across the new regression file and the existing MFLES tests.python -m pytest -o addopts='' -q tests/test_mfles_naive.py tests/test_mfles.py ruff check tests/test_mfles_naive.py python/statsforecast/mfles.py git diff --checkThe targeted command disables the full-suite coverage gate; this is not a full-suite coverage result. The existing demand-data-download integration tests were not run. Explicit log transforms of nonpositive data and seasonal decomposition output for degenerate series are outside this patch's scope.