0

I have a multi-dimensional NumPy array, that is acting as input data to my neural network. I have 2115 different (6,100,60) samples. I want to shuffle my data - rearrange the order - of the 2115 (6,100,60) samples. I want to make sure the channels, columns, and rows of (6,100,60) all stay in place - i.e., I only want to shuffle the location (in the array) of these 2115 samples.

I am not sure how to do this - any help would be appreciated.

Thank you.

1 Answer 1

1

You can shuffle the sample number (assuming first dimension) then reindex:

order = np.random.permutation(np.arange(2115))

data = data[order]
Sign up to request clarification or add additional context in comments.

5 Comments

Nevermind, I just realized it swaps the orders of the second dimension - the 6 channels. This is what I did not want to happen, do you know how I can keep these in place?
which is the dimension of 2115 samples? You need to shuffle that dimension.
its the first dimension, so would i do: data = data[order,:,:,:] ?
my data is of size (2115,6,100,60). I want everything to stay in place except for the dimension of 2115.
currently, its shuffling both the first and second dimension. - so my 6 channels are all switched up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.