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

There is no easy way to get a subchain with a given set of parameters #420

Open
dlakelan opened this issue May 18, 2023 · 3 comments
Open

Comments

@dlakelan
Copy link

At the moment I'm using something like this:

function subchain(ch,secname,vars)
    Chains(set_sections(ch,Dict(secname => vars)),secname)
end

This gets me a Chains object that I can pass to plotting and summarizing type functions without having to look at all the parameters in my models. Often I might have hundreds of nuisance parameters but might only want to summarize 5-10 important key parameters in the model.

Is there an intended way to be able to do this that I'm missing in the docs? or should we add something? It feels to me like you should probably be able to just do:

Chains(basechain,[:a,:b,:c,:d]) and get a chain with just those parameters from the basechain or something similar.

Also see discussion here: https://discourse.julialang.org/t/working-with-mcmcchains/99014

@cpfiffer
Copy link
Member

This is the default behavior when indexing into a chain, see this code.

You should very easily be able to do

chain[["parameter_1", "parameter_2"]]

@dlakelan
Copy link
Author

Thanks Cameron. After reading the docs multiple times this never really came through as an option. How can we make this more obvious and discoverable? Perhaps especially putting it in some very obvious and early examples?

@cpfiffer
Copy link
Member

cpfiffer commented May 24, 2023 via email

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

2 participants