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

Usability of Bayesian HMM Tutorial #114

Open
TimKo90 opened this issue Mar 29, 2021 · 5 comments
Open

Usability of Bayesian HMM Tutorial #114

TimKo90 opened this issue Mar 29, 2021 · 5 comments

Comments

@TimKo90
Copy link

TimKo90 commented Mar 29, 2021

Hi! First of all, thank you very much for this package and the detailed tutorial! I just started working with Turing.jl and noticed a few issues when going through the Bayesian HMM Tutorial. Some of them are addressed in #86 and will likely be solved anyway, but there is one thing not mentioned there.

When I copy & paste the code given from the tutorial and run it on my machine, the simulated trajectory doesn't converge to the "experimental" one as it does in the animation in the tutorial:

HMM-Tutorial

I'm aware of the stochasticity of the process and ran the code a couple of times, but never got close to the result given in the tutorial. Is there any additional code that I need to run to get a similarly performing fit?
As a side note: I also noticed that in the tutorial, the model is run with only 100 samples, while 500 are shown in the animation...not sure if this might be related...

(Edit: just fixed a typo...)

@devmotion
Copy link
Member

Hi! Your questions remind me of TuringLang/Turing.jl#1302 🙂 Do the suggestions in TuringLang/Turing.jl#1302 (comment) fix your issues?

@TimKo90
Copy link
Author

TimKo90 commented Mar 29, 2021

Thanks for the fast reply! The issue is basically the same as the one you mention, however, setting different seeds doesn't improve the result for me (the following is obtained with Random.seed!(12345678):

HMM-Tutorial

Do I just need to try more different seeds until one gives a good result?
Compared to the code shown in the other issue, I only modified the following due to an error:

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

to 

# Extract our m and s parameters from the chain.
m_set = Array(group(c, :m))
s_set = Array(group(c, :s))

@devmotion
Copy link
Member

Yes, one should use Array(group(...)) instead of .value.data. I assume the tutorial was written and executed with an old version of MCMCChains and never updated.

Which version of Julia and Turing did you use?

@TimKo90
Copy link
Author

TimKo90 commented Mar 29, 2021

I'm using Julia 1.5.3 and Turing v0.15.12.

@shravanngoswamii
Copy link
Member

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

3 participants