TuringLang / Bijectors.jl

Implementation of normalising flows and constrained random variable transformations
https://turinglang.org/Bijectors.jl/
MIT License
196 stars 32 forks source link

support ProductDistribution #300

Closed bgctw closed 1 month ago

bgctw commented 5 months ago

When I try prescribing a prior product distribution for a multivariate random variable in Turing, I get MethodError "MethodError: no method matching bijector(::Distributions.ProductDistribution{1, 0, Tuple{LogNormal{Float64}, LogNormal{Float64}}, Continuous, Float64})"

Are there any conceptual issues with supporting ProductDistribution of known simple Distributions with Bijectors.jl?

If there was just no request or time of implementing it, I could try implementing it, but I need some guidance on what to look out for and where to start.

Here is a minimal example:

using StableRNGs: StableRNG
using Bijectors

rng = StableRNG(42);
dist = Exponential(0.1)
b = bijector(dist)              

dp = product_distribution(dist,dist)
b = bijector(dp) # fails

using Bijectors v0.13.8

prbzrg commented 5 months ago

What if you use Distributions.Product?

bgctw commented 5 months ago

Distributions.Product works.

However, there is a deprecation warning on Product in Distributions.jl

torfjelde commented 5 months ago

I'm on it; have a working version. Just writing some tests.