Skip to content

[ENH] Rework ETS Forecaster #2939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

[ENH] Rework ETS Forecaster #2939

wants to merge 11 commits into from

Conversation

TonyBagnall
Copy link
Contributor

@TonyBagnall TonyBagnall commented Jul 10, 2025

some adaptations of ETS to make it compliant. The basic structure of ETS is this

_fit
    _numba_fit
    self.forecast_ = _numba_predict


_numba_fit
    for t in range(n_timepoints):
            _update_states()
                _predict_value

_numba_predict
    _predict_value

predict_value makes a step ahead prediction (and also returns two other variables, so maybe poorly named)

  1. Override iterative_forecasting
    the default method would result in refitting ETS each time. It now calls fit once then iterates numba_predict
        self.fit(y)
        preds = np.zeros(prediction_horizon)
        preds[0] = self.forecast_
        for i in range(1, prediction_horizon):
            preds[i] = _numba_predict(
                self._trend_type,
                self._seasonality_type,
                self.level_,
                self.trend_,
                self.seasonality_,
                self.phi,
                i + 1,
                self.n_timepoints_,
                self._seasonal_period,
            )
  1. With no damping, now sets phi to the horizon

  2. Not sure if I will make it "fit_is_empty" here, may be better to wait until we see how auto ets works.

@TonyBagnall TonyBagnall added the forecasting Forecasting package label Jul 10, 2025
@aeon-actions-bot aeon-actions-bot bot added the enhancement New feature, improvement request or other non-bug code enhancement label Jul 10, 2025
@aeon-actions-bot
Copy link
Contributor

Thank you for contributing to aeon

I have added the following labels to this PR based on the title: [ enhancement ].
I would have added the following labels to this PR based on the changes made: [ forecasting ], however some package labels are already present.

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

@TonyBagnall TonyBagnall requested a review from alexbanwell1 July 10, 2025 18:35
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

alexbanwell1
alexbanwell1 previously approved these changes Jul 14, 2025
Copy link
Contributor

@alexbanwell1 alexbanwell1 left a comment

Choose a reason for hiding this comment

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

Looks good to me, I've fixed the one bug that seemed to exist, so otherwise set up with the right parameters, produces similar forecasts to statsmodels

@TonyBagnall TonyBagnall marked this pull request as ready for review July 15, 2025 09:20
@TonyBagnall
Copy link
Contributor Author

our next move is to auto set the parameters

    alpha : float, default=0.1
        Level smoothing parameter.
    beta : float, default=0.01
        Trend smoothing parameter.
    gamma : float, default=0.01
        Seasonal smoothing parameter.

in fit, it doesnt really make sense for the user to set them, other packages dont and the forecasts are very sensitive to them. So ETS will fit the parameters in train, AutoETS will set the hyper parameters (additive etc) in fit using ETS

@TonyBagnall TonyBagnall requested a review from alexbanwell1 July 15, 2025 09:55
@TonyBagnall
Copy link
Contributor Author

test expected values changed because of the seasonality bug

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 forecasting Forecasting package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants