Skip to content

observe and assume #504

@trappmartin

Description

@trappmartin

I think the following points regarding the current code might be problematic and changing them could improve our codebase.

  1. Assume and observe dispatch on the sampler type (which is fine) but also on Nothing. This forces us to pass nothing to the functions if no sampler is defined and have a Union{Nothing, Sampler} for the model functions. I think we can circumvent this by having different function signatures, one with and one without the sampler argument. Or do I miss something here?

  2. Currently assume and observe do in-place operations and not in-place operations at the same time More precisely, they change the VarInfo variable and also return values that are used later on. This is inconsistent and might lead to strange behaviour. I would prefer to make this consistent and ensure that all operations are either in-place or not. I feel the mixed behaviour is not very clean. See for example:

    vi.num_produce += 1
    and
    push!(vi, vn, r, dist, 0)

    Or is there a reason why cannot do all operations in-place?

cc: @yebai

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions