I'm struggling to make LSTM work. I've found a question on Stack Overflow:
Neural Network LSTM input shape from dataframe
That seemed to help me but actually I ran into another problem: cannnot reshape data, but I do all steps like in 'instruction'.
I have 48 rows × 22 columns dataset where first column is date. Label column is separated from this dataset. So I have 21 prediction features.
but when I do
# Extract your training data
X_train_init = np.asarray(DF.padded_input_vectors)
print(X_train_init.shape)
# Use hstack to and reshape to make the inputs a 3d vector
X_train = np.hstack(X_train_init).reshape(len(DF),max_sequence_length,21)
y_train = np.hstack(np.asarray(train_target)).reshape(len(DF),1)
I get:
(48,)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-ea37bd9226df> in <module>
3 print(X_train_init.shape)
4 # Use hstack to and reshape to make the inputs a 3d vector
----> 5 X_train = np.hstack(X_train_init).reshape(len(DF),max_sequence_length,21)
6 y_train = np.hstack(np.asarray(train_target)).reshape(len(DF),1)
ValueError: cannot reshape array of size 48 into shape (48,48,21)