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

Allow MCMC transforms for MultipleIndependentConstraints prior #619

Merged
merged 3 commits into from
Jan 28, 2022

Conversation

michaeldeistler
Copy link
Contributor

@michaeldeistler michaeldeistler commented Jan 27, 2022

This PR allows to infer the transform for priors that were provided as MultipleIndependentDistributions.

In addition, it allows inferring the transform for any bounded distribution (not just interval constraints)

@michaeldeistler michaeldeistler linked an issue Jan 27, 2022 that may be closed by this pull request
@michaeldeistler michaeldeistler changed the title Remove MultipleIndependentConstraints Allow MCMC transforms for MultipleIndependentConstraints prior Jan 27, 2022
@michaeldeistler michaeldeistler marked this pull request as ready for review January 27, 2022 17:11
Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

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

looks great, thanks!
let me know what you think of the tests, and feel free to adapt them.

@@ -9,7 +9,7 @@
from sbi.inference.posteriors.mcmc_posterior import MCMCPosterior
import torch
from pyknos.mdn.mdn import MultivariateGaussianMDN
from scipy.stats import beta, multivariate_normal, uniform
from scipy.stats import beta, multivariate_normal, uniform, lognorm
Copy link
Contributor

Choose a reason for hiding this comment

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

you could move this test to transform_tests.py, or copy it to keep both.

@michaeldeistler michaeldeistler force-pushed the support-fixes branch 2 times, most recently from ef17a27 to edf42ff Compare January 28, 2022 09:11
@@ -387,7 +387,7 @@ def check_prior_support(prior):
"""

try:
within_support(prior, prior.sample())
within_support(prior, prior.sample((1,)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With a MultipleIndependent distribution support.check(sample) requires a batched sample

@@ -387,7 +387,7 @@ def check_prior_support(prior):
"""

try:
within_support(prior, prior.sample())
within_support(prior, prior.sample((1,)))
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@michaeldeistler michaeldeistler force-pushed the support-fixes branch 2 times, most recently from 8fd59c5 to cc8a956 Compare January 28, 2022 09:21
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.

Improve automatic construction of transforms from prior support
2 participants