matlabhidden-markov-modelsviterbi

Problems in HMM toolbox


Recently I'm doing some training of HMM, I used the HMM toolbox. But I have some problems and couldn't resolve them.

  1. I train my hmm as shown below. There's no problems here.

    [LL, prior1, transmatrix1, observematrix1] = dhmm_em(data, prior0, transmatrix0, observematrix0);
    
  2. I use the Viterbi algorithm to find the most-probable path through the HMM state trellis.

    function path = viterbi_path(prior, transmat, obslik);
    

    Now there's a problem. I don't know what the "obslik" means. Is it the observematrix1?

  3. I want to get the probability of a sequence, but I don't know whether I should use the "fwdback" function or not. If I should, what the "obslik" means then?

    function [alpha, beta, gamma, loglik, xi_summed, gamma2] = fwdback(init_state_distrib, transmat, obslik, varargin);
    

    Thanks!!!


Solution

  • I didn't understand the comments. Now I understand it.

    The "obslik" here isn't equal to the observematrix1. Before using Viterbi_path function, we should compute the obslik:

        obslik = multinomial_prob(data(m,:), observematrix1); 
    
    the data matrix is the observematrix0, observe-matrix before training. 
    

    Am I right?