Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Track model_logp in other samplers #3188

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

Closed
eigenfoo opened this issue Sep 6, 2018 · 6 comments
Closed

Track model_logp in other samplers #3188

eigenfoo opened this issue Sep 6, 2018 · 6 comments

Comments

@eigenfoo
Copy link
Member

eigenfoo commented Sep 6, 2018

Following up from #3134. The previous PR only added model_logp for NUTS and HMC. Apart from them, no other sampler computes the logp (e.g. the Metropolis samplers only computes the delta_logp), so there would be overhead to require these samplers to track the logp.

Quoting @junpenglao:

I have an idea to do this also for Metropolis where we are computing the delta_logp instead of the logp. We can compute the model logp at sample 0, then from sample 1 onward we do state.logp = logp_tm1 - delta_logp which should recover the logp at time t while also cheap to compute.

We should decide what samplers should support exporting the logp (i.e. which samplers already do this, or something close to it).

@eigenfoo
Copy link
Member Author

I suggest that we add logp to the following samplers:

  • SMC: AFAICT we compute the logp here, and again, just need to percolate that up to the trace.
  • Elliptical Slice: it looks like we already compute logp, it's just a matter of percolating that information up to the trace, similar to what I did in Track model logp during sampling #3121
  • Slicer: similar to the elliptical slice above.
  • Metropolis: the Metropolis samplers compute delta_logp for each sample, so all that is required is to compute the logp for the first step, and then cumulatively sum the delta_logps.

I'm not sure if we could also add the logp to the Gibbs sampler and SGMCMC, or if that would be worthwhile.

cc @junpenglao

@eigenfoo
Copy link
Member Author

I'm confused, what is the difference between gibbs.py and metropolis.py?

@junpenglao
Copy link
Member

the ElementwiseCategorical step in gibbs.py was supposedly deprecated but there is a bug in it or something... I dont remember exactly...

@junpenglao
Copy link
Member

OK found the issue: #1563 and #2879

@ricardoV94
Copy link
Member

Related to #3546

@pymc-devs pymc-devs locked and limited conversation to collaborators Jan 26, 2022
@ricardoV94 ricardoV94 converted this issue into discussion #5395 Jan 26, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants