The assignment should be submitted via Blackboard.
Task
1
50 points
The
task in this part is to implement a system that:
Can determine the posterior probability of different
hypotheses, given priors for these hypotheses, and given a sequence of
observations.
Can determine the probability that the next observation
will be of a specific type, priors for different hypotheses, and given
a sequence of observations.
As
in the slides that we saw in class, there are five types of bags of
candies. Each bag has an infinite amount of candies. We have one of
those bags, and we are picking candies out of it. We don't know what
type of bag we have, so we want to figure out the probability of each
type based on the candies that we have picked.
The
five possible hypotheses for our bag are:
h1(prior:
10%): This type of bag contains 100% cherry candies.
h2(prior:
20%): This type of bag contains 75% cherry candies and 25% lime candies.
h3(prior:
40%): This type of bag contains 50% cherry candies and 50% lime candies.
h4(prior:
20%): This type of bag contains 25% cherry candies and 75% lime candies.
h5(prior:
10%): This type of bag contains 100% lime candies.
Command
Line arguments:
The
program takes a single command line argument, which is a string, for
example CLLCCCLLL. This string represents a sequence of observations,
i.e., a sequence of candies that we have already picked. Each character
is C if we picked a cherry candy, and L if we picked a lime candy.
Assuming that characters in the string are numbered starting with 1,
the i-th character of the string corresponds to the i-th observation.
The program should be invoked from the commandline as follows:
compute_a_posteriori observations
For
example:
compute_a_posteriori CLLCCLLLCCL
We
also allow the case of not having a command line argument at all, this
represents the case where we have made no observations yet.
Output:
Your
program should create a text file called "result.txt", that is
formatted exactly as shown below. ??? is used where your program should
print values that depend on its command line argument. Five decimal
points should appear for any floating point number.
Observation sequence Q: ??? Length of Q: ???
After Observation ??? = ???: (This and all remaining lines are repeated for every observation)
Probability that the next candy we pick will be C, given Q: ??? Probability that the next candy we pick will be L, given Q: ???
Task
2
30 points
You
are a meteorologist that places temperature sensors all of the world,
and you set them up so that they automatically e-mail you, each day,
the high temperature for that day. Unfortunately, you have forgotten
whether you placed a certain sensor S in Maine or in the Sahara desert
(but you are sure you placed it in one of those two places) . The
probability that you placed sensor S in Maine is 5%. The probability of
getting a daily high temperature of 80 degrees or more is 20% in Maine
and 90% in Sahara. Assume that probability of a daily high for any day
is conditionally independent of the daily high for the previous day,
given the location of the sensor.
Part
a:If
the first e-mail you got from sensor S indicates a daily high under 80
degrees, what is the probability that the sensor is placed in Maine?
Part
b:If
the first e-mail you got from sensor S indicates a daily high under 80
degrees, what is the probability that the second e-mail also indicates
a daily high under 80 degrees?
Part
c:What
is the probability that the first three e-mails all indicate daily
highs under 80 degrees?
Task 3
20
points.
In
a certain probability problem, we have 11 variables: A, B1,
B2,
..., B10.
Variable A has 5 values.
Each of variables B1, ..., B10have 7
possible values. Each Biis
conditionally indepedent of all other 9 Bjvariables
(with j != i) given A.
Based
on these facts:
Part
a:How
many numbers do you need to store in the joint distribution table of
these 11 variables?
Part
b:What
is the most space-efficient way (in terms of how many numbers you need
to store) representation for the joint probability distribution of
these 11 variables? How many numbers do you need to store in your
solution? Your answer should work with any variables satisfying the
assumptions stated above.
Other Instructions
Code for Task 1 needs to run on Omega. Also include a readme.txt file that has:
Name and UTA ID of the student.
What programming language is used.
How the code is structured.
The answers for Task 2 & Task 3 can be typed as a document or handwritten and
scanned.
Accepted document formats are (.pdf, .doc or
.docx). Please do not submit
.txt files. If you are using OpenOffice or LibreOffice, make sure to
save as .pdf or .doc
If
you are scanning handwritten documents make sure to scan it at a
minimum of 600dpi and save as a .pdf or .png file.
Zip all the files together into assignment8_<netid>.zip. Submit on Blackboard.