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

Inconsistency in product_distribution argument #1706

Closed
dmetivie opened this issue Apr 4, 2023 · 2 comments
Closed

Inconsistency in product_distribution argument #1706

dmetivie opened this issue Apr 4, 2023 · 2 comments

Comments

@dmetivie
Copy link

dmetivie commented Apr 4, 2023

Following the discussion on discourse, it seems that the product_distribution does different things based on the argument being a vector or not. Does it call the old Product interface.

Which of the following is the correct way to define a product? The first option returns the most satisfying and detailed type.

# v0.25.65 and above
julia> typeof(product_distribution([Gamma(),Normal()]...))
Distributions.ProductDistribution{1, 0, Tuple{Gamma{Float64}, Normal{Float64}}, Continuous, Float64}

julia> typeof(product_distribution([Gamma(),Normal()]))
Product{Continuous, Distribution{Univariate, Continuous}, Vector{Distribution{Univariate, Continuous}}}
# -> use the old (depreacated) Product interface?

The doc suggests an array should be used (hence the second option, where type is not fully returned).

@devmotion
Copy link
Member

Yes, this is expected. ProductDistribution is relatively new and an internal thing, users are supposed to only use product_distribution, analogously to truncated etc. Changing product_distribution(::Vector{<:UnivariateDistribution}) from returning a Product to a ProductDistribution would have been breaking, so only previously unsupported arguments return a ProductDistribution until a new breaking release of Distributions is made (which I don't expect anytime in the near future).

@dmetivie
Copy link
Author

dmetivie commented Apr 4, 2023

Thanks for the clarification!

@dmetivie dmetivie closed this as completed Apr 4, 2023
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

2 participants