Skip to content
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

names() and get() for a specific section should always return parameters in the same order #443

Open
bgctw opened this issue Nov 7, 2023 · 0 comments

Comments

@bgctw
Copy link

bgctw commented Nov 7, 2023

I encountered the following behaviour in a complex Chains object inspected from Infiltrator prompt,
where names and get return variables in a different order (similar to #326):

infil> names(df.chn, :u0)                                                                                                                                                                    
11-element Vector{Symbol}:                                                                                                                                                                   
 :s₊α_R0                                                                                                                                                                                     
 :s₊R_N0                                                                                                                                                                                     
 :s₊I_P0                                                                                                                                                                                     
 :s₊R_P0                                                                                                                                                                                     
 :s₊L_P0                                                                                                                                                                                     
 :s₊α_P0                                                                                                                                                                                     
 :s₊L0                                                                                                                                                                                       
 :s₊L_N0                                                                                                                                                                                     
 :s₊I_N0                                                                                                                                                                                     
 :s₊R0                                                                                                                                                                                       
 :s₊B0                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                       
infil> keys(get(df.chn, section=:u0))                                                                                                                                                                                                                                                                                                                                                   
(:s₊R_N0, :s₊R_P0, :s₊L_N0, :s₊I_N0, :s₊L0, :s₊α_R0, :s₊B0, :s₊L_P0, :s₊α_P0, :s₊R0, :s₊I_P0)   

I failed to construct a MWE. The following works as expected:

ulia> chn1 = Chains(rand(100, 4, 2), [:a, :b, :c, :d]);

julia> chn1s = set_section(chn1, Dict(:parameters => [:a,:b], :u0 => [:d, :c]));

julia> names(chn1s, :u0)
2-element Vector{Symbol}:
 :d
 :c

julia> keys(get(chn1s, section = :u0))
(:d, :c)

Encountered on Julia 1.9.2 and MCMCChains v6.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant