-
Notifications
You must be signed in to change notification settings - Fork 43
First noreference posterior task #34
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
base: main
Are you sure you want to change the base?
First noreference posterior task #34
Conversation
In the course of setting up this PR, I ran into this problem inside
I have to find out where this comes from. |
2550e18
to
ee0f00a
Compare
This PR is almost done. However, when calling this simulator with This is the backtrace at the position where the error is raised:
for some reason, @jan-matthis if you have any idea, please let me know. |
The trouble you run into has to do with a call to I think we should be able to make this work out by 1) remove the assert statement you added, and 2) overriding the def _get_transforms(
self,
*args,
**kwargs: Any,
) -> Dict[str, Any]:
return {"parameters": torch.distributions.transforms.IndependentTransform(torch.distributions.transforms.identity_transform, 1) } Note that this would simply define identity transforms. I would suggest that we rather manually specify transforms that turn the prior bounds into unbounded space by a combination of sigmoidal/affine transforms. The Gaussian Linear Uniform task has a similar prior (only with different bounds), to see which transforms are automatically constructed for it, you can take a look at them as follows: import sbibm
task = sbibm.get_task("gaussian_linear_uniform")
transforms = task._get_transforms() Being able to transform the problem into unbounded space can help performance with NLE/NRE -- so it would be nice to have appropriate transforms as part of the class for methods that do want to exploit them. Having said that, in principle the code should work with the identity transform as specified above. From what I saw, you might encounter a problem with SNPE down the line in tests -- conditioning on multiple observations is currently only supported by NLE/NRE, as explained in the message that I hope this helps! |
Thanks for the hints. For the record, I saw that only Based on your comment, I added a test for SNLE (which is tricky within it's own right, as these MCMC based SNLE runs take time ... too long for unit test). As I keep getting out-of-support posteriors, like so
I was wondering, if I could expand the Would I have to write a new task for this or can this be leveraged within a given task using the |
Sure! We should be able to fix the out-of-support problem by running MCMC in unconstrained space. For this, we would need to implement transformations to unconstrained space, e.g. a combination of affine and inverse sigmoidal transform. Adopting the transforms of the As for the summary stats question: I think it would be fine to implement this alternative scenario using the same class. I did something similar for the Bernoulli GLM example, for which there is an example with raw features as well as summary stats (as well as for the SLCP with/without distractors). |
- pyro.trace(model).get_trace incurrs that pyro.sample calls return differently shaped tensors - the new shape sentinal prevents projections to occur if the model is being traced
6064e13
to
adf572b
Compare
I digged a bit into the issue on
It took me quite some time to figure out which part of
If I understood correctly, the
could be implemented in a Bottom lineI removed the offending For the time being, I left a commented
But I lack the |
Great! The custom transforms you wrote are exactly what I was getting at. I think both options are fine -- you could either specify the transforms manually or use I'd probably go for the more general solution and add a test for it, checking it against the manual transform and asserting equivalence of transforms. |
* refactor pyabc * fix pyabc l2 norm. * increase pyabc version * refactoring. * pyabc, add sass and refactor. * refactor abc methods.
I worked on this again. Turns out the result of the |
Alright, running the |
Thanks for getting back to this! Could you try whether tests pass when you install MKL, or alternatively, (temporarily) remove it as a requirement? |
Sorry for getting back to this with some delay. I removed the MKL entirely now. If you still see some of it left-in, please let me know. |
As documented in #19, this PR rebases on
main
and adopts #19 accordinglyCloses #18