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

Jose Bordon

11/14/2022, 4:04 PM
sf = StatsForecast(df=df_agg2, models=[AutoARIMA()], freq='W', n_jobs = -1) forecasts = sf.forecast(7) forecasts.head()
m

Max (Nixtla)

11/14/2022, 4:08 PM
I think the problem is that you have a unique_id for every timestamp. Try changing the unique_id value to something like “1” or “Series 1" if you are just using 1 series.
StatsForecast can also handle multiple unique_ids automatically. If that is what you are looking for.
Also, if your data is weekly and you have more than 1 year of obserbations you can set the
season_length
parameter of the AutoArima to 52.
So, it would look something like this
Copy code
df_agg2 = df_agg2.assign(unique_id='1')

sf = StatsForecast(df=df_agg2,
                   models=[AutoARIMA(season_lenght=52)],
                   freq='W',
                  n_jobs = -1)
forecasts = sf.forecast(7)
forecasts.head()
j

Jose Bordon

11/14/2022, 4:14 PM
Ah yeah the unique_id all being set to 1 worked
What if the seasonality is more monthly than weekly though?
m

Max (Nixtla)

11/14/2022, 4:15 PM
For setting the optimal season_lenght you can check this article: https://robjhyndman.com/hyndsight/seasonal-periods/
j

Jose Bordon

11/14/2022, 4:15 PM
great thank you!
m

Max (Nixtla)

11/14/2022, 4:17 PM
You are welcome. Also, feel free to try more models and see what works best. You just have to change this line:
Copy code
models=[AutoARIMA(season_lenght=52), ETS(season_lenght=52), ... ],
Happy to help if you need anything else 🙂