hmmdecode
statistics: pstates = hmmdecode (sequence, transprob, outprob)
statistics: [pstates, logpseq] = hmmdecode (…)
statistics: [pstates, logpseq, fs, bs, s] = hmmdecode (…)
statistics: […] = hmmdecode (…, "symbols", symbols)
Posterior state probabilities of a hidden Markov model.
Calculate the posterior state probabilities of the sequence sequence
from a hidden Markov model. The posterior state probabilities are the
conditional probabilities of being in each state given the whole observed
sequence. The model assumes that the generation starts in state 1
at step 0 but does not include step 0 in the sequence.
1 to columns (outprob).
transprob(i, j) is the probability of a transition to state
j given state i.
outprob(i, j) is the probability of generating output j
given state i.
pstates(i, j) is the conditional probability that the model is in
state i when it generates the j-th output of sequence,
given that sequence is emitted.
If "symbols" is specified, then sequence is expected to be a
sequence of the elements of symbols instead of integers ranging from
1 to columns (outprob). symbols can be a cell array.
transprob = [0.8, 0.2; 0.4, 0.6];
outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1];
[sequence, states] = hmmgenerate (25, transprob, outprob);
pstates = hmmdecode (sequence, transprob, outprob);
symbols = {"A", "B", "C"};
[sequence, states] = hmmgenerate (25, transprob, outprob, ...
"symbols", symbols);
pstates = hmmdecode (sequence, transprob, outprob, "symbols", symbols);
|
Source Code: hmmdecode
Posterior probability of each state at every step of an observed sequence.
transprob = [0.95, 0.05; 0.10, 0.90]; outprob = [1/6, 1/6, 1/6, 1/6, 1/6, 1/6; 1/10, 1/10, 1/10, 1/10, 1/10, 1/2]; sequence = hmmgenerate (10, transprob, outprob); [pstates, logpseq] = hmmdecode (sequence, transprob, outprob)
pstates = 0.987744 0.975098 0.957594 0.929051 0.879391 0.791076 0.632919 0.349069 0.258330 0.249591 0.012256 0.024902 0.042406 0.070949 0.120609 0.208924 0.367081 0.650931 0.741670 0.750409 logpseq = -16.850