title: Predicting a multiple forward time step of a time series using LSTM
body: <p>I want to predict certain values that are weekly predictable (low SNR). I need to predict the whole time series of a year formed by the weeks of the year (52 values - Figure 1)</p>
  
  <p><a href="https://i.stack.imgur.com/5qMLH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5qMLH.png" alt="Figure 1: Year time series by week"></a></p>
  
  <p>My first idea was to develop a many-to-many LSTM model (Figure 2) using Keras over TensorFlow. I'm training the model with a 52 input layer (the given time series of previous year) and 52 predicted output layer (the time series of next year). The shape of train_X is (X_examples, 52, 1), in other words, X_examples to train, 52 timesteps of 1 feature each. I understand that Keras will consider the 52 inputs as a time series of the same domain. The shape of the train_Y are the same (y_examples, 52, 1). 
  I added a TimeDistributed layer. My thought was that the algorithm will predict the values as a time series instead of isolated values (am I correct?)</p>
  
  <p>The model's code in Keras is:</p>
  
  <pre><code>y = y.reshape(y.shape[0], 52, 1)
  X = X.reshape(X.shape[0], 52, 1)
  # design network
  model = Sequential()
  model.add(LSTM(n_neurons, input_shape=(X.shape[1], X.shape[2]), return_sequences=True))
  model.add(TimeDistributed(Dense(1)))
  model.compile(loss='mean_squared_error', optimizer='adam')
  # fit network
  model.fit(X, y, epochs=n_epochs, batch_size=n_batch, verbose=2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jZfab.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/jZfab.jpg" alt="Figure 2: Many-to-many LSTM architecture"></a></p>
  
  <p>The problem is that the algorithm is not learning the example. It is predicting values very similar to the attributes' values. Am I modeling the problem correctly? </p>
  
  <p>Second question:
  Another idea is to train the algorithm with 1 input and 1 output, but then during the test how will I predict the whole 2015 time series without looking to the '1 input'? The test data will have a different shape than the training data.</p>