Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Local Level - Nile.ipynb #1

Open
spring-haru opened this issue Dec 7, 2022 · 0 comments
Open

Error in Local Level - Nile.ipynb #1

spring-haru opened this issue Dec 7, 2022 · 0 comments

Comments

@spring-haru
Copy link

spring-haru commented Dec 7, 2022

In Local Level - Nile.ipynb, running the following cell generated an error indicating @mc.stochastic() caused the problem

import pymc as mc

# Priors
prior_eps = mc.Gamma('eps', 0.5, 1)
prior_eta = mc.Gamma('eta', 0.5, 1)

# Create the model for likelihood evaluation
model = sm.tsa.UnobservedComponents(nile, 'local level')

# Create the "data" component (stochastic and observed)
@mc.stochastic(dtype=sm.tsa.statespace.MLEModel, observed=True)
def loglikelihood(value=model, eps=prior_eps, eta=prior_eta):
    return value.loglike([1 / eps, 1 / eta])

# Create the PyMC model
pymc_model = mc.Model((prior_eps, prior_eta, loglikelihood))

# Create a PyMC sample and perform sampling
sampler = mc.MCMC(pymc_model)
sampler.sample(iter=10000, burn=1000, thin=10)

I think this is because pymc changed its APIs.
I wonder if you have an idea of how to update the code to make it work.

@spring-haru spring-haru changed the title Err Error in Local Level - Nile.ipynb Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant