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

Problem with Truncated Normal #6

Open
ianfiske opened this issue Dec 17, 2021 · 0 comments
Open

Problem with Truncated Normal #6

ianfiske opened this issue Dec 17, 2021 · 0 comments

Comments

@ianfiske
Copy link

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!

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

1 participant