Skip to content

Sampling from chain gives an error #324

Closed
@Shmuma

Description

@Shmuma

Calling sample from the Chains object returns an error "BoundsError: attempt to access 1000×2×1 Array{Float64,3} at index [[954, 537, 1308, 673, 876, 1081, 1182, 1271, 1141, 1315], 1:2, 1:1]"

How to reproduce:

@model function model_height(height)
    μ ~ Normal(178, 20)
    σ ~ Uniform(0, 50)
    height ~ Normal(μ, σ)
end

chain = sample(model_height(178), NUTS(), 1000)
sample(chain, 10)

I guess this happens due to usage of range(chain), which includes the offset to the adaptation steps. If I create sampler as NUTS(0, 0.65), everything works.

Another solution I found is to sample from the result of resetrange(chain), which is better than avoiding adaptation steps. But still, it would be better to fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions