Another possible solution is to sort the numbers and add them in a
binary tree. It reduces the truncation error but makes the problem n-
log-n and therefore not worth the trouble.
Massimo
On May 29, 2012, at 9:45 AM, Pauli Virtanen wrote:
> Val Kalatsky gmail.com> writes:
>> You'll need some
Val Kalatsky 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 to be r
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 wrote:
> I am trying to sample from a Dirichlet distribution, whe
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 r