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

Support multi sample guides in Trace_ELBO #1666

Merged
merged 6 commits into from
Nov 5, 2023

Conversation

fehiepsi
Copy link
Member

This PR enables running SVI with guides which propose multiple samples.

numpyro/infer/elbo.py Show resolved Hide resolved
@@ -116,15 +124,30 @@ class Trace_ELBO(ELBO):
:param vectorize_particles: Whether to use `jax.vmap` to compute ELBOs over the
num_particles-many particles in parallel. If False use `jax.lax.map`.
Defaults to True.
:param multi_sample_guide: Whether to make an assumption that the guide proposes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not infer this from isinstance(guide, ...)? do we expect guides with this attribute apart from a small number of AutoGuides we construct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please feel free to remove this when such auto guides are available.

model_log_density, model_trace = log_density(
replay_model, args, kwargs, params
)
check_model_guide_match(model_trace, guide_trace)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we lose these two checks if multi_sample_guide==True?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can check the later one. The first one is tricky.

@martinjankowiak martinjankowiak merged commit d9b52d7 into pyro-ppl:master Nov 5, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants