Skip to content

Conversation

@torfjelde
Copy link
Member

The Prior sampler should use the PriorContext when sampling, not DefaultContext.

This fixes #2169.

model,
VarInfo(),
SamplingContext(
rng, DynamicPPL.SampleFromPrior(), DynamicPPL.PriorContext()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should PriorContext() just be the default leaf context for SampleFromPrior in DynamicPPL?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but I don't think that's going to work atm because SampleFromPrior is used in too many different contexts as just "do a first sample" or "sample but also compute logjoint" or "don't sample, just evaluate the model for these parameters because I've set the delete flag to false"...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, makes sense. Maybe we should rethink the design of SampleFromPrior/SampleUniform but that's not for this PR 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! This is related to TuringLang/DynamicPPL.jl#573

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7829993171

  • -3 of 3 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/mcmc/Inference.jl 0 3 0.0%
Totals Coverage Status
Change from base Build 7687829147: 0.0%
Covered Lines: 0
Relevant Lines: 1385

💛 - Coveralls

@codecov
Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (39f5d5b) 0.00% compared to head (045ed05) 0.00%.

Files Patch % Lines
src/mcmc/Inference.jl 0.00% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #2170   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files          22      22           
  Lines        1386    1385    -1     
======================================
+ Misses       1386    1385    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@torfjelde torfjelde merged commit 990eeb2 into master Feb 9, 2024
@torfjelde torfjelde deleted the torfjelde/prior-sampler-fix branch February 9, 2024 15:08
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

Successfully merging this pull request may close these issues.

Prior sampler should use PriorContext, not DefaultContext

4 participants