Skip to content

Sampling with a single chain #336

Description

@philippeller

Sampling with nchains=1 results in an AssertionError:

JULIA: AssertionError: length(chains) == nchains
Stacktrace:
  [1] mcmc_init!(rng::Random123.Philox4x{UInt64, 10}, algorithm::BAT.MetropolisHastings{BAT.MvTDistProposal, BAT.RepetitionWeighting{Int64}, BAT.AdaptiveMHTuning}, 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}}, nchains::Int64, init_alg::BAT.MCMCChainPoolInit, tuning_alg::BAT.AdaptiveMHTuning, nonzero_weights::Bool, callback::Function)
    @ BAT ~/.julia/packages/BAT/Ws127/src/samplers/mcmc/chain_pool_init.jl:161
  [2] bat_sample_impl(rng::Random123.Philox4x{UInt64, 10}, target::BAT.PosteriorDensity{Float64, Float64, BAT.DensityWithShape{BAT.LFDensity{PyObject}, ScalarShape{Real}}, BAT.DistributionDensity{Distributions.Uniform{Float64}, BAT.HyperRectBounds{Float64}}, ScalarShape{Real}, BAT.HyperRectBounds{Float64}}, algorithm::BAT.MCMCSampling{BAT.MetropolisHastings{BAT.MvTDistProposal, BAT.RepetitionWeighting{Int64}, BAT.AdaptiveMHTuning}, BAT.PriorToGaussian, BAT.MCMCChainPoolInit, BAT.MCMCMultiCycleBurnin, BAT.BrooksGelmanConvergence, typeof(BAT.nop_func)})
    @ BAT ~/.julia/packages/BAT/Ws127/src/samplers/mcmc/mcmc_sample.jl:52
  [3] #bat_sample#159
    @ ~/.julia/packages/BAT/Ws127/src/algotypes/sampling_algorithm.jl:45 [inlined]
  [4] bat_sample
    @ ~/.julia/packages/BAT/Ws127/src/algotypes/sampling_algorithm.jl:45 [inlined]
  [5] #bat_sample#161
    @ ~/.julia/packages/BAT/Ws127/src/algotypes/sampling_algorithm.jl:59 [inlined]
  [6] bat_sample(target::BAT.PosteriorDensity{Float64, Float64, BAT.DensityWithShape{BAT.LFDensity{PyObject}, ScalarShape{Real}}, BAT.DistributionDensity{Distributions.Uniform{Float64}, BAT.HyperRectBounds{Float64}}, ScalarShape{Real}, BAT.HyperRectBounds{Float64}}, algorithm::BAT.MCMCSampling{BAT.MetropolisHastings{BAT.MvTDistProposal, BAT.RepetitionWeighting{Int64}, BAT.AdaptiveMHTuning}, BAT.PriorToGaussian, BAT.MCMCChainPoolInit, BAT.MCMCMultiCycleBurnin, BAT.BrooksGelmanConvergence, typeof(BAT.nop_func)})
    @ BAT ~/.julia/packages/BAT/Ws127/src/algotypes/sampling_algorithm.jl:58
  [7] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./essentials.jl:708
  [8] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)
    @ Base ./essentials.jl:706
  [9] _pyjlwrap_call(f::Function, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:28
 [10] 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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions