While working through problems in "Statistical Rethinking" - I was using pymc3 to work through the "Salamanders" problem 10H4. (code below)
The sampler always failed with an error :
The derivative of RV
alpha
.ravel()[0] is zero.
But when I passed the init='map' option to the sampler, I got similar results to others who used R code. The 'map' init option is heavily discouraged in the output of the sampler, but many of the other init options also had problems.
The data is here
I have tried changing the priors as suggested in a web search related to the error message.
with pm.Model() as hw_10_4:
alpha = pm.Normal('alpha',mu=0,sd=5)
beta = pm.Normal('beta',mu=0,sd=5)
l = pm.Deterministic('lambda',pm.math.exp(alpha + beta*pctcover))
s = pm.Poisson('salam',l,observed=salaman)
trace_10_4 = pm.sample(1000, tune=1000, init='map')
I have the result I want, but I am interested in understanding more about why I had the problem in the first place. I am new to PYMC3 and would like to fully understand what is going on.
Thanks!