Hi I need to understand everything about hmm for my project. in the stan manual 2.17 page 174
int<lower=1,upper=K> z[T]; // categories
for (k in 1:K)
theta[k] ~ dirichlet(alpha);
for (k in 1:K)
phi[k] ~ dirichlet(beta);
for (t in 1:T)
w[t] ~ categorical(phi[z[t]]);
for (t in 2:T)
z[t] ~ categorical(theta[z[t - 1]]);
The loop goes thru time slots t, which I can see, but what about the N users (or whatever data generators the use case involves)? You can’t solve the hmm using a single line of data, can you? even if there are T data points in the line. Is this meant to be a case with one infinitely long time series data?
That is a special case where you know the values of the hidden states, which I don’t think is a very common situation.
but what about the N users (or whatever data generators the
In that example, there are K different hidden states the model can be in and V different observables it might produce. The goal of the model is to use knowledge of the hidden states + the observables to figure out the transition probabilities (K length K simplexes) and emission probabilities (K length V simplexes).
You can’t solve the hmm using a single line of data, can you?
This example is a little simple. If you end up doing HMMs you’ll probably end up doing some forward algorithm stuff like on page 176/177. There was a talk at Stancon by @LuisDamiano and @weylandt on HMMs. I don’t think the Stancon stuff is all up online in any one spot yet, but those guys can probly point you to the Github or wherever it lives.
Is this meant to be a case with one infinitely long time series data?
I don’t think there are any constraints on time here.
The language is improper in my opinion. If you already know the states at any one point in time, then there is nothing hidden about it. It should be called a markov chain, without the h. Based on your answer, it is not what I am looking for.
It’s just an example. Maybe not the most practical, but just trying to write in code what all the words are saying.
If you want HMMs, the “Semisupervised Estimation” section of the manual is probably more useful. I Google’d for @LuisDamiano’s presentation and it’s got a lot more details: https://github.com/luisdamiano/stancon18, https://cdn.rawgit.com/luisdamiano/stancon18/11d75524/main.html
We are using “HMM” in the standard way. The sequence of latent/hidden states z is always Markovian, whether observed or not. But even if observed, the outputs y conditioned on z aren’t typically Markovian.
As @bbbales2 points out, you can observe none (unsupervised), some (semi-supervised), or all (supervised) of the states.