-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Instead of this code
np.random.seed(i)
np.random.shuffle(trainX)
np.random.seed(i) # make sure to reset seed again to keep labels and data together!
np.random.shuffle(trainY)
you might try something more like
rng_state = np.random.get_state()
np.random.shuffle(trainX)
np.random.set_state(rng_state)
np.random.shuffle(trainY)
It's unfortunate that the numpy shuffle routine doesn't take a random generator as an argument so that two different generators can be used in parallel. The new code rewinds the single generator to the old state between sorts. This might be more random than sampling the initial values of consecutive sequences and it won't mess up randomization elsewhere in the code if the reseed is not expected.
Metadata
Metadata
Assignees
Labels
No labels