jeudi 2 janvier 2020

Randomly pick index with constant interval

Is there any way randomly pick index of numpy array with constant interval.

For Example, I have an array with shape (1, 150) that is 5*30 elements. I want to randomly pick x indices where x<=30 for each 30 elements. So, totally I will have x*5 randomly picked indices from the array.

First, I tried with np.chocie but I can't use np.choice, because it doesn't look the constant interval.

I can go with loop iteration for each elements but I feel it's not the effective way.

Is there any way in numpy?




Aucun commentaire:

Enregistrer un commentaire