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 = Columns 1 through 8: 9.9008e-01 9.8161e-01 9.7158e-01 9.5646e-01 9.3091e-01 8.8591e-01 8.0557e-01 6.6150e-01 9.9188e-03 1.8395e-02 2.8422e-02 4.3540e-02 6.9089e-02 1.1409e-01 1.9443e-01 3.3850e-01 Columns 9 and 10: 6.3524e-01 5.6165e-01 3.6476e-01 4.3835e-01 logpseq = -17.750