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

Batch capable sampling functions + proto-type HMC/MCMC #25

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

bhorowitz
Copy link
Collaborator

@bhorowitz bhorowitz commented Jun 19, 2020

I spent a few hours going through the various sampling related functions to make them take arrays of values. In order to get the overall likelihood working I also had to change around the power-spectra code. Right now I use map_fn to "broadcast" (appy?) two the functions over the batch (the bin-count and fft functions). Not sure if this is needed though.

I also include some MCMC and HMC examples; currently things don't look too great and it is still not particularly fast. A few things that limit speed are...

  1. Since one of the steps is painting to a 128^3 box, the batch size can't be too big or one gets out of memory errors.
  2. I inconsistently get warning messages about it having to re-trace the graph; not sure if it is retracing things for every batch...
  3. I don't really know how well parallelized those map_fn functions are. It could be that it ends up doing it sequentially and all benefits of the batching are lost...
  4. Unknown unknowns of the code :P

Also, my normalization of my likelihood is 100% incorrect; when I was trying what I thought was the correct thing my chains never moved :(

@bhorowitz
Copy link
Collaborator Author

Partially converged chain example, with truth highlighted.

download (48)

@EiffL
Copy link
Member

EiffL commented Jun 19, 2020

OOOOooooohh Sweeet!

@bhorowitz
Copy link
Collaborator Author

If someone has a chance, I could use a second set of eyes on the loss function to figure out why it seems to require me to multiply it by a tiny number to get the chain to move :-/ I assume there is a bug somewhere...

@bhorowitz
Copy link
Collaborator Author

It appears some of the issues go away when I reduce the MCMC step-size or the HMC initial step-size...

@EiffL
Copy link
Member

EiffL commented Aug 5, 2021

I'm gonna flag this as out of date most likely, and will close this PR

@EiffL
Copy link
Member

EiffL commented Aug 5, 2021

bits of codes were already merged from the ben_2021 branch

@EiffL
Copy link
Member

EiffL commented Aug 5, 2021

Ah, I think we just need the notebook with the standard MCMC

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.

3 participants