Does emcee reuse likelihood values for a repeated parameters vector?
See original GitHub issueThis is not an issue, rather a question.
My likelihood is particularly costly to obtain. Since the sampler necessarily visits the same point in parameter space more than once it would be very convenient if the sampler, instead of processing the full likelihood every time, took the value from the stored array of values.
Does emcee do this already? If not, is there a specific reason for not doing it, or it just isn’t implemented?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Emcee Example
emcee is a python module that implements a very cool MCMC sampling algorithm cample an ensemble sampler. In order to more efficiently sample...
Read more >emcee - Release 3.0.1
Calculate the vector of log-probability for the walkers ... stored by the sampler will be a (nsteps, nwalkers) NumPy array with the value....
Read more >Efficient Monte Carlo algorithm for restricted maximum ...
In all the analyses with reused samples, the MC fluctuations disappeared, but the final estimates by the MC REML methods differed from the ......
Read more >Model inputs as parameters of a distribution - The Stan Forums
I have a problem, where the inputs to the Bayesian model are the parameters of the distributions, so they need to be sampled...
Read more >Data Analysis Recipes: Using Markov Chain Monte Carlo
values ) q, you can compute a pdf for data (or likelihood9) p D q ... the previous sample in the parameter space...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Andy is right here. The probability of ever visiting exactly the same coordinates is vanishingly small and when a value is repeated in the chain (e.g. if the proposal is rejected) the log prob function is not called again. Adding caching is unlikely to help performance!
In fact it may be something you can implement yourself without having to do it in emcee:
https://pythonhosted.org/joblib/memory.html
You could use the memory.cache decorator on your log-likelihood function.