Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ProductNamedTupleDistribution #801

Open
sunxd3 opened this issue Feb 5, 2025 · 0 comments
Open

Add support for ProductNamedTupleDistribution #801

sunxd3 opened this issue Feb 5, 2025 · 0 comments

Comments

@sunxd3
Copy link
Member

sunxd3 commented Feb 5, 2025

JuliaStats/Distributions.jl#1803 introduced NamedTupleVariate.

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,

@model function demo()
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant