Currently I am accessing multiple slices as follows:
First, I allocate an array that will be re-assigned many times
X = np.zeros( (batch_size, window, 5) )
This is the assignment loop that will be run multiple times (batch_indices
has different indices each time but the same shape):
for i, b in enumerate(batch_indices):
X[i] = Xs[b:b+window]
Is there a more efficient way? I feel like there should be syntax similar to:
X = Xs[ [slice(b,b+window) for b in batch_indices] ]
While the shape of Xs
is 2-dimensional, the final shape of X should be a 3-dimensional np.array. Think of it as follows: Xs
is one long multi-dimensional time-series, and X needs to be a numpy array containing many slices of the multi-dimensional time-series.