I have three parameter arrays, each containing n parameter values. Now I need to draw m independent samples using the same parameter settings, and I was wondering if there is an efficient way of doing this?
Example:
p1 = [1, 2, 3, 4], p2 = [4,4,4,4], p3 = [6,7,7,5]
One sample would be generated as:
np.random.triangular(left=p1, mode=p2, right=p3)
resulting in
[3, 6, 3, 4.5]
But I would like to get m of those, in a single ndarray ideally.
A solution could of course be to initiate a sample ndarray of size [n, m] and fill each column using a loop. However, generating all random values simultaneously is generally quicker, hence I would like to figure out if that's possible.
NOTE: adding the parameter 'size=(n,m)' does not work for array valued parameter values
Aucun commentaire:
Enregistrer un commentaire