I fit a model using Keras sequential with LSTM layers. The LSTM model will have certain aspects of the state carry forward from one period t to the next, besides the the input sequence of values for that period.
I fit the model on data ending Dec 31, 2025. Now I want to make a forecast starting today January 21, 2026. On the first period of the forecast, where does .predict() get the value of the hidden state? Is this initialized at a fixed value? Or is it based on the model fit last actual (Dec 31 as if the forecast were starting Jan 1st)?
While this question is conceptual, I include an example program in case it matters.
model1 = Sequential([
LSTM(128, input_shape=(ts, X1.shape[2]),dropout=0, recurrent_dropout=0, return_sequences=True), # Default activations
LSTM(64, dropout=do, recurrent_dropout=0), # Default activations
Dense(1) # Output layer
])
model1.compile(optimizer='adam', loss='mean_squared_error', metrics=['mean_absolute_error'])
history = model1.fit(
X1, y1,
epochs=ep,
batch_size=32,
verbose=verb)