Matej
08/13/2023, 2:37 PMmodels = [MSTL(
season_length=[24, 24 * 7], # seasonalities of the time series
trend_forecaster=AutoARIMA() # model used to forecast trend
)]
forecasts = sf.predict(h=24, level=[90])
forecasts.head()
I get the following exception when I include the level parameter in the predict method:
Exception: You have to instantiate either the trend forecaster class or MSTL class with `prediction_intervals` to calculate them
(Without the level=[90] parameter everything seem to work fine)
I have also tried adding the conformal intervals:
MSTL(
season_length=[24, 24*7],
trend_forecaster=AutoARIMA(),
prediction_intervals=ConformalIntervals(
h = 3, # fcst horizon
n_windows = 10 # number of CV windows, (conformal scores)
)
)
This also causes the predict method to crash with the following error:
ValueError: operands could not be broadcast together with shapes (1,24) (10,3)
I have statsforecasts 1.5.0 btw.
Thanks in advance for patience.Kevin Kho
08/13/2023, 11:24 PMh
needs to equal the predict
. So try h=24
, and then they can be broadcastedfrom statsforecast.utils import ConformalIntervals
# Create a list of models and instantiation parameters
intervals = ConformalIntervals(h=24, n_windows=2)
mstl = MSTL(
season_length=[24, 24 * 7], # seasonalities of the time series
trend_forecaster=AutoARIMA(prediction_intervals=intervals) # model used to forecast trend,
)
sf = StatsForecast(
models=[mstl], # model used to fit each time series
freq='H', # frequency of the data
)
sf = sf.fit(df=df)
forecasts = sf.predict(h=24, level=[90])
forecasts.head()
prediction_intervals
on the MSTL
class doesn’t work quite yet. You need to use it on the models (again, on the master branch)Matej
08/14/2023, 9:15 AMKevin Kho
08/14/2023, 4:55 PM