You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting cryptic stackoverflow when running inference with Vector{Any} observations.
@modelfunctionexample_bug()
y =datavar(Vector{Any})
x ~MvNormalMeanCovariance(zeros(2), diageye(2))
y ~MvNormalMeanCovariance(x, diageye(2))
end
result =infer(model=example_bug(), data=(y = Any[1, 2.0], ),)
Running inference yields:
ERROR: StackOverflowError:
Stacktrace:
[1] mean(itr::PointMass{Vector{Any}})
@ Statistics ~/.julia/juliaup/julia-1.10.0+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:44
[2] mean(fn::typeof(identity), distribution::PointMass{Vector{Any}})
@ BayesBase ~/.julia/packages/BayesBase/ZObVB/src/densities/pointmass.jl:26--- the last 2 lines are repeated 39990 more times ---
[79983] mean(itr::PointMass{Vector{Any}})
@ Statistics ~/.julia/juliaup/julia-1.10.0+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:44
To circumvent this error, we need to change the data var and data input as follows, which is fine, but the error should be handled better.
@modelfunctionexample_bug()
y =datavar(Vector{Float64})
x ~MvNormalMeanCovariance(zeros(2), diageye(2))
y ~MvNormalMeanCovariance(x, diageye(2))
end
result =infer(model=example_bug(), data=(y = [1, 2.0], ))
The text was updated successfully, but these errors were encountered:
I just checked out this problem (sorry completely forgot about it), thinking it would be easy to fix, but it's not that simple. Basically, we can sort out the mean, but the cov/std/pdf/logpdf methods are trickier. And fixing only the mean is not really a solution because I suppose the rules will call cov as well. The problem is they need one(T) and zero(T) to be defined, which isn't the case when T = Any. So, in the code, we've specifically said T has to be a type of number (Real), but that's causing a confusing error because the method for T != Real doesn't exist. Maybe we should just prevent making a PointMass if T isn't a real number. What do you think?
I am getting cryptic stackoverflow when running inference with Vector{Any} observations.
Running inference yields:
To circumvent this error, we need to change the data var and data input as follows, which is fine, but the error should be handled better.
The text was updated successfully, but these errors were encountered: