Multinomial sampling crashes

Hi all,

I am having pymc3 crash my kernel with a very simple model

with pm.Model() as model:
ps = pm.Dirichlet(‘ps’, a=np.array([1,0,0]))
counts = pm.Multinomial(“counts”,n=30,p=ps,observed=[29,1,0])

If I impose only one job (chains=1) it does not crash the kernel but gives a error “BadInitialEnergy”.

Does anyone have any idea of what could be going on?

Hi Tiago,
Yeah, it’s actually a good thing it crashes: the concentration vector of the Dirichlet has to be strictly positive, but you entered zeros at the second and third positions, so the log probability is -inf, making the model impossible to sample from.
Here is a post about Dirichlet and Multinomial distributions by @clausherther – that should help you :wink:
Hope this helps :vulcan_salute:

1 Like

Thanks!! I totally overlooked that…

1 Like