DTI (Solution)

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 6

Decision Tree Induction (DTI) J48

Day Outlook Temp Humidity Wind Play


𝐼𝐺(𝑃,𝑁)=(−𝑃)/(𝑃+𝑁) log_2⁡〖𝑃 /(𝑃+𝑁)
1 Sunny Hot High Weak No
log_2⁡〖𝑁 /(𝑃+𝑁) 〗 〗
2 Sunny Hot High Strong No
3 Overcast Hot High Weak Yes 𝐸𝑛𝑡𝑟𝑜𝑝𝑦=∑▒ 〖 (𝑃𝑖+𝑛𝑖)/(𝑃+
4 Rain Mild High Weak Yes
5 Rain Cool Normal Weak Yes
6 Rain Cool Normal Strong No
7 Overcast Cool Normal Strong Yes STEP 1
8 Sunny Mild High Weak No
9 Sunny Cool Normal Weak Yes
10 Rain Mild Normal Weak Yes
11 Sunny Mild Normal Strong Yes
12 Overcast Mild High Strong Yes Step 2
13 Overcast Hot Normal Weak Yes
14 Rain Mild High Strong No

Entropy of Outlook
Gain (Outlook)

Step 3

Entropy of
Temprature
Gain (Temp)

Step 5 Step 4
Wind Pi Ni I(Pi,Ni)
Strong 3 3 1
Weak 6 2 0.813

Entropy of Entropy of
Wind 0.893 Temprature
Gain (Wind) 0.047 Gain (Humidity)
Tree Induction (DTI) J48

)=(−𝑃)/(𝑃+𝑁) log_2⁡〖𝑃 /(𝑃+𝑁) −𝑁/(𝑃+𝑁)


〖𝑁 /(𝑃+𝑁) 〗 〗
𝐸𝑛𝑡𝑟𝑜𝑝𝑦=∑▒ 〖 (𝑃𝑖+𝑛𝑖)/(𝑃+𝑁) (𝐼𝐺(𝑃,𝑁)) 〗

𝐺𝐴𝐼𝑁(𝑃,𝑁)=𝐼𝐺(𝑃,𝑁)-Entropy

YES: P=9
NO:N=5
IG(9,5)=0.940

Outlook Pi Ni I(Pi,Ni)
Sunny 2 3 0.97
Overcast 4 0 0
Rain 3 2 0.97

0.693
0.248

Temprature Pi Ni I(Pi,Ni)
Hot 2 2 1
cool 3 1 0.809
Mild 4 2 0.912

0.912
0.028

Humidity Pi Ni I(Pi,Ni)
High 3 4 0.986
Normal 6 1 0.589

0.788
0.152
Day Outlook Temp Humidity Wind Play
1 Sunny Hot High Weak No
2 Sunny Hot High Strong No
8 Sunny Mild High Weak No
9 Sunny Cool Normal Weak Yes
11 Sunny Mild Normal Strong Yes

Entropy
Gain (Sunny,Temp)

Wind Pi Ni I(Pi,Ni)
Strong 1 1 1
Weak 1 2 0.918

Entropy 0.950 Entropy


Gain (Sunny,Wind) 0.021 Gain (Sunny,Humid)
Temp Pi Ni I(Pi,Ni)
Hot 0 2 0
Cool 1 0 0
Mild 1 1 1

0.400
0.571

Humidity Pi Ni I(Pi,Ni)
High 0 3 0
Normal 2 0 0

0.000
0.971
Day Outlook Temp Humidity Wind Play
4 Rain Mild High Weak Yes
5 Rain Cool Normal Weak Yes Temp
6 Rain Cool Normal Strong No Hot
10 Rain Mild Normal Weak Yes Cool
14 Rain Mild High Strong No Mild

Entropy 0.951
Gain (Rain,Temp) 0.019

Wind
Strong
Weak

Entropy 0.000
Gain (Rain,Wind) 0.970
Pi Ni I(Pi,Ni)
0 0 0
1 1 1
2 1 0.918

Pi Ni I(Pi,Ni)
3 0 0
0 2 0

You might also like