Bad initial energy when trying to build a multivariate ExGaussian model

Hi,

There are no invalid values in y. I can also reproduce the same error on simulated data through following snippet:

beta=0.5
sigma = 1.0
nu = 1.2

x = np.linspace(-2, 4, 200)
mu = beta*x
y = st.exponnorm.rvs(nu, loc=mu, scale=sigma)

with pm.Model() as exp_mod_mdel: 
    
    # Priors
    ν = pm.InverseGamma('ν', alpha=5)
    β = pm.Normal('β', sd=10)
    σ = pm.InverseGamma('σ', alpha=3)
    
    #Liklihood mean
    μ = pm.Deterministic('μ', x*β)
    
    # Likelihood
    likelihood = pm.ExGaussian('y', mu=μ, sigma=σ, nu=ν, observed=y)

    # Inference!
    trace = pm.sample(500, tune=50, cores=2)

Interestingly, sometimes these work if I pass ‘advi_map’ as init when sampling, i.e. trace = pm.sample(500, tune=50, cores=2, init='advi_map') but only sometimes.

1 Like