We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using the bridge sampler on samples generated with non-integer weights, it crashes (stack trace below).
It is in particular the nsamples=Int(sum(second_batch.weight)) here:
nsamples=Int(sum(second_batch.weight))
BAT.jl/src/integration/bridge_sampling_integration.jl
Line 134 in e4fcc53
I suggest for instance to use floor(Int,sum(second_batch.weight)) instead
floor(Int,sum(second_batch.weight))
ArithmeticError: <PyCall.jlwrap (in a Julia function called from Python) JULIA: InexactError: Int64(207.62753894835834) Stacktrace: [1] Int64 @ ./float.jl:723 [inlined] [2] bridge_sampling_integral(target_density::BAT.PosteriorDensity{Float64, Float64, BAT.ReshapedDensity{BAT.TransformedDensity{BAT.DensityWithShape{BAT.LFDensity{PyObject}, ScalarShape{Real}}, BAT.DistributionTransform{BAT.StandardUvNormal{Float64}, Distributions.Uniform{Float64}, ScalarShape{Real}, ScalarShape{Real}}, BAT.TDNoCorr, ScalarShape{Real}}, ArrayShape{Real, 1}}, BAT.DistributionDensity{Distributions.Product{Distributions.Continuous, BAT.StandardUvNormal{Float64}, FillArrays.Fill{BAT.StandardUvNormal{Float64}, 1, Tuple{Base.OneTo{Int64}}}}, BAT.HyperRectBounds{Float64}}, ArrayShape{Real, 1}, BAT.HyperRectBounds{Float32}}, target_samples::StructArrays.StructVector{BAT.DensitySample{Vector{Float64}, Float64, Float64, Nothing, Nothing}, NamedTuple{(:v, :logd, :weight, :info, :aux), Tuple{ArrayOfSimilarArrays{Float64, 1, 1, 2, SubArray{Float64, 2, Matrix{Float64}, Tuple{UnitRange{Int64}, Base.Slice{Base.OneTo{Int64}}}, false}}, Vector{Float64}, Vector{Float64}, Vector{Nothing}, Vector{Nothing}}}, Int64}, strict::Bool, ess_alg::BAT.EffSampleSizeFromAC{BAT.GeyerAutocorLen}) @ BAT ~/.julia/packages/BAT/Ws127/src/integration/bridge_sampling_integration.jl:134 [3] bat_integrate_impl(target::BAT.SampledDensity{BAT.PosteriorDensity{Float64, Float64, BAT.DensityWithShape{BAT.LFDensity{PyObject}, ScalarShape{Real}}, BAT.DistributionDensity{Distributions.Uniform{Float64}, BAT.HyperRectBounds{Float64}}, ScalarShape{Real}, BAT.HyperRectBounds{Float64}}, StructArrays.StructVector{BAT.DensitySample{Float64, Float64, Float64, Nothing, Nothing}, NamedTuple{(:v, :logd, :weight, :info, :aux), Tuple{SubArray{Float64, 1, Matrix{Float64}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}, Vector{Float64}, Vector{Float64}, Vector{Nothing}, Vector{Nothing}}}, Int64}, BAT.UnknownSampleGenerator}, algorithm::BAT.BridgeSampling{BAT.PriorToGaussian, BAT.EffSampleSizeFromAC{BAT.GeyerAutocorLen}}) @ BAT ~/.julia/packages/BAT/Ws127/src/integration/bridge_sampling_integration.jl:33 [4] bat_integrate(target::BAT.SampledDensity{BAT.PosteriorDensity{Float64, Float64, BAT.DensityWithShape{BAT.LFDensity{PyObject}, ScalarShape{Real}}, BAT.DistributionDensity{Distributions.Uniform{Float64}, BAT.HyperRectBounds{Float64}}, ScalarShape{Real}, BAT.HyperRectBounds{Float64}}, StructArrays.StructVector{BAT.DensitySample{Float64, Float64, Float64, Nothing, Nothing}, NamedTuple{(:v, :logd, :weight, :info, :aux), Tuple{SubArray{Float64, 1, Matrix{Float64}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}, Vector{Float64}, Vector{Float64}, Vector{Nothing}, Vector{Nothing}}}, Int64}, BAT.UnknownSampleGenerator}, algorithm::BAT.BridgeSampling{BAT.PriorToGaussian, BAT.EffSampleSizeFromAC{BAT.GeyerAutocorLen}}) @ BAT ~/.julia/packages/BAT/Ws127/src/algotypes/integration_algorithm.jl:45 [5] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Base ./essentials.jl:708 [6] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N) @ Base ./essentials.jl:706 [7] _pyjlwrap_call(f::Function, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:28 [8] pyjlwrap_call(self_::Ptr{PyCall.PyObject_struct}, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:44>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When using the bridge sampler on samples generated with non-integer weights, it crashes (stack trace below).
It is in particular the
nsamples=Int(sum(second_batch.weight))
here:BAT.jl/src/integration/bridge_sampling_integration.jl
Line 134 in e4fcc53
I suggest for instance to use
floor(Int,sum(second_batch.weight))
insteadThe text was updated successfully, but these errors were encountered: