StanSample.jl
StanSample.jl copied to clipboard
inferencedata errors when model contains matrix parameters
julia> using StanSample, InferenceObjects
julia> model = """
parameters {
matrix[2, 3] x;
}
model {
for (i in 1:2)
x[i,:] ~ std_normal();
}
""";
julia> sm = SampleModel("foo", model);
julia> rc = stan_sample(sm);
julia> inferencedata(sm)
ERROR: ArgumentError: no valid permutation of dimensions
Stacktrace:
[1] permutedims(B::Array{Float64, 4}, perm::Tuple{Int64, Int64, Int64})
@ Base ./multidimensional.jl:1596
[2] extract(chns::Array{Float64, 3}, cnames::Vector{String}; permute_dims::Bool)
@ StanSample ~/.julia/packages/StanSample/tYGEA/src/utils/namedtuples.jl:40
[3] extract
@ StanSample ~/.julia/packages/StanSample/tYGEA/src/utils/namedtuples.jl:7 [inlined]
[4] convert_a3d(a3d_array::Array{Float64, 3}, cnames::Vector{String}, ::Val{:permuted_namedtuples})
@ StanSample ~/.julia/packages/StanSample/tYGEA/src/utils/namedtuples.jl:106
[5] read_csv_files(m::SampleModel, output_format::Symbol; include_internals::Bool, chains::UnitRange{…}, start::Int64, kwargs::@Kwargs{})
@ StanSample ~/.julia/packages/StanSample/tYGEA/src/stansamples/read_csv_files.jl:116
[6] read_csv_files
@ ~/.julia/packages/StanSample/tYGEA/src/stansamples/read_csv_files.jl:23 [inlined]
[7] #read_samples#10
@ ~/.julia/packages/StanSample/tYGEA/src/stansamples/read_samples.jl:93 [inlined]
[8] read_samples
@ ~/.julia/packages/StanSample/tYGEA/src/stansamples/read_samples.jl:84 [inlined]
[9] inferencedata(m::SampleModel; include_warmup::Bool, log_likelihood_var::Nothing, posterior_predictive_var::Nothing, predictions_var::Nothing, kwargs::@Kwargs{})
@ InferenceObjectsExt ~/.julia/packages/StanSample/tYGEA/ext/InferenceObjectsExt.jl:85
[10] inferencedata(m::SampleModel)
@ InferenceObjectsExt ~/.julia/packages/StanSample/tYGEA/ext/InferenceObjectsExt.jl:76
[11] top-level scope
@ REPL[25]:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment
julia> versioninfo()
Julia Version 1.10.0-rc1
Commit 5aaa9485436 (2023-11-03 07:44 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
Threads: 11 on 8 virtual cores
Environment:
JULIA_CMDSTAN_HOME = /home/sethaxen/software/cmdstan/2.33.1/
JULIA_NUM_THREADS = auto
JULIA_EDITOR = code
(jl_WirtqY) pkg> st
Status `/tmp/jl_WirtqY/Project.toml`
[b5cf5a8d] InferenceObjects v0.3.13
[c1514b29] StanSample v7.4.5