solutions - Classes
solutions - Classes
solutions - Classes
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CS331: Introduction to Artificial Intelligence<br />
Written Assignment #2<br />
Date handed out: May 11, 2012<br />
Date due: May 18, 2012 at the start of class<br />
Total: 35 points<br />
This assignment is to be done individually. Please hand in a hardcopy.<br />
1. Using the full joint probability distribution below, write out what the following<br />
probability distributions look like. Notice that the P is in boldface to emphasize that these<br />
are distributions (ie. probability tables). This means you have to write out the probability<br />
distributions for all uninstantiated random variables eg. for (a), write out<br />
P(Toothache=true) and P(Toothache=false).<br />
Toothache Cavity Catch P(Toothache, Cavity, Catch)<br />
false false false 0.576<br />
false false true 0.144<br />
false true false 0.008<br />
false true true 0.072<br />
true false false 0.064<br />
true false true 0.016<br />
true true false 0.012<br />
true true true 0.108<br />
a) P(Toothache) [2 points]<br />
P(Toothache = false) = 0.576 + 0.144 + 0.008 + 0.072 = 0.8<br />
P(Toothache = true) = 0.064 + 0.016 + 0.012 + 0.108 = 0.2<br />
b) P(Cavity) [2 points]<br />
P(Cavity = false) = 0.576 + 0.144 + 0.064 + 0.016 = 0.8<br />
P(Cavity = true) = 0.008 + 0.072 + 0.012 + 0.108 = 0.2<br />
1/4
c) P(Toothache | Cavity) [4 points]<br />
P(Toothache = false | Cavity = false)<br />
= P(Toothache = false, Cavity = false) / P(Cavity = false)<br />
= (0.576+0.144)/(0.8)<br />
= 0.9<br />
P(Toothache = true | Cavity = false)<br />
= P(Toothache = true, Cavity = false) / P(Cavity = false)<br />
= (0.064+0.016)/(0.8)<br />
= 0.1<br />
P(Toothache = false | Cavity = true)<br />
= P(Toothache = false, Cavity = true) / P(Cavity = true)<br />
= (0.008+0.072)/(0.2)<br />
= 0.4<br />
P(Toothache = true | Cavity = true)<br />
= P(Toothache = true, Cavity = true) / P(Cavity = true)<br />
= (0.012 + 0.108) / (0.2)<br />
= 0.6<br />
2. For each of the following statements, either prove it is true or show that it isn’t true<br />
through a counterexample:<br />
a) If P( a | b, c ) = P( b | a, c ), then P( a | c ) = P( b | c ) [ 3 points]<br />
True.<br />
P(<br />
a | b,<br />
c)<br />
P(<br />
b | a,<br />
c)<br />
P(<br />
a,<br />
b,<br />
c)<br />
P(<br />
a,<br />
b,<br />
c)<br />
<br />
P(<br />
b,<br />
c)<br />
P(<br />
a,<br />
c)<br />
P(<br />
a,<br />
c)<br />
P(<br />
b,<br />
c)<br />
P(<br />
a | c)<br />
P(<br />
c)<br />
P(<br />
b | c)<br />
P(<br />
c)<br />
P(<br />
a | c)<br />
P(<br />
b | c)<br />
b) If P( a | b, c ) = P( a ), then P( b | c ) = P( b ) [3 points]<br />
False. If P(a | b, c) = P(a), this says that a is independent of both b and c. It does not,<br />
however, say anything about the relationship of b and c, hence you can’t say that b and c<br />
are independent. Counterexample: a and b are the results of two independent coin flips<br />
and c is equal to b.<br />
c) If P( a | b ) = P( a ), then P( a | b, c ) = P( a | c ) [3 points]<br />
False. If P(a|b) = P(a), then b is (marginally) independent of a. This says nothing about<br />
conditional independence of a and b given c. Counterexample: a and b are independent<br />
coin flips and c is the Exclusive OR of a and b.<br />
3. Consider two medical tests, A and B, for a virus. Test A is 95% effective at<br />
recognizing the virus when it is present, but has a 10% false positive rate (indicating that<br />
2/4
the virus is present, when it is not). Test B is 90% effective at recognizing the virus, but<br />
has a 5% false positive rate. The two tests use independent methods of identifying the<br />
virus. The virus is carried by 1% of all people. Say that a person is tested for the virus<br />
using only one of the tests, and that test comes back positive for carrying the virus.<br />
Which test returning positive is more indicative of someone really carrying the virus?<br />
Justify your answer mathematically. [10 points]<br />
P(<br />
TestA | Virus Pr esent)<br />
0.95<br />
P(<br />
TestA | Virus Absent)<br />
0.1<br />
P(<br />
TestB | Virus Pr esent)<br />
0.9<br />
P(<br />
TestB | Virus Absent)<br />
0.05<br />
P(<br />
Virus Pr esent)<br />
0.01<br />
P(<br />
Virus Pr esent | TestA )<br />
P(<br />
TestA | Virus Pr esent)<br />
P(<br />
Virus Pr esent)<br />
<br />
P(<br />
TestA | Virus Pr esent)<br />
P(<br />
Virus Pr esent)<br />
P(<br />
TestA | Virus Absent)<br />
P(<br />
Virus Absent)<br />
(0.95)(0.01)<br />
0.0095 0.0095<br />
<br />
<br />
0.088<br />
(0.95)(0.01) (0.1)(0.99) 0.0095 0.099 0.1085<br />
P(<br />
Virus Pr esent | TestB )<br />
P(<br />
TestB | Virus Pr esent)<br />
P(<br />
Virus Pr esent)<br />
<br />
P(<br />
TestB | Virus Pr esent)<br />
P(<br />
Virus Pr esent)<br />
P(<br />
TestB | Virus Absent)<br />
P(<br />
Virus Absent)<br />
(0.9)(0.01)<br />
0.009<br />
<br />
<br />
<br />
(0.9)(0.01) (0.05)(0.99) 0.009 0.0495<br />
0.009<br />
0.0585<br />
0.15<br />
4. Suppose you are given a bag containing n unbiased coins. You are told that n-1 of<br />
these coins are normal, with heads on one side and tails on the other, whereas one coin is<br />
a fake, with heads on both sides.<br />
a. Suppose you reach into the bag, pick out a coin uniformly at random, flip it, and get a<br />
head. What is the (conditional) probability that the coin you chose is the fake coin? [4<br />
points]<br />
P(<br />
Coin Fake | Flip Heads)<br />
P(<br />
Flip Heads | Coin Fake)<br />
P(<br />
Coin Fake)<br />
<br />
P(<br />
Flip Heads | Coin Fake)<br />
P(<br />
Coin Fake)<br />
P(<br />
Flip Heads | Coin True)<br />
P(<br />
Coin True)<br />
1 <br />
(1)<br />
1 1 1<br />
<br />
n<br />
1 2 2<br />
<br />
<br />
<br />
n<br />
<br />
n<br />
<br />
n n<br />
* <br />
1 1 <br />
n 1<br />
1 n 1<br />
2 n 1<br />
n 1<br />
n n 1<br />
n 1<br />
(1) <br />
<br />
n 2 <br />
n n 2n<br />
2n<br />
2n<br />
2n<br />
b. Suppose you continue flipping the coin for a total of k times after picking it and see k<br />
heads. You may assume conditional independence between coin flips given the fakeness<br />
of the coin eg. P( Coin Flip 1 = Heads, Coin Flip 2 = Heads | Coin = Fake ) = P( Coin<br />
Flip1 = Heads | Coin = Fake) * P(Coin Flip 2 = Heads | Coin = Fake). Now what is the<br />
conditional probability that you picked the fake coin? [4 points]<br />
3/4
4/4<br />
1<br />
2<br />
2<br />
1<br />
2<br />
2<br />
*<br />
1<br />
2<br />
1<br />
2<br />
1<br />
2<br />
1<br />
1<br />
1<br />
1<br />
)<br />
|<br />
(<br />
1<br />
1<br />
(1)<br />
1<br />
(1)<br />
)<br />
(<br />
)<br />
|<br />
k<br />
(<br />
)<br />
(<br />
)<br />
|<br />
k<br />
(<br />
)<br />
(<br />
)<br />
|<br />
(<br />
)<br />
|<br />
(<br />
1<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
n<br />
True<br />
Coin<br />
Heads<br />
Flip<br />
P<br />
n<br />
n<br />
n<br />
n<br />
True<br />
Coin<br />
P<br />
True<br />
Coin<br />
Heads<br />
Flip<br />
P<br />
Fake<br />
Coin<br />
P<br />
Fake<br />
Coin<br />
Heads<br />
Flip<br />
P<br />
Fake<br />
Coin<br />
P<br />
Fake<br />
Coin<br />
Heads<br />
k<br />
Flip<br />
P<br />
Heads<br />
k<br />
Flip<br />
Fake<br />
Coin<br />
P<br />
k<br />
k<br />
k<br />
k<br />
k<br />
k<br />
k<br />
k