Skip to content

Add support for ProductNamedTupleDistribution #801

Open
@sunxd3

Description

@sunxd3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions