Skip to content

Implement missing tilde_assume method #904

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

Merged
merged 1 commit into from
Apr 28, 2025
Merged

Implement missing tilde_assume method #904

merged 1 commit into from
Apr 28, 2025

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Apr 28, 2025

In Turing.jl v0.37, when a Gibbs sampler is used without specifying component samplers for all variables, the variables without samplers are sampled once at the beginning and don't ever move from there. See TuringLang/Turing.jl#2536.

This patch is required to preserve that behaviour - without this patch it will throw a MethodError as it was trying to look for the newly added method. Specifically it was this line in Turing.jl that was calling the missing method https://github.com/TuringLang/Turing.jl/blob/fc32e10bc17ae3fda4d7e825b6fde45dc7bdb179/src/mcmc/gibbs.jl#L162-L168

Should hopefully be simple enough to approve -- though I'm very much not a fan of how the N optional arguments force us to define 2^N methods, and it may be worth thinking about how to deal with this in a better way long-term. See also #720.

Copy link
Contributor

github-actions bot commented Apr 28, 2025

Benchmark Report for Commit 8402289

Computer Information

Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

|                 Model | Dimension |  AD Backend |      VarInfo Type | Linked | Eval Time / Ref Time | AD Time / Eval Time |
|-----------------------|-----------|-------------|-------------------|--------|----------------------|---------------------|
| Simple assume observe |         1 | forwarddiff |             typed |  false |                 10.1 |                 1.5 |
|           Smorgasbord |       201 | forwarddiff |             typed |  false |                761.0 |                32.7 |
|           Smorgasbord |       201 | forwarddiff | simple_namedtuple |   true |                423.4 |                44.4 |
|           Smorgasbord |       201 | forwarddiff |           untyped |   true |               1250.1 |                26.4 |
|           Smorgasbord |       201 | forwarddiff |       simple_dict |   true |               3248.0 |                23.8 |
|           Smorgasbord |       201 | reversediff |             typed |   true |               1473.2 |                30.1 |
|           Smorgasbord |       201 |    mooncake |             typed |   true |                964.7 |                 5.5 |
|    Loop univariate 1k |      1000 |    mooncake |             typed |   true |               5564.0 |                 4.1 |
|       Multivariate 1k |      1000 |    mooncake |             typed |   true |               1029.4 |                 8.9 |
|   Loop univariate 10k |     10000 |    mooncake |             typed |   true |              62861.5 |                 3.6 |
|      Multivariate 10k |     10000 |    mooncake |             typed |   true |               8802.3 |                10.1 |
|               Dynamic |        10 |    mooncake |             typed |   true |                131.7 |                13.8 |
|              Submodel |         1 |    mooncake |             typed |   true |                 13.6 |                 6.8 |
|                   LDA |        12 | reversediff |             typed |   true |                461.6 |                 6.9 |

Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.01%. Comparing base (6cd439d) to head (8402289).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/context_implementations.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #904      +/-   ##
==========================================
- Coverage   85.05%   85.01%   -0.05%     
==========================================
  Files          35       35              
  Lines        3922     3924       +2     
==========================================
  Hits         3336     3336              
- Misses        586      588       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coveralls
Copy link

coveralls commented Apr 28, 2025

Pull Request Test Coverage Report for Build 14698049682

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 85.102%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/context_implementations.jl 0 2 0.0%
Totals Coverage Status
Change from base Build 14669950832: -0.04%
Covered Lines: 3336
Relevant Lines: 3920

💛 - Coveralls

Copy link
Member

@mhauru mhauru left a comment

Choose a reason for hiding this comment

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

👍

@penelopeysm penelopeysm added this pull request to the merge queue Apr 28, 2025
Merged via the queue into main with commit e75fd1e Apr 28, 2025
15 of 18 checks passed
@penelopeysm penelopeysm deleted the py/tilde_assume branch April 28, 2025 11:30
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