You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running a cross-validation with: neuralforecast.cross_validation(df=df, n_windows=n_windows, step_size=step_size)
n_windows = 30 and step_size = 48 (I have 30' min data) and the models use horizon=48.
I get Exception: Recurrent models do not support step_size > 1
The error happens when I select any recurrent BaseRecurrent model but this was particularly when I used an LSTM.
Is this expected? if so, why?
How can I cross validate recurrent models with step_size larger then 1.
Should it be handled by the cross_val function that rolls the predicts of the BaseRecurrent models?
Best regards.
Versions / Dependencies
Neuralforecast 1.7.2
Reproduction script
import numpy as np
from neuralforecast import NeuralForecast
from neuralforecast.models import LSTM
Y_df = pd.read_parquet('https://datasets-nixtla.s3.amazonaws.com/m4-hourly.parquet')
uids = Y_df['unique_id'].unique()[:10] # Select 10 ids to make the example faster
Y_df = Y_df.query('unique_id in @uids').reset_index(drop=True)
It is expected. Recurrent models (or recursive models) predict one-step ahead and use that prediction to make the next prediction. Therefore, step_size has to be fixed to 1. This is by design for those models. The alternative would be to use "direct" models, that output the entire forecast horizon in one shot. You can see the forecast type of all available models in neuralforecast here.
hello,
I know there are direct models. What I try to mention is that as with the current implementation there is impossible to cross validate such models with step_size>1
IMHO and keeping this step_size=1 . Should the cross-validation function take care of this and roll it in case there step is >1? Making it transparent to the user. Maybe a warning mentioning what's happening.
Can I call this a feature request?
What happened + What you expected to happen
I am running a cross-validation with:
neuralforecast.cross_validation(df=df, n_windows=n_windows, step_size=step_size)
n_windows = 30 and step_size = 48 (I have 30' min data) and the models use horizon=48.
I get
Exception: Recurrent models do not support step_size > 1
The error happens when I select any recurrent
BaseRecurrent
model but this was particularly when I used an LSTM.Is this expected? if so, why?
How can I cross validate recurrent models with step_size larger then 1.
Should it be handled by the cross_val function that rolls the predicts of the
BaseRecurrent
models?Best regards.
Versions / Dependencies
Neuralforecast 1.7.2
Reproduction script
import numpy as np
from neuralforecast import NeuralForecast
from neuralforecast.models import LSTM
Y_df = pd.read_parquet('https://datasets-nixtla.s3.amazonaws.com/m4-hourly.parquet')
uids = Y_df['unique_id'].unique()[:10] # Select 10 ids to make the example faster
Y_df = Y_df.query('unique_id in @uids').reset_index(drop=True)
nf = NeuralForecast(
models=[
LSTM(h=48,scaler_type='standard',max_steps=100) ],
freq=1
)
cv_df = nf.cross_validation(Y_df, n_windows=2,step_size=48)
Issue Severity
None
The text was updated successfully, but these errors were encountered: