Skip to content

Problem with Truncated Normal #6

@ianfiske

Description

@ianfiske

I'm unable to get Genify working with a truncated distribution. Please see this small example

using Genify
using Distributions

function truncated_normal(mean, sd, lb, ub)
    d = Truncated(Normal(mean, sd), lb, ub)
    x = rand(d)
end

gtruncated_normal = genify(truncated_normal, Float64, Float64, Float64, Float64; recurse=true)

simulate(gtruncated_normal, (0., 1., 0., 10.))

gives

MethodError: no method matching Distributions.Truncated(::Float64, ::Float64, ::Float64, ::Float64)

Closest candidates are:

Distributions.Truncated(!Matched::Distributions.UnivariateDistribution{S} where S<:Distributions.ValueSupport, ::T, ::T, ::T, !Matched::T, !Matched::T, !Matched::T) where T<:Real at /Users/ifiske/.julia/packages/Distributions/i8koA/src/truncate.jl:56

Distributions.Truncated(!Matched::Distributions.UnivariateDistribution{S} where S<:Distributions.ValueSupport, ::Real, ::Real) at deprecated.jl:70

logpdf@distributions.jl:34[inlined]
traceat(::Gen.GFSimulateState, ::Genify.WrappedDistribution{Float64, Distributions.Truncated{Distributions.Normal{Float64}, Distributions.Continuous, Float64}}, ::NTuple{4, Float64}, ::Symbol)@simulate.jl:22
trace@primitives.jl:74[inlined]
splice@Other: 3[inlined]
splice(::Genify.Options{true, true, :static, :none}, ::Gen.GFSimulateState, ::typeof(Main.workspace#156.truncated_normal), ::Float64, ::Float64, ::Float64, ::Float64)@dynamo.jl:0
(::Genify.TracedFunction{NTuple{4, Any}})(::Gen.GFSimulateState, ::Float64, ::Vararg{Float64, N} where N)@transform.jl:58
exec(::Gen.DynamicDSLFunction{Any}, ::Gen.GFSimulateState, ::NTuple{4, Float64})@dynamic.jl:58
simulate@simulate.jl:61[inlined]
top-level scope@Local: 1[inl

Am I doing something incorrect or is there a bug? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions