Dear NumPy community,

Currently, the random.choice() function takes two arguments: an array (or int), 
a, of things to randomly draw from, and an array, p, of probabilities, which 
must sum to one. However, there are some situations in which it may be 
easier/more comprehensible to supply a list of relative weights instead of 
probabilities, for instance if you are working with frequencies. I would like 
to suggest adding a keyword argument to the random.choice() function, maybe 
"weights," that, if supplied instead of p, will use the probabilities derived 
from weights (i.e., set p = [w / sum(weights) for w in weights]).

Thank you for your time.
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

Reply via email to