neuralforecast
neuralforecast copied to clipboard
Neuralforecast different predictions
What happened + What you expected to happen
preds1 and preds2 yield different results. Given an inference_input_size, I should expect the forecast for preds1 and preds2 the same. Am I missing something?
Versions / Dependencies
neuralforecast==1.5.0
Reproduction script
from neuralforecast import NeuralForecast
from neuralforecast.models import LSTM
from neuralforecast.utils import AirPassengersDF
Y_df = AirPassengersDF # Defined in neuralforecast.utils
horizon = 12
models = [
LSTM(
h=horizon,
input_size=48,
inference_input_size=48,
max_steps=500,
scaler_type='standard',
encoder_hidden_size=64,
decoder_hidden_size=64,
),
]
nf = NeuralForecast(models=models, freq='M')
nf.fit(df=Y_df, val_size=64)
preds1 = nf.predict()
preds2 = nf.predict(Y_df.tail(64))
assert((preds1 == preds2).all().LSTM)
Issue Severity
Medium: It is a significant difficulty but I can work around it.
Hi @whoknowsB! The issue is probably due to the normalization. While the inference_input_size
limits the length of the input for the LSTM pass, the normalization statistics are computed on the complete history.
Shouldn't the normalization fitted (mean and std etc...) at training and then applied to inference? Why is calculated different from one to an other? This is really a concerning problem for me. Is normalization calculated on the history dynamically? I think this lead to unespected distribution shifts...