hmmestimate
statistics: [transprobest, outprobest] = hmmestimate (sequence, states)
statistics: […] = hmmestimate (…, "statenames", statenames)
statistics: […] = hmmestimate (…, "symbols", symbols)
statistics: […] = hmmestimate (…, "pseudotransitions", pseudotransitions)
statistics: […] = hmmestimate (…, "pseudoemissions", pseudoemissions)
Estimation of a hidden Markov model for a given sequence.
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 transition probabilities are estimated by counting the transitions that actually occur between consecutive states in states; the output probabilities are estimated from the outputs emitted by each state.
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)
|
Source Code: hmmestimate
Recover the transition and output matrices of a model from a long sequence together with its known sequence of hidden states.
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 (1000, transprob, outprob); [transest, outest] = hmmestimate (sequence, states)
transest = 0.8071 0.1929 0.4094 0.5906 outest = 0.201471 0.408824 0.389706 0.746875 0.184375 0.068750