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

ArgumentError in tutorial on Hidden Markov Models #1411

Closed
smonsays opened this issue Sep 23, 2020 · 2 comments
Closed

ArgumentError in tutorial on Hidden Markov Models #1411

smonsays opened this issue Sep 23, 2020 · 2 comments
Labels

Comments

@smonsays
Copy link

I tried running the tutorial on Hidden Markov Models but encountered ERROR: ArgumentError: index m not found when running the following lines:

# Extract our m and s parameters from the chain.
m_set = c[:m].value.data
s_set = c[:s].value.data

I am not sure how this can be fixed, i.e. how does one access a set of parameters that belong to the same array in a chain object?

@devmotion
Copy link
Member

You can use namesingroup or group, see https://github.com/TuringLang/MCMCChains.jl#groups-of-parameters. I guess it is also more natural to use Array to obtain an array ouput, .value is an implementation detail (see https://github.com/TuringLang/MCMCChains.jl#exporting-chains).

@smonsays
Copy link
Author

Thanks, the following works:

m_set = Array(group(c, :m))
s_set = Array(group(c, :s))

There is still an issue with the plotting, but I think this will now generally be addressed in TuringLang/TuringTutorials#86.

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

No branches or pull requests

4 participants