title: LSTM multiple feature regression data preparation
body: <p>I am modeling an LSTM model that contains multiple features and one target value. It is a regression problem.
  I have doubts that my data preparation for the LSTM is erroneous; mainly because the model learns nothing but the average of the target value.</p>
  
  <p>The following code I wrote is for preparing the data for the LSTM:</p>
  
  <pre><code># df is a pandas data frame that contains the feature columns (f1 to f5) and the target value named 'target'
  # all columns of the df are time series data (including the 'target')
  # seq_length is the sequence length 
  def prepare_data_multiple_feature(df):
      X = []
      y = []
  
      for x in range(len(df)):
          start_id = x
          end_id = x + seq_length
          one_data_point = []
          if end_id + 1 &lt;= len(df):
              # prepare X
              for col in ['f1', 'f2', 'f3', 'f4', 'f5']:
                  one_data_point.append(np.array(df[col].values[start_id:end_id]))
              X.append(np.array(one_data_point))
              # prepare y
              y.append(np.array(df['target'].values[end_id ])) 
  
      assert len(y) == len(X)
      return X, y
  </code></pre>
  
  <p>Then, I reshape the data as follows:</p>
  
  <pre><code>X, y = prepare_data_multiple_feature(df)
  X = X.reshape((len(X), seq_length, 5)) #5 is the number of features, i.e., f1 to f5
  </code></pre>
  
  <p>is my data preparation method and data reshaping correct?</p>