PIck randomly samples from a 2D matrix and keep the indexes in python

Viewed 541

I have a numpy 2D matrix with data in python and I want to perform downsampling by keeping the 25% of the initial samples. In order to do so, I am using the following random.randint functionality:

reduced_train_face = face_train[np.random.randint(face_train.shape[0], size=300), :]

However, I am having a second matrix which contains the labels associated with the faces and I want to reduce with the same way. How, can I keep the indexes from the reduced matrix and apply them to the train_lbls matrix?

2 Answers
Related