neuralforecast
neuralforecast copied to clipboard
RNN-Direct / LSTM-Direct produce incorrect multi-step forecasts
What happened + What you expected to happen
When using Nixtla’s RNN-Direct or LSTM-Direct classes to forecast four steps at once, the resulting mean squared error is consistently identical across all horizons, which is far higher than expected and significantly worse than other models in the same framework. By contrast, non‐RNN direct‐forecasting models such as PatchTST(h=4) produce reasonable errors, and the recurrent versions (RNNRecurrent, LSTMRecurrent) also behave as expected. This discrepancy indicates that there is likely a bug in the multi‐step prediction logic for RNN‐based direct forecasting—when RNNs are tasked with predicting all horizons simultaneously, they appear to output implausibly high error values instead of matching the baseline performance of other models.
Versions / Dependencies
neuralforecast: 3.0.1
Reproduction script
import pandas as pd from neuralforecast import NeuralForecast from neuralforecast.models import LSTM
models = [LSTM(h=forecasting_horizon, # forecasting_horizon > 1
input_size=look_back_size,
max_steps=max_steps,
learning_rate=learning_rate,
loss=MSE(), random_seed=seed,
scaler_type=scaler_type,
batch_size=batch_size,
step_size=step_size,
recurrent = False,
)]
nf = NeuralForecast(models=models, freq=1, local_scaler_type=scaler_type)
nf.fit(df_train, verbose=True, val_size=0)
preds = nf.predict(df_test)
Issue Severity
High: It blocks me from completing my task.