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
The same PR also added ProductNamedTupleDistribution which is a product distribution that returns NamedTuple typed data when calling rand. For ProductNamedTupleDistribution, all the components are independent from each other. An example of it is Distributions.ProductNamedTupleDistribution.
We might want to add support for ProductNamedTupleDistribution and other NamedTupleVariate (that we and others define). This would involve making changes to the syntax, essentially introducing a stochastic version of unpacking.
For instance,
@modelfunctiondemo()
x, y ~product_distribution((x=Normal(), y=Dirichlet([2, 4])))
return x, y
end
I think updating model macro to allow Expr(:tuple, ...) on the LHS shouldn't be too hard. However it might cause some trouble with the tilde pipeline (@mhauru).
We should also think of some corner cases to avoid complications similar to dot-tilde.
The text was updated successfully, but these errors were encountered:
It's the observe statements that are really difficult to sort out, and in particular, something where part of the distribution is assumed and part of it is observed
@modelfunctionf()
1.5, y ~product_distribution((x =Normal(), y =Normal())
end
or
@modelfunctionf(x)
x, y ~product_distribution((x =Normal(), y =Normal())
end
The reason is because we've always assumed that the lhs of a tilde is a single varname and that varname is either observed (then we head down tilde_observe!!) or it isn't (then we head down tilde_assume!!).
One way of getting around this complexity is to do it properly and have that everything of a collection of variables on the lhs can be separately conditioned on 😄
Another way of getting round it would be to forbid syntax like that and make people do
JuliaStats/Distributions.jl#1803 introduced
NamedTupleVariate
.The same PR also added
ProductNamedTupleDistribution
which is a product distribution that returnsNamedTuple
typed data when callingrand
. ForProductNamedTupleDistribution
, all the components are independent from each other. An example of it is Distributions.ProductNamedTupleDistribution.We might want to add support for
ProductNamedTupleDistribution
and otherNamedTupleVariate
(that we and others define). This would involve making changes to the syntax, essentially introducing a stochastic version of unpacking.For instance,
I think updating
model
macro to allowExpr(:tuple, ...)
on the LHS shouldn't be too hard. However it might cause some trouble with the tilde pipeline (@mhauru).We should also think of some corner cases to avoid complications similar to dot-tilde.
The text was updated successfully, but these errors were encountered: