Skip to content

ConditionContext, FixedContext, and PrefixContext #1010

@penelopeysm

Description

@penelopeysm

Summary

Once DynamicPPL 0.37 is released, these three will be the only parent contexts left. @yebai and I think these could be 'removed' or to be precise, inserted as extra fields on the DynamicPPL.Model object rather than being part of the context stack in model.context.

This essentially amounts to some shuffling of information around so from a data structure point of view this is a sideways change, but the key benefit is that we can dispense with parent contexts entirely.

Note that these three contexts also correspond naturally to the functions condition, fix, and prefix which act on models, so in some ways it is also more natural / direct for condition(model, ...) to modify e.g. a model.conditioned field rather than to attach a ConditionContext to the model's context.

Finally, it would be nice to have a unified data structure for condition and fix. The only difference is whether logp is accumulated so this feels like an opportunity to reduce code duplication.

Progress

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions