I want to make a sliding window for LSTM. For this I have:
x_train=[[]]
y_train = []
for i in range(10, len(train_data)):
x_train.append(train_data[i-10:i])
y_train.append(train_data[i,0])
The shape of train_data is (2730, 2), so I suppose x_train will be (2721, 10, 2).
After the loop x_train and y_train are lists of numpy arrays.
In tutorials it's enough to apply np.asarray or np.array to change it to numpy array. In my case it changes shape to (2721, ) and that's not really what I expected.
Probably, it's better to use numpy arrays and not lists.
But I wonder why in tutorials the way I do works and it doesn't for me. Maybe there is a small error or something in the code?
P.S. Sorry, I found an error by myself. It was x_train=[[]], but it should be x_train=[].