question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does emcee reuse likelihood values for a repeated parameters vector?

See original GitHub issue

This 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:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dfmcommented, Aug 14, 2018

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!

1reaction
andyfaffcommented, Aug 13, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found