. Introduction
The second coursework assignment for EEEM030 Speech & audio processing & recognition is designed
to give you an opportunity to practice the algorithms that are the key to training, which is an essential
process for any machine learning system. In doing so, you will also get to implement the kind of
recursive likelihood algorithm that can be used for recognition, and to observe the effects of training.
You should submit a written report in PDF format (900-1200 words plus an appendix) to the EEEM030
assignment folder in SurreyLearn by the deadline 4pm Tuesday 6th December 2022 (week 11). This
contains a brief description of your method for approaching the task, with references, details of the
implementation (including calculations), an analysis of the results (containing obtained parameter
values, histograms, a summary of the outcomes) and bibliography. The main body of the report includes
the likelihood values obtained as the result of intermediate calculations for the first observation
sequence only. The appendix has the intermediate results for the other observation sequences together
with program code that you implement. You may use publicly available source code, where it is relevant,
but any code you use (or adapt) that was written by someone else must be cited with due a reference
(to avoid accusations of plagiarism). You will need to ensure you understand what it does and how it
works in order to complete the assignment successfully, as there can be significant variations (e.g.,
alternative normalisation or definition of null states).
As with all formally assessed coursework, you may discuss the concepts associated with the coursework
with your peers but not the details of any solution that you implement. You cannot share code amongst
your classmates. In line with University policy, you may use other sources, such as textbooks, lecture
notes, articles, online tutorials and code libraries, but failure to cite them correctly may be viewed as
plagiarism and trigger an academic misconduct investigation. So please reference all your sources
carefully and thoroughly!
2. Model prototype and observation data
You are to compute a series of likelihood calculations to perform one iteration of training on the
parameters of a discrete hidden Markov model (HMM) with N=3 emitting states. Initial values of the
state-transition probabilities A and the output probabilities B are given in Tables 1 and 2 below to two
decimal places.
0 0.41 0.23 0.36 0
0 0.77 0.07 0.06 0.10
0 0.14 0.71 0.04 0.11
0 0.06 0.11 0.74 0.09
0 0 0 0 0
Table 1: State-transition probability matrix, A = {pi, aij, hi}, including entry and exit transitions.
State i Obs.
type
1 2 3 4 5 6 7 8 9 10
1 0.30 0.21 0.24 0.10 0.06 0.04 0.01 0.03 0.00 0.01
2 0.00 0.00 0.03 0.04 0.05 0.08 0.14 0.20 0.25 0.21
3 0.00 0.05 0.05 0.23 0.32 0.24 0.03 0.04 0.02 0.02
Table 2: Output probability matrix, B, with values for each state i and observation type k.
? 2022, University of Surrey 2
For your calculations with this prototype model, there are 5 observation sequences:
O 1 = { 5, 4, 2, 1, 3 } with a duration of 5 frames
O2 = { 6, 4, 5, 7 } with a duration of 4 frames
O 3 = { 7, 9, 6, 8, 7, 3, 6, 3 } with a duration of 8 frames
O 4 = { 5, 7, 5, 5, 10, 7, 6 } with a duration of 7 frames
O 5 = { 3, 2, 2, 1, 2, 1, 8, 9, 7, 3 } with a duration of 10 frames
3. Na?ve Bayes classifier and Viterbi training
For the sake of comparisons against the results that you will obtain, this section provides classification
results of a simple na?ve Bayes classifier and training results based on Viterbi decoding. The results are
obtained with the same set of observation sequences and prototype model parameters. Table 3 gives
the observation classification results. Table 4 shows the Viterbi path alignments, Table 5 gives the reestimated state-transition probability matrix, AVit, and Table 6 shows the Viterbi re-estimated output
probability matrix, BVit.
O1 3 3 1 1 1
O2 3 3 3 2
O3 2 2 3 2 2 1 3 1
O4 3 2 3 3 2 2 3
O5 1 1 1 1 1 1 2 2 2 1
Table 3: Na?ve Bayes classification results for each of the observation sequences.
O1 1 1 1 1 1
O2 3 3 3 3
O3 2 2 2 2 2 1 1 1
O4 3 3 3 3 2 2 2
O5 1 1 1 1 1 1 2 2 2 1
Table 4: Viterbi path alignments for each of the observation sequences.
0 0.40 0.20 0.40 0
0 0.73 0.07 0.00 0.20
0 0.18 0.73 0.00 0.09
0 0.00 0.13 0.75 0.12
0 0 0 0 0
Table 5: State-transition probability matrix, AVit, re-estimated by Viterbi training.
State i Obs.type 1 2 3 4 5 6 7 8 9 10
1 0.20 0.27 0.33 0.07 0.07 0.07 0.00 0.00 0.00 0.00
2 0.00 0.00 0.00 0.00 0.00 0.18 0.45 0.36 0.00 0.00
3 0.00 0.00 0.00 0.13 0.50 0.12 0.25 0.00 0.00 0.00
Table 6: Output probability matrix, BVit, re-estimated by Viterbi training.
? 2022, University of Surrey 3
4. Tasks
This assignment performs calculations to train the HMM according to Expectation-Maximization using
the Baum-Welch equations. Calculations use the given observation sequences to get likelihoods for all
N=3 emitting states and all T time frames. These are used to update the model.
The steps are as follows:
1. Draw the HMM’s state topology, and a trellis diagram for the first observation sequence O1.
2. Using the forward procedure, compute the forward likelihoods at(i) for i=1..N and t=1..T and
overall likelihood of the observations P(O|l) for O1.
3. Compute backward likelihoods bt(i) for i=1..N and t=1..T for O1, and check P(O|l).
4. Using results from steps 2 and 3, compute the occupation likelihoods gt(i) for i=1..N and t=1..T
for O1; compare the results to those for a na?ve Bayes classifier in Table 3 and the state
alignments with Viterbi in Table 4.
5. Compute transition likelihoods xt(i,j) for i,j=1..N+2 and t={1..T, T+1} for O1, so that it includes
consideration of the entry and exit transitions.
6. Accumulate the transition and occupation likelihood contributions from just O1.
7. Repeat all the calculations in steps 2 to 6 for all 5 observation sequences, estimate the new
state-transition probabilities, ABW, according to the Baum-Welch equations.
8. Similarly, compute the new output probabilities, BBW, according to Baum-Welch.
9. Plot the initial and re-estimated output probabilities, B and BBW.
10. Compare the results to those obtained by Viterbi training with the same HMM prototype and
observations sequences, which are given in Tables 5 and 6.
You may use any appropriate software package to implement these calculations, such as Python or
Matlab. The equations should be coded or calculated from scratch for this assignment. If you re-use an
existing HMM implementation, such as a toolbox, toolkit, library or software downloaded from an online
repository, you must highlight the lines of code that have been contributed by others and provide the
appropriate citation to the source in your references.
5. Assessment criteria
Your assignment mark will be given based on the accuracy of your presented results and the quality of
your report, including method, plots, analysis and commentary. Specifically, marks will be given based
on the correctness of the following:
10% Diagrams of state topology and trellis for the first observation sequence O1
15% Forward likelihoods and overall likelihood of the O1 observations
10% Backward likelihoods of the O1 observations
10% Occupation likelihoods of the O1 observations and comparison comments
15% Transition likelihoods of the O1 observations
10% Re-estimated state-transition probabilities using all observation sequences
15% Re-estimated output probabilities with all sequences, and accompanying plots
15% Comments on the comparison of Viterbi and Baum-Welch training results