Matej
10/05/2023, 7:36 AMfrom time import time
# Get the current time before forecasting starts, this will be used to measure the execution time
init = time()
# Call the forecast method of the StatsForecast instance to predict the next 28 days (h=28)
# Level is set to [90], which means that it will compute the 90% prediction interval
fcst_df = sf.forecast(df=Y_df, h=28, level=[90])
# Get the current time after the forecasting ends
end = time()
# Calculate and print the total time taken for the forecasting in minutes
print(f'Forecast Minutes: {(end - init) / 60}')
throws:
RemoteTraceback
Exception: You must pass `prediction_intervals` to compute them.
"""
Q: How should I modify the models for this to work? Should I add the Conformal Intervals somehow. (Many statistical models have conf intervals out of box?)
Thank you and have a great day.horizon = 28
models = [
SeasonalNaive(season_length=7, prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
Naive(prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
HistoricAverage(prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
CrostonOptimized(prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
ADIDA(prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
IMAPA(prediction_intervals=ConformalIntervals(n_windows=5, h=28)),
AutoETS(season_length=7, prediction_intervals=ConformalIntervals(n_windows=5, h=28))
]
with n_windows however it takes some solid time extra ;D, is there more reading to what hyperparameter makes sense for n_windows ?
Thanks.cs[i_window] = np.abs(fcst_window["mean"] - y_test)
if I add preduction intervals as follows
CrostonOptimized(prediction_intervals=ConformalIntervals(n_windows=5, h=28))
I get:
ValueError: operands could not be broadcast together with shapes (28,) (15,)
Q: How do I make statsforecast models predict with intervals ?José Morales
10/05/2023, 3:28 PMMatej
10/05/2023, 5:19 PM