It seems that the copy of a list is shuffled too?
So if I do for 2 lists:
data = examples
np.random.shuffle(examples)
then the list data is also shuffled? Why?
It seems that the copy of a list is shuffled too?
So if I do for 2 lists:
data = examples
np.random.shuffle(examples)
then the list data is also shuffled? Why?
Python doesn't create copies of objects when it thinks they're not needed.
In your case you can use built-in copy module:
import copy
data = copy.deepcopy(examples)
np.random.shuffle(examples)
You have to do examples = np.copy(data) because otherwise the two variables will reference the same position in memory meaning they both change.