pymc3 sampling chain 0 failed

22 views Asked by At

I am trying to extract parameters for a model y=theta[0]*x+theta[1]*x**2. However when I run pymc3.sample after a short time the code crashes with an error message chain 0 failed. Any ideas how to fix this? Here is the code.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import uniform, norm
import pymc3 as pm
import arviz as az
import corner
import theano.tensor as tt

regression_model=pm.Model()
    with regression_model:
    theta=pm.Normal('theta', mu=0, sd=10,shape=2)
    H_0=pm.Deterministic('H_0', 299792458/theta[0])
    q_0=pm.Deterministic('q_0', 1-(2*H_0*theta[1])/299792458)
    sigma2=pm.InverseGamma('sigma2', 1, 1)
    mu=theta[0]*selected_redshifts+theta[1]*selected_redshifts*selected_redshifts
    distance_obs=pm.Normal('distance_obs', mu=mu, sd=tt.sqrt(sigma2), observed=corresponding_distances)

with regression_model:
    trace_NUTS=pm.sample(1000)

The code is crashing. I cannot go further.

0

There are 0 answers