[SOLVED] CS Spring 22 AI Homework 7: solutions

$25

File Name: CS_Spring_22_AI_Homework_7:_solutions.zip
File Size: 348.54 KB

5/5 - (1 vote)

Spring 22 AI Homework 7: solutions
You have a box with 3 coins.
1 of the coins is weighted so that it comes up heads with probability 0.1. (Category 1)
1 is weighted so that it comes up heads with probability 0.4. (Category 2)

Copyright By Assignmentchef assignmentchef

1 is weighted so that it comes up heads with probability 0.8. (Category 3)
1. [1 pts] What is the probability of heads, if you pick a coin at random and flip it?
2. [2 pts] You randomly select a coin and flip it: it comes up tails. What is the probability
that it comes up tails again when you flip the same coin again?
A friend offers you a game: A coin will be randomly selected and flipped.
After you both observe the outcome, you may choose to keep the coin, or set aside the first coin and switch to a new random coin from the remaining in the box.
Once the choice is made, your friend now gets to bet on heads or tails and the updated coin is flipped. If correct, your friend wins $6, otherwise you win $7
3. [2 pts] Draw the decision tree for this game, you should use conditional probabilities without solving for actual values. You may submit a photograph of a hand-drawn diagram for this question only.
4. [5 pts] Should you play this game? Show your work and explain your answer by solving the tree for expected values.

1. P(H)=P(H,C1)+P(H,C2)+P(H,C3) # joint distribution
= P(C1)*P(H|C1) + P(C2)*P(H|C2) + P(C3)*P(H|C3) # conjunctive rule = .1 * 1/3 + .4 * 1/3 + .8 * 1/3
2. P(T|T) = P(T,C1|T)+P(T,C2|T)+P(T,C3|T) # joint distribution
= P(T|C1,T)*P(C1|T) + P(T|C2,T)*P(C2|T) + P(T|C3,T)*P(C3|T) #conjunctive rule = P(T|C1)*P(C1|T) + P(T|C2)*P(C2|T) + P(T|C3)*P(C3|T) # independence
Use Bayes Law to compute cat conditioned on tails P(C1|T) = P(T|C1)* P(C1)/P(T) = .9* 1/3 / .567 = .529 P(C2|T) = P(T|C2)* P(C2)/P(T) = .6* 1/3 / .567 = .353 P(C3|T) = P(T|C3)* P(C3)/P(T) = .2* 1/3 / .567 = .118 Note: P(T) = 1 P(H) from part 1
Plug back in above
P(T|T) = .529*.9 + .353*.6 + .118 * .2 = .712
3. To be attached
P(C1|H) = P(H|C1)* P(C1)/P(H) = .1* 1/3 / .433 = .077 P(C2|H) = P(H|C2)* P(C2)/P(H) = .4* 1/3 / .433 = .308 P(C3|H) = P(H|C3)* P(C3)/P(H) = .8* 1/3 / .433 = .615 P(H|H) = .1*.077 + .4*.308+.8*.615 = .623
Root = max(0, play) = 0
Play = playH * P(H) + playT *P(T) = .433 * .422 + .567 * -1.59 = $-0.72 playH = max(playH_stay, playH_switch) = .422
playT = max(playT_stay, playT_switch) = -1.59
# could do another decision node for opp with min of bet-H, bet-T
# or as suggested in class, inline that decision in the tree (they always pick the higher probability node)
# this turns out to be heads after heads and tails after tails if stay

playH_stay = 7 * .377 6 * .623 = -1.099 playT_stay = 7 * .288 6 * .712 = -2.256
For switch, use complements for P(cat|flip) normalized by 2
P(T|T,Switch) =
P(T|C1)*(1-P(C1|T))/2 + P(T|C2)*(1-P(C2|T))/2 + P(T|C3)*(1-P(C3|T))/2 = .471*.9/2 + .647*.6/2 + .882 * .2/2 = .494
P(H|H,Switch) =
P(H|C1)*(1-P(C1|H)) + P(H|C2)*(1-P(C2|H)) + P(H|C3)*(1-P(C3|H)) = .1*.923/2 + .4*.692/2+.8*.385/2 = .339
playT_switch = 7 * .494 6 * .506 = .422 playH_switch = 7 * .339 6 * .661 = -1.593
Optimal Policy { H -> stay, T -> switch } Do no play as E(play) = -$0.72

CS: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS Spring 22 AI Homework 7: solutions
$25