-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
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
Indexing a multible parameters fails #411
Comments
Splitting works fine, only julia> using MCMCChains
julia> chn = Chains(rand(100, 3, 2));
julia> c1 = chn[1:5, :, :];
julia> c1
Chains MCMC chain (5×3×2 Array{Float64, 3}):
Iterations = 1:1:5
Number of chains = 2
Samples per chain = 5
parameters = param_1, param_2, param_3
Error showing value of type Chains{Float64, AxisArrays.AxisArray{Float64, 3, Array{Float64, 3}, Tuple{AxisArrays.Axis{:iter, StepRange{Int64, Int64}}, AxisArrays.Axis{:var, Vector{Symbol}}, AxisArrays.Axis{:chain, UnitRange{Int64}}}}, Missing, NamedTuple{(:parameters,), Tuple{Vector{Symbol}}}, NamedTuple{(), Tuple{}}}:
ERROR: ArgumentError: number of draws after splitting must >4 but is 2.
...
julia> ess(c1)
ERROR: ArgumentError: number of draws after splitting must >4 but is 2.
...
julia> ess(c1; split_chains=1)
ESS
parameters ess ess_per_sec
Symbol Float64 Missing
param_1 4.3214 missing
param_2 10.0000 missing
param_3 10.0000 missing
I'm not sure exactly what you mean, for me this leads (as expected) to the same error? Maybe you added a semicolon in the latter case such that printing was skipped? julia> chn[1:5]
Chains MCMC chain (5×3×2 Array{Float64, 3}):
Iterations = 1:1:5
Number of chains = 2
Samples per chain = 5
parameters = param_1, param_2, param_3
Error showing value of type Chains{Float64, AxisArrays.AxisArray{Float64, 3, Array{Float64, 3}, Tuple{AxisArrays.Axis{:iter, StepRange{Int64, Int64}}, AxisArrays.Axis{:var, Vector{Symbol}}, AxisArrays.Axis{:chain, UnitRange{Int64}}}}, Missing, NamedTuple{(:parameters,), Tuple{Vector{Symbol}}}, NamedTuple{(), Tuple{}}}:
ERROR: ArgumentError: number of draws after splitting must >4 but is 2.
... |
Indexing to get a more than one parameter fails (
MCMCChains v6.0.0
) with a not very helpful error message:This is rather surprising as
chn[1:5, 1, :]
works as nicely.Of course, we can do insteadwhich works as expected (but I think is not documented).The text was updated successfully, but these errors were encountered: