SamplingError: Bad initial energy

Muddling my way through my first PyMC3 model and am running into SamplingError: Bad Initial Energy . While using the Bayesian Model Multinomial getting error of SamplingError: Bad Initial Energy

with pm.Model() as model:

    # Parameters of the Multinomial are from a Dirichlet

    parameters = pm.Dirichlet('parameters', a=alphas, shape=4)

    # Observed data is from a Multinomial distribution

    observed_data = pm.Multinomial('observed_data', n=8, p=parameters, shape=4, observed=c)

    trace = pm.sample(draws=1000, chains=2, tune=500, init='advi')

Auto-assigning NUTS sampler…
Initializing NUTS using advi…
Average Loss = inf: 2%|▏ | 4986/200000 [00:02<01:47, 1816.73it/s]
Convergence achieved at 5000
Interrupted at 4,999 [2%]: Average Loss = nan
Sequential sampling (4 chains in 1 job)
NUTS: [parameters]
** 0%| | 0/1500 [00:00<?, ?it/s]**
---------------------------------------------------------------------------
SamplingError

There’s a FAQ on this here

2 Likes