You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indexing to get a more than one parameter fails (MCMCChains v6.0.0) with a not very helpful error message:
chn =Chains(rand(100, 3, 2))
# all this leads to:# ERROR: ArgumentError: number of draws after splitting must >4 but is 2.
chn[1:5, :, :]
chn[1:5, 1:3, :]
chn[1:5, 1:2, :]
chn[1:5, :, 1]
chn[1:5, :, 1:2]
This is rather surprising as chn[1:5, 1, :] works as nicely.
Of course, we can do instead
chn[1:5] # leads to the same error
which works as expected (but I think is not documented).
The text was updated successfully, but these errors were encountered:
Splitting works fine, only ess with the default splitting strategy can't be computed for the resulting chain and hence the display call in the REPL errors which includes a call to ess:
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.3214missing
param_2 10.0000missing
param_3 10.0000missing
Of course, we can do instead
chn[1:5]
which works as expected (but I think is not documented).
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: