Starting from:

$30

CECS 451 Assignment 10

CECS 451
Assignment 10
Total: 40 Points
General Instruction
• Submit your work in the Dropbox folder via BeachBoard. (Not email or in class)
• Use Python 3, any other programming language is not acceptable.
• You can import modules in the Python Standard Library (please check the full list
here). If you want to use any other library, please consult with the instructor or TA.
• Your submission may be evaluated automatically using a script file, so if you would
not follow the output format, you may receive zero point even though your program
outputs correct answers.
• Submit the separate files as they are. (no zip file)
1. (40 points) Implement a Python program to perform filtering in the hidden Markov
model (HMM).
(a) Assume that hidden state variable and evidence variable are binary variables.
(b) The program should compute P~ (Xt
|~e1:t) when ~e1:t
is given.
(c) The input to the program is a text file which includes multiple lines.
(d) Each line contains independent variables a, b, c, d, f, e1, e2, · · · , et
in Figure 1 in that
order. For example,
0.5,0.7,0.3,0.9,0.2,t,t
means a = 0.5, b = 0.7, c = 0.3, d = 0.9, f = 0.2, e1 = t, e2 = t.
Figure 1: HMM of binary variables.
(e) The program outputs the probability P~ (Xt
|~e1:t). For example,
0.5,0.7,0.3,0.9,0.2,t,t--><0.8834,0.1166>
0.5,0.7,0.3,0.9,0.2,t,t,f--><0.1907,0.8093>
Do not include white spaces in a line and fix the precision using "{:.4f}".format()
CECS 451 Assignment 10 - Page 2 of 2
(f) The program should be able to executed on Python 3 interpreter. I will test your
program with this command:
> python hmm.py cpt.txt
Please note that the names of the program and the input file would be modified,
therefore, your program should use sys.argv instead of “hard coding”.
(g) About grading
• The output format should be same as the output example.
• No credit will be given if the program is not executable.
• The actual input file includes more lines.

More products