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

Implement a simple WL toy likelihood model (e.g. fitting gaussian mixture to actual WL likelihood) #19

Open
Tracked by #5
EiffL opened this issue Jan 7, 2022 · 2 comments
Assignees

Comments

@EiffL
Copy link
Contributor

EiffL commented Jan 7, 2022

This issue is complementary to #18 which contains a simulator with latent variables which make it an implicit model. Here we will consider a case where the marginal likelihood is known, this is much easier and this is what we use in normal cosmological inference. I think this might be a safer bet for getting some nice results on a short timescale.

I'm thinking of writing a simple weak lensing likelihood model, trying to do inference over typical 6 cosmological parameters, so without nuisance params. This is already not trivial to fit this likelihood in 6 dimensions.

I started with this notebook: https://colab.research.google.com/drive/1Jui18xm9lol00q7dXm_dDYAG2MNqF6Yx?usp=sharing
But I'll try to write a proper simulation tool.

On a 2D problem, it works shockingly well to try to learn the distribution simply by the score:
image
This is a posterior distribution on only 2 params, fitted using only 6 calls to the likelihood model. The fitted distribution is the shaded region in the background, the truth are the magma contours, the prior are the green coutours, data points are in white.

I also tried to push it to a DES Y1 problem with 21 parameters, but without success so far.

@EiffL EiffL self-assigned this Jan 7, 2022
@EiffL
Copy link
Contributor Author

EiffL commented Jan 8, 2022

Made a better notebook, to learn a 5d posterior here:
https://github.com/astrodeepnet/sbi_experiments/blob/u/EiffL/lensing_simuilation/notebooks/lensing_sims/AnalyticLensingSimulator_SIREN_5d.ipynb

Works pretty well:
image
The blue contours are learned by fitting the posterior with 200 model evaluations, the purple contours are reference ones obtained by HMC, they take O(3e4) model evaluations!

@EiffL
Copy link
Contributor Author

EiffL commented Jan 8, 2022

For now I'm using a SIREN to make this plot, and it's annoying because I can't directly sample from it, so I need to first fit the SIREN using the score to learn the log_prob, and then I run an HMC on it to get the samples.

It would be much better to be able to use a Flow here, but for that we need a flow that works in more that 2d.

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

No branches or pull requests

1 participant