joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
352 stars 77 forks source link

Custom jump proposals #103

Closed GregoryAshton closed 5 years ago

GregoryAshton commented 6 years ago

Dear dev's,

Firstly great piece of software. I work in gravitational wave parameter estimation and we've found dynesty to be highly competitive.

One thing I've been wondering about is the ability to add "custom jump proposals", e.g. in the MCMC walks when picking new points. Is that something that is exposed in dynesty? There isn't anything immediately obvious to me. I'd be happy to help contribute if you'd like.

Second, do you have any references or papers we should cite should we use this software in an academic paper?

All the best,

Greg

joshspeagle commented 6 years ago

Glad it's been helpful!

One thing I've been wondering about is the ability to add "custom jump proposals", e.g. in the MCMC walks when picking new points. Is that something that is exposed in dynesty?

Not at the moment, but there's no reason why this shouldn't be possible if the functions are modeled after the ones in sampling.py. I should be able to add this in without too much trouble, and am also happy to take a pull request.

Second, do you have any references or papers we should cite should we use this software in an academic paper?

No, but I'm working on it! I'm optimistic it should be on the arxiv by the end of the year at the latest. Speagle (in prep.) should be okay to use in the meantime. Sorry!

joshspeagle commented 5 years ago

Well, looks like I was completely wrong on both counts.

For the first point, it turns out that because of the way I've broken up the sampling, which involves a propose_point function, an evolve_point function, and a tune_scale function, it's actually pretty difficult to fully incorporate a custom proposal pass by the user. In addition, a lot of the additional features I've added over time have been chucked into a kwargs blob that is getting passed around, which has a decent amount of opaque arguments. So it's actually pretty difficult for a user to be able to pass in a function that does reasonable things to propose a new position. This obviously isn't ideal in the long term since the fact that you can't do this is a sign that the code should ideally be refactored and reorganized. In the short term, however, I'm happy trying to incorporate additional sampling methods that have a strong argument to be included in the code by default.

I don't think this is a pressing issue so I'm just going to bench this for now. I might change my mind if users request a whole slew of possible options though.

On the second point, looks like it's actually going to be pretty close to the end of this month! Guess I was off by ~pi months ;).