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

Fix missing infer key in handlers.lift #892

Merged
merged 8 commits into from
Jan 25, 2021
Merged

Fix missing infer key in handlers.lift #892

merged 8 commits into from
Jan 25, 2021

Conversation

dominikstrb
Copy link
Contributor

This PR addresses issue #891 and fixes handlers.lift in 0.5.0

@fehiepsi
Copy link
Member

fehiepsi commented Jan 25, 2021

Thanks, @dominikstrb! Welcome to your first contribution! ;) Could you add a regression test for this at test/test_mcmc.py?

def test_model_with_lift_handler():
    def model(data):
        c = numpyro.param("c", jnp.array(1.), constraint=dist.constraints.positive)
        x = numpyro.sample("x", dist.LogNormal(c, 1.), obs=data)
        return x

    nuts_kernel = NUTS(numpyro.handlers.lift(model, prior={"c": dist.Gamma(0.01, 0.01)}))
    mcmc = MCMC(nuts_kernel, num_warmup=10, num_samples=10)
    mcmc.run(random.PRNGKey(1), x)

@dominikstrb
Copy link
Contributor Author

I added the test. Thanks for your guidance!

@fehiepsi
Copy link
Member

Awesome, thanks for the fix @Dominikstr!

@fehiepsi fehiepsi merged commit c3f2d86 into pyro-ppl:master Jan 25, 2021
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

Successfully merging this pull request may close these issues.

2 participants