Skip to content

Conversation

TinaJin0228
Copy link
Contributor

Reference Issues/PRs

#2851

What does this implement/fix? Explain your changes.

This implements the STL (Seasonal-Trend decomposition using Loess) transformer, which is a filtering procedure for decomposing a seasonal time series into three components: trend, seasonal, and remainder.

Does your contribution introduce a new dependency? If yes, which one?

No.

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors. Alternatively, you can use the @all-contributors bot to do this for you after the PR has been merged.
  • [ x The PR title starts with either [ENH], [MNT], [DOC], [BUG], [REF], [DEP] or [GOV] indicating whether the PR topic is related to enhancement, maintenance, documentation, bugs, refactoring, deprecation or governance.
For new estimators and functions
  • I've added the estimator/function to the online API documentation.
  • (OPTIONAL) I've added myself as a __maintainer__ at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.
For developers with write access
  • (OPTIONAL) I've updated aeon's CODEOWNERS to receive notifications about future changes to these files.

@TinaJin0228 TinaJin0228 requested a review from TonyBagnall as a code owner July 28, 2025 10:38
@aeon-actions-bot aeon-actions-bot bot added the transformations Transformations package label Jul 28, 2025
@aeon-actions-bot
Copy link
Contributor

Thank you for contributing to aeon

I did not find any labels to add based on the title. Please add the [ENH], [MNT], [BUG], [DOC], [REF], [DEP] and/or [GOV] tags to your pull requests titles. For now you can add the labels manually.
I have added the following labels to this PR based on the changes made: [ transformations ]. Feel free to change these if they do not properly represent the PR.

The Checks tab will show the status of our automated tests. You can click on individual test runs in the tab or "Details" in the panel below to see more information if there is a failure.

If our pre-commit code quality check fails, any trivial fixes will automatically be pushed to your PR unless it is a draft.

Don't hesitate to ask questions on the aeon Slack channel if you have any.

PR CI actions

These checkboxes will add labels to enable/disable CI functionality for this PR. This may not take effect immediately, and a new commit may be required to run the new configuration.

  • Run pre-commit checks for all files
  • Run mypy typecheck tests
  • Run all pytest tests and configurations
  • Run all notebook example tests
  • Run numba-disabled codecov tests
  • Stop automatic pre-commit fixes (always disabled for drafts)
  • Disable numba cache loading
  • Push an empty commit to re-run CI checks

@TinaJin0228 TinaJin0228 changed the title [RHN] STL transformer [EHN] STL transformer Aug 2, 2025
@TinaJin0228 TinaJin0228 changed the title [EHN] STL transformer [ENH] STL transformer Aug 2, 2025
@TinaJin0228
Copy link
Contributor Author

MSTL (#2849 )is also implemented in the same feature branch, as it is closely related to STL.

@TinaJin0228 TinaJin0228 changed the title [ENH] STL transformer [ENH] STL and MSTL transformer Aug 16, 2025
@MatthewMiddlehurst MatthewMiddlehurst added the enhancement New feature, improvement request or other non-bug code enhancement label Aug 18, 2025
@TinaJin0228
Copy link
Contributor Author

TinaJin0228 commented Aug 24, 2025

I compared the decomposition performance of Aeon's mstl transformer and R::forecast's mstl() with a simulated data sample, following the approach described in Sections 3.2 and 3.3 of the paper. Here is the record:

=== RMSE summary over replications ===
Periods: [24, 168], iterate=2, s_windows=R/aeon defaults, n=672, reps=10, sigma=0.2, slope=0.01

AEON (MSTL):
         S24:  mean=  0.083433  median=  0.084952
        S168:  mean=  0.127435  median=  0.128592
       S_sum:  mean=  0.150322  median=  0.150577
       Trend:  mean=  0.015426  median=  0.013789
   Remainder:  mean=  0.150891  median=  0.151237

R (forecast::mstl):
         S24:  mean=  0.073217  median=  0.073347
        S168:  mean=  0.114912  median=  0.114949
       S_sum:  mean=  0.133834  median=  0.133319
       Trend:  mean=  0.030561  median=  0.029889
   Remainder:  mean=  0.130836  median=  0.131252

AEON / R  (mean RMSE ratios; <1 favors AEON, ~1 is parity)
         S24:      1.1395
        S168:      1.1090
       S_sum:      1.1232
       Trend:      0.5048
   Remainder:      1.1533
rmse_aggregate components_overlay

@TinaJin0228
Copy link
Contributor Author

TinaJin0228 commented Aug 24, 2025

I accelerated the stl (and mstl) transformer and it is now much faster than that of statsmodel and statsforecast:
mstl_runtime_benchmark

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

Labels

enhancement New feature, improvement request or other non-bug code enhancement transformations Transformations package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants