Let c1 → buys-comp = "yes"
c2 → buys - comp = "xs"
- calculate class probabilities
p (1) = 9/4
p (2) = 5/14
- calculate p ( c1 | x) = p (x| c1) . p (c1)
p (x | c1) = γ11p(xk|c1)
∴ p (x1|c1) p (age = "young" / c1)
= 2/9
p (x2/c1) = p (income = "med" / c1)
= 4/9
p (x3 / c1) = p (student = "yes" / c1)
= 6/9
p (x4 / c1) = p ( c.r. = "fair" | c1)
∴ 0 (x|c1) = 2/9 4/9 6/9 6/9
∴ p (c1/ x) = 2/9 4/9 6/9 6/9 9/14
= 0.0282
- Calculate p (c2/x)=p(x|c2),p(c2)
p (x | c2)=γ11p(xk|c2)
k = 1
∴ p (x1/c2) = p ( age = "young" / c2)
= 3/6
p(x2/c2=p(income=""/c2)
= 2/6
p(x3/c2) = p (student = "yes" / c2)
= 1/6
p (x4/c2) = p (c1 = "fair" / c2)
= 2/6
∴ p (x / c2)
= 3/1 2/0 1/6 2/6
∴ p ( c2 / x) = 3/6 2/6 1/6 2/6 6/14
= 0.0036
∵ p (c1 / x) > p (c2/ x)
X E C,
∴ x E bays - comp = "yes"