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

testvalue(::MvNormal) fails #206

Closed
mschauer opened this issue Jun 8, 2022 · 1 comment · Fixed by #207
Closed

testvalue(::MvNormal) fails #206

mschauer opened this issue Jun 8, 2022 · 1 comment · Fixed by #207
Assignees

Comments

@mschauer
Copy link
Member

mschauer commented Jun 8, 2022

using Tilde
model = @model (y, L) begin
    n = length(y)
    η ~ Tilde.MvNormal(μ=zeros(n), σ=L)
    for j in 1:n
        y[j] ~ Tilde.Bernoulli(logitp = η[j])
    end
end
y1 = rand(Bool, 10)
L1 = randn(10,10)
post = model(y1, L1) | (;y1)
ℓ1(θ) = logdensityof(post, (;η=θ))
ℓ1(rand(10))

works. But

ℓ(θ) = logdensityof(post, transform(as(post), θ))
ℓ(rand(10))

gives

ERROR: StackOverflowError:
Stacktrace:
 [1] testvalue(μ::MeasureTheory.OrthoLebesgue{(:μ, :σ), Tuple{Vector{Float64}, Matrix{Float64}}}) (repeats 79984 times)
   @ MeasureBase ~/.julia/packages/MeasureBase/uCYyk/src/utils.jl:12
@mschauer mschauer assigned mschauer and cscherrer and unassigned mschauer Jun 8, 2022
@cscherrer cscherrer transferred this issue from cscherrer/Tilde.jl Jun 8, 2022
@cscherrer
Copy link
Collaborator

Thanks @mschauer . The problem is here:

julia> testvalue(MvNormal=[1 0; 0 1]))
ERROR: StackOverflowError:
Stacktrace:
 [1] testvalue::MeasureTheory.OrthoLebesgue{(:σ,), Tuple{Matrix{Int64}}}) (repeats 79984 times)
   @ MeasureBase ~/.julia/packages/MeasureBase/uCYyk/src/utils.jl:12

runtests.jl has this function

function test_measure(μ)
    logdensity_def(μ, testvalue(μ)) isa AbstractFloat
end

that would check for this, but MvNormal is currently missing. That's how this slipped through the cracks.

Working on a fix now.

@cscherrer cscherrer changed the title Stackoverflow in transform testvalue(::MvNormal) fails Jun 8, 2022
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

Successfully merging a pull request may close this issue.

2 participants