For example, I have an array of values:
x = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.9, 1.1, 1.5, 1.8])
For retrieving sample from x I use
import numpy as np
np.random.choice(x, amount, p=[array of probabilities])
This choice method takes a parameter p array of probabilities associated with each value in x.
How can pass to p parameter some continuous distibution like:
np.random.choice(x, amount, p=my_func_probabilities)
Or is there other way to do it?
Aucun commentaire:
Enregistrer un commentaire