pymc3 for MCMC sampling for finding minmum of chi2

23 Views Asked by At

I am trying to use PYMC3 to find minimum of a chi2. I have a observed data, but I dont have a model, instead I have a lookup table. Not to go into details, I tried to create simple "dummy" minimum not working example, because for it I am getting the same error. Here it is:

x_obs = np.linspace(0, 100, 100)
y_obs = 1 + 5 * np.exp(-2*x_obs)


def logp(c, a, l, x_obs, y_obs):
    mu = c + a * pm.math.exp(-l * x_obs)
    return pm.Normal.dist(mu=mu, sd=0.2).logp(y_obs)

with pm.Model() as model:
    c = pm.Uniform('constant', lower = 0., upper = 10., testval = 5.)
    a = pm.Uniform('amplitude', lower = 0., upper = 50., testval = 25.)
    l = pm.Uniform('lambda', lower = 0., upper = 10., testval = 5.)
    likelihood = pm.DensityDist('likelihood', logp, observed={'c': c, 'a': a, 'l': l, 'x_obs': x_obs, 'y_obs': y_obs})
    trace = pm.sample(draws=1000, tune=100, chains=4, cores=4)

and the error is: MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(constant_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.

0

There are 0 best solutions below