Closed cscherrer closed 2 years ago
MeasureBase expects rand for <:AbstractMeasures to be set up in terms of
rand
<:AbstractMeasure
rand(::AbstractRNG, ::Type{T}, ::AbstractMeasure) where {T}
This PR makes Tilde work the same way, allowing conditional models to work with MeasureBase combinators. For example,
julia> cauchy = @model begin a ~ Normal() b ~ Normal() return a/b end; julia> rand(cauchy() ^ 10) 10-element Vector{Float64}: 34.0081 -1.59653 0.532324 -1.4452 -0.34857 -3.73643 -10.2925 0.652122 0.698344 0.435826
A final Int argument now dumps the result into a TupleVector:
Int
julia> rand(cauchy(), 1_000_000) 1000000-element TupleVector with schema (c = Float64,) (c = 0.0±11000.0,)
MeasureBase expects
rand
for<:AbstractMeasure
s to be set up in terms ofThis PR makes Tilde work the same way, allowing conditional models to work with MeasureBase combinators. For example,