mercredi 5 avril 2017

Randomly shuffle data and labels from different files in the same order

l have two numpy arrays the first one contains data and the second one contains labels. l want to shuffle the data with respect to their labels. In other way, how can l shuffle my labels and data in the same order.

import numpy as np
data=np.genfromtxt("dataset.csv", delimiter=',')
classes=np.genfromtxt("labels.csv",dtype=np.str , delimiter='\t')

x=np.random.shuffle(data)
y=x[classes]

do this preserves the order of shuffling ?




Aucun commentaire:

Enregistrer un commentaire