I am studying hidden Markov models, but I have some doubts about the inference phase. If I have any observations and I want to know the three parameters that characterize the model, can I use one of the MCMC techniques directly on the observations or do I have to first use the Viterbi algorithm or the forward-backward algorithm on the observations and then use one of MCMC techniques to know the three parameters?

**Contents**hide

#### Best Answer

The question is not clear to me. But if you want to sample from HMM, forward sampling can be used. Assuming $X$ are hidden states and $Y$ is observations, and we want to sample $N$ observations.

The steps are:

- Sample from $X_1$
- Based on the sample we got of $X_1$ and $P(Y_1|X_1)$, sample $Y_1$
- Based on the sample we got of $X_1$ and $P(Y_2|X_1)$, sample $X_2$
- $cdots$