3
0.15
0.05
0.03
0.27
0.1
0.1
0.1
0.2
In this case, 0.15 is the probability that all values are false, 0.05 is the probability that the value of the last variable is true and all other values are false, and 0.2 is the probability that all values are true.
The second command-line argument of your program must be a string specifying the query to perform. With N variables, the string must contain N characters. The first character must correspond to the first variable, and so on. The characters must be either "Q", "H", "T", or "F". A "Q" is used to indicate the query variable and an "H" is used for each hidden variable. "T" and "F" are used to specify the truth values of the evidence variables. Assume the above joint distribution is stored in a file called "jd.prob". Running your program with the command-line
java ProbInf jd.prob TQH
means that the evidence consists of the value true for the first variable, the query is the second variable, and the state of the third variable is hidden. You can assume that there is only one query variable.
Your program must output the conditional probability for the value true of the query variable given the values of the evidence variables. For the above example it must output 0.6 because the conditional probability is given by (0.1 + 0.2) / (0.1 + 0.1 + 0.1 + 0.2).
java CheckIndependence jd.prob 1 3 2
must check whether the first and the last variable in the above problem are conditionally independent given the second one. The command-line
java CheckIndependence jd.prob 1 2
must check whether the first two variables are completely independent.
If the variables are (conditionally) independent, your program must output "true" to standard-out, and "false" otherwise.
Value: 11% of the final grade
Due date: Wednesday, 7 May, midday
No extensions will be granted except for sound, documented, medical reasons.