Lets say I have a data set (numpy array) X of N samples of time series each with T time steps of a D-dimensional vector so that:
X.shape == (N,T,D)
Now I want to reshape it into x (data set) and y (labels) to apply a machine learning to predict the step in the times series.
I want to take every subseries of each sample of length n
x.shape==(N*(T-n),n,D) and y.shape==(N*(T-n)),D)
with
X[k,j:j+n,:]
being one of my samples in x
and
X[k,j+n+1,:]
it's label in y
.
Is a for-loop the only way to do that?