SamplingError("Bad initial energy")

I am running a model with the following priors:

A =pm.TruncatedNormal(‘A’, mu=850, sd=400)
B = pm.TruncatedNormal(‘B’, mu=-0.096, sd=0.05, upper=-0.01)
C =pm.TruncatedNormal(‘C’, mu=950, sd=500, lower=1)
D = pm.TruncatedNormal(‘D’, mu=-0.093, sd=0.046, upper=-0.01)
E = pm.TruncatedNormal(‘E’, mu=3.94, sd=2, lower=0.1)
F = pm.TruncatedNormal(‘F’, mu=6.25, sd=3, lower=0.5)
G = pm.Uniform(‘G’, lower=0.1, upper=1)

The model runs well for my first set of observed data. When I try to use a second set of data that is not a close to the likeihood function, I the model crashes with the code SamplingError(“Bad initial energy”). I’ve tried re-paramaterizing, and init=‘adapt_diag’, but none of that has helped. I’ve seen advice to standardize the prior distributions. But could it just be the case that the likelihood function is not a good predictor of the second set of data?

Thank You

Stupid question but did you check whether there is nan in your second set of data?

Thank you for your quick reply. No, there isn’t a nan in my data. But your question did help me to look for other “stupid” mistakes instead of questioning the sampling or modeling parameters. After making some other adjustments to my code, I have been able to get the sampler to run successfully. Now I can focus on the parameters and sampling to fine tune the model. (I’m going to delete this question though so it doesn’t pop up in someone’s search.)

Thanks Again!

1 Like