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

Add acclogp_assume!! and acclogp_observe!! #565

Merged
merged 6 commits into from
Nov 24, 2023

Conversation

torfjelde
Copy link
Member

This PR adds two new methods:

  • acclogp_assume!!
  • acclogp_observe!!

The idea is to provide slightly more control over the acclogp!! process, beyond (#563).

The main motivation for this, is to fix the bug where particle samplers in Turing.jl currently do not respect the contextual tilde-pipeline since we accumulate the logp in the "leaf" of the tilde-pipeline, e.g. observe and assume:

This means that any context which alters the value of logp, e.g. MiniBatchContext, will have no effect.

After this PR, particle samplers can overload acclogp_observe!! to run Libtask.produce(logpdf(dist, value)), which occurs at the very end of the tilde-pipeline, hence allowing these samplers to also respect the context behaviors.

Copy link
Contributor

github-actions bot commented Nov 21, 2023

Pull Request Test Coverage Report for Build 6977964954

  • 8 of 9 (88.89%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 81.573%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/context_implementations.jl 8 9 88.89%
Totals Coverage Status
Change from base Build 6952497716: 0.02%
Covered Lines: 2572
Relevant Lines: 3153

💛 - Coveralls

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

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

Comparison is base (b52e4c2) 81.00% compared to head (3561ab2) 81.03%.

Files Patch % Lines
src/context_implementations.jl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #565      +/-   ##
==========================================
+ Coverage   81.00%   81.03%   +0.02%     
==========================================
  Files          26       26              
  Lines        3170     3174       +4     
==========================================
+ Hits         2568     2572       +4     
  Misses        602      602              

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

@devmotion
Copy link
Member

Related to #390?

Project.toml Outdated Show resolved Hide resolved
Copy link
Member

@yebai yebai left a comment

Choose a reason for hiding this comment

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

Thanks @torfjelde -- while I am happy with these changes, I find the increasingly deeper tilde pipeline hard to read. We should improve the docs, or try to simplify that in the future.

@torfjelde torfjelde enabled auto-merge November 21, 2023 22:56
@torfjelde torfjelde added this pull request to the merge queue Nov 22, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2023
@torfjelde torfjelde added this pull request to the merge queue Nov 22, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2023
@torfjelde torfjelde enabled auto-merge November 24, 2023 07:50
@torfjelde torfjelde added this pull request to the merge queue Nov 24, 2023
Merged via the queue into master with commit 11a75ff Nov 24, 2023
13 of 14 checks passed
@torfjelde torfjelde deleted the torfjelde/acclogp-improvements branch November 24, 2023 10:41
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.

3 participants