Turing.jl: ArgumentError in tutorial on Hidden Markov Models

Created on 23 Sep 2020  路  2Comments  路  Source: TuringLang/Turing.jl

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?

doc

Most helpful comment

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.

All 2 comments

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).

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ClaudMor picture ClaudMor  路  4Comments

yebai picture yebai  路  6Comments

yebai picture yebai  路  5Comments

marcoct picture marcoct  路  6Comments

xukai92 picture xukai92  路  5Comments