I want to use keras to apply a neural network to my time-series data. TO improve the model I want to have 50 time states of input per output. The final input should have 951 samples with 50 time points of 10 features (951, 50, 10)
Therefore, I have to reshape my data. I do that doing a for loop, but is awfully slow. Is there a way to improve the code and making it faster?
Example:
import numpy as np
X = np.ones((1000,10))
for i in range(50, int(X.shape[0]) + 1):
if i == 50:
z = 0
X2 = np.array(X[z:i, :]).reshape((1, 50, X.shape[1]))
else:
X2 = np.concatenate([X2, np.array(X[z:i, :]).reshape((1, 50, X.shape[1]))])
z = z + 1