question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ENH] AutoETS to ignore multiplicative components when time series is not strictly positive

See original GitHub issue

Is your feature request related to a problem? Please describe. If a time series is not strictly positive, ETS models (from statsmodels) with multiplicative components will raise the following error:

ValueError: endog must be strictly positive when usingmultiplicative error, trend or seasonal components.

Currently AutoETS will raise the same error because it tries all the available ETS models. Ideally AutoETS will skip the models that result in this error and will try all the other ones.

Describe the solution you’d like One solution would be to add a try/except in the _fit method. The other solution I can think of is to check whether the time series is strictly positive and if it’s not remove the multiplicative components from _iter.

The following code reproduces the error:

import pandas as pd
import numpy as np
from sktime.forecasting.ets import AutoETS
from sktime.utils.plotting import plot_series

ts = pd.Series(
    10*np.sin(np.array(range(0,264))/10)+10, 
    pd.date_range("2017-01-01", periods=264,  freq="W")
)
ts[ts<1]=0
forecaster = AutoETS(auto=True, sp=52, n_jobs=-1, ignore_inf_ic=True)
plot_series(ts)
forecaster.fit(ts)
image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
HYang1996commented, Sep 24, 2021

Sounds good to me - @HYang1996 would appreciate your opinion if you can find some time?

@mloning, I’m sorry for the late reply. The fable version in R seems to check for this error as well so I think the second approach makes sense.

0reactions
mloningcommented, Sep 24, 2021

Thanks @HYang1996! So I suggest we implement that check in our version too and add a short note to the docstring.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sktime/01_forecasting.ipynb at main - GitHub
A unified framework for machine learning with time series ... 2.3.1 Exponential smoothing, theta forecaster, autoETS from statsmodels ...
Read more >
Data Preprocessing and Augmentation for Multiple Short Time ...
This paper describes attempts to use statistical time series algorithms for data preprocessing and augmenting for time series forecasting ...
Read more >
Multiplicative Decomposition Time Series Model (TS E4)
Modeling time series can be complicated however in this video I show how to create a simple model using trend and cycle as...
Read more >
Time Series Analysis: Introduction & Components of Time ...
The analysis of time series helps in forecasting or projecting the future value of the variable. Components of Time Series. The primary components...
Read more >
[ENH] AutoETS to ignore multiplicative components when time ...
If a time series is not strictly positive, ETS models (from statsmodels) with multiplicative components will raise the following error:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found