I am working on channel modeling for cognitive radio using HMM. I've written a MATLAB program for forward, backward and Baum-Welch algorithm for multiple sequences. After given some random input and running the program for 1000 to 4000 iterations I'm getting some results. But I'm not getting how to interpret my results.

Will be glad if anyone can talk about inputting matrix/log-likelihood/transition matrix/emission matrix.

**Contents**hide

#### Best Answer

For MatLab, I would recommend using the HMM toolbox. It allows you to do pretty much all you would need from an HMM model.

If you feel strongly about using your own code, before running on a real dataset, you should probably validate your Baum Welch implementation by checking whether it actually returns sensible results. You can use an experimental setup similar to below. Please note that I am using the HMM toolbox functions, but it is more the order of steps that I am trying to draw your attention to.

`M = 3; % number of observation levels N = 2; % number of states % A - "true" parameters (of your validation model) prior0 = normalise(rand(N ,1)); transmat0 = mk_stochastic(rand(N ,N )); obsmat0 = mk_stochastic(rand(N ,M)); % B- using the real parameters in step A, simulate a sequence of states and corresponding observations n_seq = 5; % you want to generate 5 multiple sequences seq_len= 100; % you want each sequence to be of length 100 obs_seq, state_seq = dhmm_sample(prior0, transmat0, obsmat0, n_seq, seq_len); % C- like you say you do, generate some initial guesses of the real parameters (from step A) that you want to learn prior1 = normalise(rand(N ,1)); transmat1 = mk_stochastic(rand(N ,N )); obsmat1 = mk_stochastic(rand(N ,M)); % D - train based on your guesstimates using EM (Baum-Welch) [LL, prior2, transmat2, obsmat2] = dhmm_em(data, prior1, transmat1, obsmat1, 'max_iter', 5); % E- Finally, compare whether your trained values in step D are actually similar to the real values (that generated your data) from Step A. % The simplest way to do that is to print them side by side or look at the absolute differences... obsmat0 obsmat2 transmat0 transmat2 `

The interpretations of the transition matrix, observation (emission) matrix and loglikelihoods is a broad topic. I assume you already have a fair understanding since you could implement your own Baum-Welch. The easiest and best read on HMMs (in my opinion) is Rabiner's paper. I would recommend having a look at this if you haven't yet.

### Similar Posts:

- Solved – Problem in understanding hidden Markov model EM training and log-lik computation result
- Solved – Baum Welch training of HMM
- Solved – Example of manual implementation of baum-welch algorithm in R
- Solved – Difference between MLE and Baum Welch on HMM fitting
- Solved – Confused by MATLAB’s implementation of ridge