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

Make Sampler a field of DefaultContext (renamed to SamplingContext) #80

Open
mohamed82008 opened this issue Apr 20, 2020 · 1 comment
Open

Comments

@mohamed82008
Copy link
Member

mohamed82008 commented Apr 20, 2020

Currently we have 2 arguments for changing the behavior of assume and observe, context and sampler. I think:

  1. Sampler belongs in a field in DefaultContext, perhaps renaming it to SamplingContext,
  2. SampleFromPrior should always overwrite the values in VarInfo much like SampleFromUniform in Fix SampleFromUniform #78, and
  3. ComputeLogpContext can be another context which encompasses LikelihoodContext, PriorContext and the current behavior of DefaultContext with SampleFromPrior.

I always found it confusing the SampleFromPrior doesn't actually sample anything if VarInfo already has values.

bors bot pushed a commit that referenced this issue Apr 18, 2021
…niform` (#232)

This PR is a quick fix for TuringLang/Turing.jl#1563 and TuringLang/Turing.jl#1588.

As explained in TuringLang/Turing.jl#1588 (comment), the problem is that currently `SampleFromUniform` always resamples variables in every run, and hence also initial parameters provided by users are resampled in https://github.com/TuringLang/DynamicPPL.jl/blob/9d4137eb33e83f34c484bf78f9a57f828b3c92a0/src/sampler.jl#L80.

As mentioned in TuringLang/Turing.jl#1588 (comment), a better long term solution would be to fix this inconsistency and use dedicated evaluation and sampling contexts, as suggested in #80.
@yebai
Copy link
Member

yebai commented Dec 19, 2024

@penelopeysm is this now fixed?

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

No branches or pull requests

2 participants