Weekend (Example) Weather Parents Money Decision (Category)
Weekend (Example) Weather Parents Money Decision (Category)
Weekend (Example) Weather Parents Money Decision (Category)
Decision: CATEGORY
A. Decision Tree
Step 1
Cinema = 6
Tennis = 2
Stay in = 1
Shopping = 1
H(3/5, 2/10, 1/10, 1/10)=-(3/5 log2 3/5) – (1/5 log2 1/5) – (1/10 log2 1/10) – (1/10 log2 1/10)
H(Category)=1.572
Step 2
Sunny * H + Windy * H + Rainy * H =3/10 (1/3, 2/3, 0/3, 0/3) + 4/10 (3/4, 0/4, 0/4, 1/4) + 3/10 (2/3, 0/3,
1/3, 0/3)
H(Category, Weather) = 3/10 ((-1/3 log2 1/3)-(2/3 log2 2/3) – (0/3 log2 0/3) – (0/3 log2 0/3)) + 4/10
((3/4 log2 ¾) – (0/4 log2 0/4) – (0/4 log2 0/4) – (1/4 log2 ¼)) + 3/10 ((-2/3 log2 2/3) – (0/3 log2 0/3) -
(1/3 log2 1/3) – (0/3 log2 0/3)
H(Category/weather) = 0.88
H(Category/parents)
Yes * H + No * H = 5/10 (5/5, 0/5, 0/5, 0/5) + 5/10 (1/5, 2/5, 1/5, 1/5)
H(Category/parents) = 5/10 ((-5/5 log2 5/5) + 5/10 ((-1/5 log2 1/5) – (2/5 log2 2/5) – (1/5 log2 1/5) –
(1/5 log2 1/5))
= 0 + 0.96
H(Category/parents) = 0.96
H(Category/money)
Rich * H + Poor * H = 7/10 (3/7 , 2/7, 1/7, 1/7) + 3/10 (3/3, 0/3, 0/3)
H(Category/money) = 7/10 ((-3/7 log2 3/7) – (2/7 log2 2/7) – (1/7 log2 1/7) – (1/7 log2 1/7)) + 3/10 ((-
3/3 log2 3/3))
= 1.295 + 0
H(Category/money) = 1.295
Step 3
Step 4
Sunny = H(1/3, 2/3, 0/3, 0/3) = 0.92
H (Category/parents)
1/3 (1/1, 0/1, 0/1, 0/1) + 2/3 (0/2, 2/2, 0/2, 0/2)
H (Category/parents) = 0
I (Category/parents) = 0.92
H (Category/money)
= 3/3 (0.92)
H (Category/money) = 0.92
H (Category/parents)
H (Category/parents) = 2/4 ((-2/2 log2 2/2)) + 2/4 ((-1/2 log2 ½) - (-1/2 log2 ½))
= 0 + 0.5
H (Category/parents) = 0.5
H (Category/money)
H (Category/money) = ¾ ((-2/3 log2 2/3) – (1/3 log2 1/3)) + ¼ (-1/1 log2 1/1)
= ¾ (0.92)
H (Category/money) =0.69
Step 1
P(C1) = P (Decision = Cinema) = 6/10 = 0.6
P (C2) = P (Decision = Tennis) = 2/10 = 0.2
P (C3) = P (Decision = Stay In) = 1/10 = 0.1
P (C4) = P (Decision = Shopping) = 1/10 = 0.1
Step 2
P(Rainy/Cinema) = 2/6 = 0.333
P(Rainy/Tennis) = 0/2 = 0
P(Rainy/Stay In) = 1/1 = 1
P(Rainy/Shopping) = 0/1 = 0
A. Decision Tree
Step 1
Yes = 8
No = 6
=0.463 + 0.527
H(Buys-RRSP) =0.99
Step 2
H(Buys-RRSP/Sector)
Farming * H + Oil * H + Banking * H = 5/14 (2/5, 3/5) + 5/14 (2/5, 3/5) + 4/14 (4/4, 0/4)
H(Buys-RRSP/Sector) = 5/14 ((-2/5 log2 2/5) – (3/5 log2 3/5)) + 5/14 ((-2/5 log2 2/5) – (3/5 log2 3/5)) +
4/14 (-4/4 log2 4/4)
= 0.346 + 0.346
H(Buys-RRSP/Sector) = 0.692
H(Buys-RRSP/Income)
Low * H + Medium * H + High * H = 4/14(3/4, ¼) + 6/14 (3/6, 3/6) + 4/14 (2/4, 2/4)
H(Buys-RRSP/Income) = 4/14 ((-3/4 log2 ¾) – (1/4 log2 ¼)) + 6/14 ((-3/6 log2 3/6) – (3/6 log2 3/6)) +
4/14 ((-2/4 log2 2/4) – (2/4 log2 2/4))
H(Buys-RRSP/Income) = 0.947
H(Buys-RRSP/Self-Employed)
H(Buys-RRSP/Self-Employed) = 7/14 ((-5/7 log2 5/7) – (2/7 log2 2/7)) + 7/14 ((-4/7 log2 4/7) – (3/7 log2
3/7))
= 0.432 + 0.493
H(Buys-RRSP/Self-Employed) = 0.925
H(Buys-RRSP/Credit-Rating)
H(Buys-RRSP/Credit-Rating) = 8/14 ((-3/8 log2 3/8) – (5/8 log2 5/8)) + 6/14 ((-5/6 log2 5/6) – (1/6 log2
1/6))
= 0.545 + 0.279
H(Buys-RRSP/Credit-Rating) = 0.824
Step 3
Step 4
= 0.551 + 0.4
H(Buys-RRSP/Income)= = 0.951
= 0.551 + 0.4
H (Buys-RRSP/Self-Employed) = 0.951
B)
Step 1
Step 2
Min support: 2
Min Confidence: 50%
Step 1
Step 2
Min support: 2
Min Confidence: 50%
Step 3
ABC, ABD, ABE, ACD, ACE, ADE, BCD, BCE, BDE, CDE
Min support: 2
Min Confidence: 50%
{A, B, D}, {A, B, E}, {A, D, E}, {B, C, D}, {B, D, E}, and {C, D, E}
Step 4
{A, B, D}, {A, B, E}, {A, D, E}, {B, C, D}, {B, D, E}, and {C, D, E}