NUTS sampler converges to wrong value

Hi Hrima

Using pm.Uniform is generally discouraged, is it possible to use pm.Normal instead?

Something like this should sample better

prior_l = np.zeros(len(raw_py))
prior_u = raw_py/(eff*pFE)

prior_mean = 0.5 * (prior_l + prior_u)
prior_sigma = (prior_u - prior_l) / 5.

trace_out = []
resmat = resp
truthdim = len(resmat)
model = mc.Model()    
    
with model:
    truth_raw = mc.Normal('truth_raw', 0, 1, shape=len(prior_l))
    truth = mc.Deterministic('truth', prior_mean + truth_raw * prior_sigma)

    tresmat = np.array(resmat)

    reco = theano.dot(truth, tresmat)
    out = reco

    unfolded = mc.Poisson('unfolded', mu=out, observed=np.array(raw_py))  

    trace = mc.sample(draws=2000, tune=1000, cores=2, chains=3 )

The prior of truth will be centered on the mid point of prior_l and prior_u and approx 0.5% will be below prior_l and another 0.5% above prior_u

2 Likes