The numpy function np.random.choice takes in an optional parameter called 'p' that denotes the probability distribution of the values it is sampling . So , my question is , even though the function generates random values , do values that have higher probability more likely to be sampled ? Meaning , does it randomly choose a value from a subset of " Most probable values " ?
Am I right in perceiving it that way ? Or can someone please correct my assumption ?
It is an optional array of probabilities p
with which respective elements of sampled array A
are sampled. So A
and p
should have the same number of elements and all elements of p
should add up to 1 (as all discrete probabilities should).