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
Currently, we support a variable number of random variables but only when the random variables are elements of an array that's always at least partially sampled. That is each "symbol" in the model is assumed to be visited every time you run the model. This is enough most of the time and indeed one can group together all optional parameters in a vector and use this method, however it fails to address models of the form:
@modeldemo(x) =begin
a ~Uniform()
if a >0.5
b ~Normal(a)
x ~Normal(b)
else
c ~Uniform()
x ~Normal(c)
endend
Note that b and c will not always be "visited". The current VarInfo setup will therefore fail in those cases. One way to address this is to have an UntypedVarInfo stored inside the TypedVarInfo for previously unseen variable symbols. Then during the sampling, we can check at every iteration if there are new symbols sampled. If so, we create a new spl::Sampler whose spl.state.vi is an instance of the expanded TypedVarInfo. If we do this right, I think we will not be paying any penalty in the case where all the symbols are always visited, and we may need to pay only a small dynamic dispatch price per new symbol seen, keeping the remaining of the code type stable.
The text was updated successfully, but these errors were encountered:
Currently, we support a variable number of random variables but only when the random variables are elements of an array that's always at least partially sampled. That is each "symbol" in the model is assumed to be visited every time you run the model. This is enough most of the time and indeed one can group together all optional parameters in a vector and use this method, however it fails to address models of the form:
Note that
b
andc
will not always be "visited". The currentVarInfo
setup will therefore fail in those cases. One way to address this is to have anUntypedVarInfo
stored inside theTypedVarInfo
for previously unseen variable symbols. Then during the sampling, we can check at every iteration if there are new symbols sampled. If so, we create a newspl::Sampler
whosespl.state.vi
is an instance of the expandedTypedVarInfo
. If we do this right, I think we will not be paying any penalty in the case where all the symbols are always visited, and we may need to pay only a small dynamic dispatch price per new symbol seen, keeping the remaining of the code type stable.The text was updated successfully, but these errors were encountered: