Question 2: (5 PTS) (Bayes Theorem)
Question 2: (5 PTS) (Bayes Theorem)
You are trying to predict whether a customer will make a purchase or not. You have a dataset that shows that 80% of
customers who make a purchase also viewed a product video, and 20% of customers who did not make a purchase
also viewed a product video. Given that a customer viewed a product video, what is the probability that they will make
a purchase?
(Note: The probaility of making a purchased and not making a purchased is assumed to be 1, same is for the probability of viewed
and not viewed.)
In this question, we are trying to find the probability that a customer will make a purchase given that they
viewed a product video.
This is represented by P(Purchase|Viewed).
To calculate this probability, we use Bayes' theorem, which states that P(A|B) = P(B|A) * P(A) / P(B).
In this case, A is the event of making a purchase and B is the event of viewing a product video.
P(Viewed|Purchase) = 0.8, which is the probability that a customer who makes a purchase also viewed a
product video.
P(Viewed|¬Purchase) = 0.2, which is the probability that a customer who did not make a purchase also
viewed a product video.
We are asked to find P(Purchase|Viewed) using Bayes' theorem.
P(Purchase) and P(Viewed) are not given in the question, so we have to assume that P(Purchase) +
P(¬Purchase) = 1 and P(Viewed) + P(¬Viewed) = 1,
where P(¬Purchase) is the probability of not making a purchase and P(¬Viewed) is the probability of not
viewing a product video.
P(¬Purchase) = 1 - P(Purchase)
So, the probability that a customer will make a purchase given that they viewed a product video is 0.8
Question 4: (15 pts)
The appearance of a strange noise (N) in a car can be caused either by a loose part (L) or a failing engine (E). The
latter event also causes poor fuel efficiency (F). The Bayesian network and corresponding conditional probability
tables for this situation are shown below.
𝑷(𝑳) 𝑷(𝑬)
+𝑙 0.4
L E +𝑒 0.1
−𝑙 0.6 −𝑒 0.9
𝑷(𝑵|𝑳,𝑬)
+𝑙 +𝑒 +𝑛 1.0 N F 𝑷(𝑭|𝑬)
+𝑙 +𝑒 −𝑛 0.0 +𝑒 +𝑓 1.0
+𝑙 −𝑒 +𝑛 0.8 +𝑒 −𝑓 0.0
+𝑙 −𝑒 −𝑛 0.2 −𝑒 +𝑓 0.1
−𝑙 +𝑒 +𝑛 0.3 −𝑒 −𝑓 0.9
−𝑙 +𝑒 −𝑛 0.7
−𝑙 −𝑒 +𝑛 0.1
−𝑙 −𝑒 −𝑛 0.9
(0.4)(0.1)(1.0)(1.0) 0.04
= = ≈ 0.5814
(0.4)(0.1)(1.0)(1.0) + (0.4)(0.9)(0.8)(0.1) 0.04 + 0.0288
e) If there is an engine failure, what is the probability of a loose part being present in the car?
𝑷(+𝒍| + 𝒆) = 𝑷(+𝒍) = 𝟎. 𝟒