Is there a way to randomly pick n-items from every row in a 2D array with the higher probability picking the bigger values w/o using a LOOP
random.choice() works only for 1D array...
F.e. if i have :
q = np.random.random((10,10))
i can pick the max-2 in every row like this :
np.sort(q,axis=1)[:,-2:]
what I want instead is to pick randomly 2 not always the max, but with higher probability the bigger numbers..
Aucun commentaire:
Enregistrer un commentaire