https://github.com/nixtla logo
#general
Title
# general
f

fede (nixtla) (they/them)

11/29/2022, 1:12 AM
Hey! As part of our #reinventforecasting week, we released the MSTL model. Show some love community ❤️ https://www.reddit.com/r/datascience/comments/z7etr8/on_the_law_of_similarity_or_how_10000yearold/
🔥 1
🎉 3
s

Sai Avinash

12/01/2022, 11:23 AM
Hello and thank you. I like the MSTL model for my timeseries. Do you recommend adjusting any hyperparameters for the MSTL or AutoARIMA models? As noted in the example notebook, I am using MSTL and AutoARIMA as trend_forecaster and am hoping to enhance prediction accuracy. I tried AutoTheta, but it takes much longer than AutoARIMA and the predictions are nearly same. Thank you very much.
f

fede (nixtla) (they/them)

12/01/2022, 7:39 PM
hey @Sai Avinash! Thanks for using our library. If your data exhibits a clear trend, you could use
RandomWalkWithDrift
as a trend forecaster. Trying
AutoETS
and
DynamicOptimizedTheta
would also be a good idea.
s

Sai Avinash

12/01/2022, 7:48 PM
@fede (nixtla) (they/them), Thank you for the suggestions. I tried to use AutoETS but I couldn't able to get it to work. Please see the error below models = [MSTL( season_length=[24*7, 24*31], #trend_forecaster=AutoARIMA() trend_forecaster=AutoETS() )]
Copy code
Exception                                 Traceback (most recent call last)
Cell In [474], line 1
----> 1 models = [MSTL(
      2     season_length=[24*7, 24*31],  #8
      3     #trend_forecaster=AutoARIMA(truncate=True)
      4     trend_forecaster=AutoETS()
      5 )]

File ~\miniconda3\envs\neuralforecast\lib\site-packages\statsforecast\models.py:2975, in MSTL.__init__(self, season_length, trend_forecaster)
   2973 if repr(trend_forecaster) == "AutoETS":
   2974     if trend_forecaster.model[2] != "N":
-> 2975         raise Exception(
   2976             "Trend forecaster should not adjust " "seasonal models."
   2977         )
   2978 if hasattr(trend_forecaster, "season_length"):
   2979     if trend_forecaster.season_length != 1:

Exception: Trend forecaster should not adjust seasonal models.
f

fede (nixtla) (they/them)

12/01/2022, 7:51 PM
hey @Sai Avinash! Passing
AutoETS(model='ZZN')
should work. In the default setting
AutoETS
also adjust seasonal models, but in this case, we don’t want to model those patterns (they are already modeled by MSTL). Passing
model='ZZN'
tells
AutoETS
to omit the seasonal models.
s

Sai Avinash

12/01/2022, 8:00 PM
Thank you for responding. I used model='ZZN' and it worked. Sorry if this has previously been covered in the docs; I'm new to NBEATS and this package. How do I make levels work with AutoETS? When I pass levels through sf.forecast, I get
Copy code
ValueError: Columns must be same length as key
f

fede (nixtla) (they/them)

12/01/2022, 8:01 PM
Yesterday we released a new version of StatsForecast, including prediction intervals for
AutoETS
. You can install the new version using
pip install statsforecast>=1.4.0
.
The new version should work as expected
No problem, @Sai Avinash! let us know any questions you have
s

Sai Avinash

12/01/2022, 8:04 PM
Thank you very much. I will update. Sorry for disturbing you; I'd also like to know if NBEATS may be used as a trend forecaster. I use NBEATS for my other timeseries and was wondering if the same could be done with MSTL
The timeseries I'm using with MSTL has a frequency of one hour. I have data going back five years. Initially, I tried NBEATS, but it was unable to identify the multiple seasonalities. I have seasonalities of 8 hours, weekly, and monthly. Then I tried your MSTL model, and it accurately reflected the seasonality.
🙌 1
f

fede (nixtla) (they/them)

12/01/2022, 8:11 PM
Currently, only StatsForecast models are supported as trend forecasters for MSTL. An interesting approach to improve performance might be to ensemble MSTL and NBEATS (or our NTHIS model). Here’s an example of how to use NHITS using the NeuralForecast library: https://nixtla.github.io/neuralforecast/examples/getting_started.html
s

Sai Avinash

12/01/2022, 8:16 PM
Thank you very much. I'll give NHITS a shot. I appreciate everything you've done. Have a wonderful day.