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

Stein mixture #1601

Merged
merged 4 commits into from
Jun 10, 2023
Merged

Stein mixture #1601

merged 4 commits into from
Jun 10, 2023

Conversation

OlaRonning
Copy link
Member

@OlaRonning OlaRonning commented Jun 6, 2023

In merging the original Stein mixture paper with ours, we found an inconsistency in the original article. We correct that here and can (probably) connect the current form with optimizing the ELBO (hence a lower bound on the marginal likelihood). Feel free to PM me for details if you are interested.

It was related to #1590. Rebase failed.

TODO

  • Update documentation
  • Update tests.
  • Refactor/rework stein loss
  • Add test for SteinLoss
  • Refactor/rework Predictive broadcasting solution for mixture guides.
  • Add test for MixtureGuidePredictive

from numpyro.infer.util import _predictive


class MixtureGuidePredictive:
Copy link
Member Author

Choose a reason for hiding this comment

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

@fehiepsi I believe we can remove the nbatch_dims=1 from Predictive. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

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

It is useful in some cases, e.g. to do predictive with (num_chains, num_samples) or for autoguide posterior samples with multiple sample shapes.

Copy link
Member

Choose a reason for hiding this comment

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

I feel that this is a bit complicated. I think the Predictive class is pretty flexible. Complicated logic to handle mixture stuff should belong to the guide, not the Predictive (correct me if I'm wrong).

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, the core is I need the mixture assignments to sample from the model. I specialized the ELBO to SteinLoss account for this.

I suppose the guide is the shared element for both cases (loss and predictive sampling) so hiding the complications there seems more modular. I'll try to lift the guide to a mixture guide (and have it as a SteinVI attribute)--then the lifted guide would work with current Predictive and ELBO. Could also simplify some logic in SteinVI. I'll sketch it and get back.

@OlaRonning
Copy link
Member Author

I will update the docs in a separate PR. This PR is already huge (sorry about that c:).

…es are returned when sites are in guide and model.
@fehiepsi
Copy link
Member

LGTM, thanks Ola!

@fehiepsi fehiepsi merged commit 0b9e0f0 into pyro-ppl:master Jun 10, 2023
@OlaRonning OlaRonning deleted the feature/sm_v2 branch June 10, 2023 14:59
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