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

get fails with array parameter names like "x[1,1]" #379

Open
scheidan opened this issue Aug 8, 2022 · 0 comments
Open

get fails with array parameter names like "x[1,1]" #379

scheidan opened this issue Aug 8, 2022 · 0 comments

Comments

@scheidan
Copy link

scheidan commented Aug 8, 2022

Thanks or this handy package!
While looking at namesingroup I found that get cannot handle names with square brackets:

using MCMCChains # v5.3.1

x = rand(10, 4)

# chain with array names
chn = Chains(x,  ["a", "b", "c[1]", "c[2]"])

chn["c[1]"]                     # works
chn[Symbol("c[1]")]             # works
get(chn, [:a, :b])              # works

# all these return an empty NamedTuple
get(chn, Symbol("c[1]"))        
get(chn, Symbol(["c[1]", "c[2]"]))
get(chn, namesingroup(chn, :c))


# --- all works as expected with dots:
chn2 = Chains(x,  ["a", "b", "c.d", "c.e"])

chn2["c.d"]
chn2[Symbol("c.d")]
get(chn2, [:a, :b])

get(chn2, Symbol("c.d"))
get(chn2, Symbol.(["c.d", "c.e"]))
get(chn2, namesingroup(chn2, :c, index_type=:dot))
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