lundi 8 octobre 2018

random sample of two 100X100 multidimensional arrays, with same row no. in python numpy

I have two multidimensional array(matrix) in numpy, one being the training set(100,100 dimension) and other being the class label(100X1 dimension) I want to take random samples using np.random.choice but don't know how to figure out taking the same row no. from both matrices.

for eg.,

k=np.random.choice(10,replace=False)
temp_data=data.ix[k]
temp_datat=datat.ix[k]

would this work for sampling 10 same random rows from both my arrays data and datat?




Aucun commentaire:

Enregistrer un commentaire