Estimate the matrix of transition probabilities and the matrix of output
probabilities of a given sequence of outputs and states generated by a
hidden Markov model. The model assumes that the generation starts in
state 1
at step 0
but does not include step 0
in the
generated states and sequence.
1
to the number of outputs of the
hidden Markov model.
1
to the number
of states of the hidden Markov model.
transprobest(i, j)
is the estimated
probability of a transition to state j
given state i
.
outprobest(i, j)
is the estimated probability of generating
output j
given state i
.
If 'symbols'
is specified, then sequence is expected to be a
sequence of the elements of symbols instead of integers.
symbols can be a cell array.
If 'statenames'
is specified, then states is expected to be
a sequence of the elements of statenames instead of integers.
statenames can be a cell array.
If 'pseudotransitions'
is specified then the integer matrix
pseudotransitions is used as an initial number of counted
transitions. pseudotransitions(i, j)
is the initial number of
counted transitions from state i
to state j
.
transprobest will have the same size as pseudotransitions.
Use this if you have transitions that are very unlikely to occur.
If 'pseudoemissions'
is specified then the integer matrix
pseudoemissions is used as an initial number of counted outputs.
pseudoemissions(i, j)
is the initial number of counted outputs
j
given state i
. If 'pseudoemissions'
is also
specified then the number of rows of pseudoemissions must be the
same as the number of rows of pseudotransitions. outprobest
will have the same size as pseudoemissions. Use this if you have
outputs or states that are very unlikely to occur.
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); [transprobest, outprobest] = hmmestimate (sequence, states)
symbols = {'A', 'B', 'C'}; statenames = {'One', 'Two'}; [sequence, states] = hmmgenerate (25, transprob, outprob, 'symbols', symbols, 'statenames', statenames); [transprobest, outprobest] = hmmestimate (sequence, states, 'symbols', symbols, 'statenames', statenames)
pseudotransitions = [8, 2; 4, 6]; pseudoemissions = [2, 4, 4; 7, 2, 1]; [sequence, states] = hmmgenerate (25, transprob, outprob); [transprobest, outprobest] = hmmestimate (sequence, states, 'pseudotransitions', pseudotransitions, 'pseudoemissions', pseudoemissions)
Package: statistics