You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behaviour with submodels is all very reasonable:
using DynamicPPL, Distributions
@modelfunctionf()
x ~Normal()
y ~Normal()
end@modelfunctiong()
a ~to_submodel(f())
endkeys(VarInfo(g()))
# 2-element Vector{VarName{sym, typeof(identity)} where sym}:# a.x# a.y
Now, let's say we wanted to condition x in the inner model. We can do that from the very outermost layer, by conditioning the model g(). When looked at from the outside, the x in the inner model is actually var"a.x", so that's what we need to use in the conditioning values. We see that this works perfectly:
Now if we instead wanted to condition the submodel itself (rather than the outermost model), one should expect that we can do that without prefixing. However, it doesn't work:
@modelfunctionh()
a ~to_submodel(f() | (x =1,))
endkeys(VarInfo(h()))
# 2-element Vector{VarName{sym, typeof(identity)} where sym}:# a.x# a.y
To condition on the inner model, you still have to include the prefix:
basically here we need to dig into right, get its model, get its context, and modify the values inside any ConditionContext/FixedContext as well (i don't think there's code to do that)
This behaviour with submodels is all very reasonable:
Now, let's say we wanted to condition
x
in the inner model. We can do that from the very outermost layer, by conditioning the modelg()
. When looked at from the outside, thex
in the inner model is actuallyvar"a.x"
, so that's what we need to use in the conditioning values. We see that this works perfectly:Now if we instead wanted to condition the submodel itself (rather than the outermost model), one should expect that we can do that without prefixing. However, it doesn't work:
To condition on the inner model, you still have to include the prefix:
This is quite counterintuitive and opens up things like this:
(Note that old
@submodel
had the same issue.)I didn't test
fix
; it might have the same problem.The text was updated successfully, but these errors were encountered: