Re: [Numpy-discussion] numpy.random.gamma returns 0 for small shape parameters

2012-05-29 Thread Pauli Virtanen
Val Kalatsky kalatsky at gmail.com writes: You'll need some patience to get non-zeros, especially for k=1e-5 In [84]: np.sum(np.random.gamma(1e-5,size=100)!=0.0) Out[84]: 7259 that's less than 1%. For k=1e-4 it's ~7% To clarify: the distribution is peaked at numbers that are too small

[Numpy-discussion] numpy.random.gamma returns 0 for small shape parameters

2012-05-28 Thread Uri Laserson
I am trying to sample from a Dirichlet distribution, where some of the shape parameters are very small. To do so, the algorithm samples each component individually from a Gamma(k,1) distribution where k is the shape parameter for that component of the Dirichlet. In principle, this should always

Re: [Numpy-discussion] numpy.random.gamma returns 0 for small shape parameters

2012-05-28 Thread Val Kalatsky
You'll need some patience to get non-zeros, especially for k=1e-5 In [84]: np.sum(np.random.gamma(1e-5,size=100)!=0.0) Out[84]: 7259 that's less than 1%. For k=1e-4 it's ~7% Val On Mon, May 28, 2012 at 10:33 PM, Uri Laserson uri.laser...@gmail.comwrote: I am trying to sample from a