For each of the samples you generated in the previous section, use
the estimated parameters to perform
"decoding" in two ways: (a) find the MAP assignment using
the Viterbi algorithm, (b) for each time step separately, find the
state that maximizes the posterior probability. For
each of these decoding methods calculate the "bit error rate"
(P(x(t) ~= x*(t)) that is the probability over all instances and
time slices that the predicted state by MAP does not match the true
state. Compare this to the "word error rate" (P(x ~= x*)) or the probability
that any time-slice in an instance is prediction with error.
Which methods performs better under each error measure?
What happens when you increase the length of the samples?
Note:
Although some number may appear small (in the order of 10e-10) all examples
have been checked and there should be no problem with scaling. That said, you should
do as many calculations using log to make your code scalable for other problems.
Important:
Don't forget to discuss all of the experiments in the evaluation file. You are expected
to show insight and understanding of what is going on and not merely report
results.
Part 2: Code
For this section you will use:
- Start probabilities: Q (1xN)
- Transition matrix: A (NxN)
- Emmision matrix: B (NxK). This means there are N states
with K emission probabilities per state.
- Instance vector: Y (1xT) with values for the observable for each time slice t (columns).
Your should implement the following:
- L = Likelihood(A,B,Q,Y)
This function should return the likelihood of
the observation in Y using the HMM model
defined by A,B and Q.
- [P,X] = MAP(A,B,Q,Y)
This function should return the most probable
a-posteriori assignment given the instance of
observables Y as a vector X with the
MAP state assignment (numbered from 1 to N)
for each time-slice.
It should also return the probability of the MAP assignment
in P.
- [NewA,NewB,NewQ] = TrainHMM(A,B,Q,I)
This function should start with the parameters in
A, B and Q and return two new matrices
after EM training based on I (a matrices of vector instances).
Also, submit any other code/functions you used for this exercise.
Submission
You should tar only your .m file along with the EVALUATION file and figure files
(in EPS or PS format) and submit it through the
submission
link in the course home page. Do not forget to register to the course first through
the register link.
DO NOT gzip your tar file.
Please make sure the .m file names match the method names and
are EXACTLY as specified (this part will be checked automatically).
Also, make sure your login appears
at the top of each file in a matlab comment