Skip to content

InitContext, part 5 - Remove SamplingContext, SampleFrom{Prior,Uniform}, {tilde_,}assume #985

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

Draft
wants to merge 2 commits into
base: py/actually-use-init
Choose a base branch
from

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Jul 10, 2025

Part 1: Adding hasvalue and getvalue to AbstractPPL
Part 2: Removing hasvalue and getvalue from DynamicPPL
Part 3: Introducing InitContext and init!!
Part 4: Using ParamsInit to implement predict, returned, and initialize_values

This is part 5/N of #967.

Warning

This PR modifies DebugUtils, so there will almost certainly be conflicts with #976.

This PR removes everything that is no longer needed. SamplingContext, SampleFromPrior, SampleFromUniform, now have direct one-to-one replacements (albeit with slightly different behaviour since they now always overwrite variables in the varinfo).

It also removes assume and tilde_assume.

Prior to this PR we had two different kinds of assume, one with a sampler and one without. Now we only have the one without, so we can just move that definition into tilde_assume(::DefaultContext, ...).

Finally, tilde_assume!! has been removed as we can just dispatch on the type of right. (Previously this wasn't possible because there was a lot of stuff about is_rhs_model, etc. etc. which was removed in #960.)

Closes #859
Closes #955

@penelopeysm penelopeysm changed the base branch from main to py/actually-use-init July 10, 2025 17:00
@penelopeysm penelopeysm force-pushed the py/remove-samplingcontext branch 2 times, most recently from c32d112 to b7221cc Compare July 10, 2025 17:16
@penelopeysm penelopeysm changed the title InitContext, part 5 - Remove SamplingContext, SampleFromPrior, SampleFromUniform, and associated code InitContext, part 5 - Remove SamplingContext, SampleFrom{Prior,Uniform}, {tilde_,}assume Jul 10, 2025
This was referenced Jul 10, 2025
@penelopeysm penelopeysm force-pushed the py/remove-samplingcontext branch from b7221cc to 3835d01 Compare July 10, 2025 17:24
@penelopeysm penelopeysm force-pushed the py/actually-use-init branch from d55d378 to a392451 Compare July 10, 2025 17:33
@penelopeysm penelopeysm force-pushed the py/remove-samplingcontext branch from 3835d01 to 713034f Compare July 10, 2025 17:42
@penelopeysm penelopeysm force-pushed the py/actually-use-init branch from a392451 to 12d93e5 Compare July 10, 2025 17:44
@penelopeysm penelopeysm force-pushed the py/remove-samplingcontext branch from 713034f to 45a97ee Compare July 10, 2025 17:45
@penelopeysm penelopeysm force-pushed the py/actually-use-init branch from 12d93e5 to 7a8e7e3 Compare July 10, 2025 17:47
@penelopeysm penelopeysm force-pushed the py/remove-samplingcontext branch from 45a97ee to e817d9c Compare July 10, 2025 17:48
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.

1 participant