I have the matrix b with b.shape = (100,200). For every element in b I want to draw a random variable from a corresponding Poisson distribution with mu = b and store this r.v. in the matrix X.
import SciPy as sc
X = sc.stats.poisson.rvs(size = np.empty((100,200)), mu = b)
This however raises an exception:
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
As far as I've understood (thanks to this post) this is due to the interpretation of arrays as boolean values. That said, I don't really see the boolean operation, as well as any possible solution (except a nested for loop, which I try to avoid to improve complexity).
Any more beautiful suggestions?
Thanks to @JohanC this is solved.
import scipy as sc
X = sc.stats.poisson.rvs(size = (100,200), mu = b)