title: predict with different time step in LSTM using keras
body: <p>I am using keras to predict time series with LSTM and I realize that we can predict using datas that has not the same timestep than the ones we used to train. For example:</p>
  
  <pre><code>import numpy as np 
  import keras.optimizers
  from keras.models import Sequential
  from keras.layers import Dense,Activation,Dropout,TimeDistributed
  from keras.layers import LSTM
  
  Xtrain = np.random.rand(10,3,2) #Here timestep is 3
  Ytrain = np.random.rand(10,1)
  
  model = Sequential()
  model.add(LSTM(input_dim = Xtrain.shape[2],output_dim =10,return_sequences = False))
  model.add(Activation("sigmoid"))
  model.add(Dense(1))
  
  KerasOptimizer = keras.optimizers.RMSprop(lr=0.001, rho=0.9, epsilon=1e-08, decay=0.0)
  model.compile(loss="mse", optimizer=KerasOptimizer)
  model.fit(Xtrain,Ytrain,nb_epoch = 1,batch_size = 1)
  
  XBis = np.random.rand(10,4,2) #here timestep is 4
  XTer = np.random.rand(10,2,2) #here timestep is 2
  
  model.predict(Xtrain)
  model.predict(XBis)
  model.predict(XBis)
  </code></pre>
  
  <p>So my question is: why is that? If we train a model with <code>n</code> timesteps and we use data with <code>n+1</code> timestep for prediction maybe the model uses only the first <code>n</code> timesteps. But if we try to predict with <code>n-1</code> timestep, how is it working?</p>