-
Notifications
You must be signed in to change notification settings - Fork 4
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
rand
in ProductMeasure
incompatible with Distributions rand()
#34
Comments
Thanks @theogf . The issue isn't exactly here, but in the call passed to each marginal. In function Base.rand(rng::AbstractRNG, ::Type{T}, d::ProductMeasure) where {T}
_rand(rng, T, d, marginals(d))
end
function _rand(rng::AbstractRNG, ::Type{T}, d::ProductMeasure, mar) where {T}
(rand(rng, T, m) for m in mar)
end But I think this works better (for function Base.rand(rng::AbstractRNG, ::Type{T}, d::AbstractProductMeasure) where {T}
map(marginals(d)) do dⱼ
rand(rng, T, dⱼ)
end
end But in each case there's a call like Until this is supported in Distributions, we can add a method to dispatch on products of Distributions. Let's leave this open until that's in place. |
The plan is to use a different approach in Distributions: JuliaStats/Distributions.jl#1433 (became a bit outdated due to a recent refactoring but it is mostly done) The PR adds support for |
I think because of the
::Type{T}
inhttps://github.com/cscherrer/MeasureBase.jl/blob/917304dc4f13e8d353306d599ffc89b2f8b2acac/src/combinators/product.jl#L56
it is not possible to sample from Distributions.jl distributions.
The text was updated successfully, but these errors were encountered: