Starting from:

$30

Homework 10 Viterbi algorithm

Homework 10
Again, you are required to attach to your report the code that you implemented for
each problem. If you use some code from the web, also mention in your report where
you obtained the code from.
1. Download the dataset hmm_pb1.csv from Canvas. It represents a sequence of
dice rolls x from the Dishonest casino model discussed in class. The model parameters
are exactly those presented in class. The states of Y are 1=’Fair’ and 2=’Loaded’.
a) Implement the Viterbi algorithm and find the most likely sequence y that generated the observed x. Use the log probabilities, as shown in the HMM slides from
Canvas. Report the obtained sequence y of 1’s and 2’s for verification. (2 points)
b) Implement the forward and backward algorithms and run them on the observed
x. You should memorize a common factor ut for the α
k
t
to avoid floating point
underflow, since α
k
t quickly become very small. The same holds for β
k
t
. Report
α
1
125/α2
125 and β
1
125/β2
125, where the counting starts from t = 1. (3 points)
2. Download the dataset hmm_pb2.csv from Canvas. It represents a sequence of
10000 dice rolls x from the Dishonest casino model but with other values for the a and
b parameters than those from class. Having so many observations, you are going to
learn the model parameters.
Implement and run the Baum-Welch algorithm using the forward and backward
algorithms that you already implemented for Pb 1. You can initialize the π, a, b with
your guess, or with some random probabilities (make sure that π sums to 1 and that
aij , bi
k
sum to 1 for each i). The algorithm converges quite slowly, so you might need
to run it for up 1000 iterations or more for the parameters to converge.
Report the values of π, a, b that you have obtained. (4 points)
1

More products