sf = StatsForecast(df=df_agg2, ...
# general
j
sf = StatsForecast(df=df_agg2, models=[AutoARIMA()], freq='W', n_jobs = -1) forecasts = sf.forecast(7) forecasts.head()
m
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
Ah yeah the unique_id all being set to 1 worked
What if the seasonality is more monthly than weekly though?
m
For setting the optimal season_lenght you can check this article: https://robjhyndman.com/hyndsight/seasonal-periods/
j
great thank you!
m
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 🙂