SlideShare a Scribd company logo
1 of 14
Decision tree
Hello!
I am Iffat Firozy
I am here because I love to teach.
You can find me at ifirozy@gmail.com
2
“A decision tree is a structure that includes a root node, branches, and leaf
nodes. Each internal node denotes a test on an attribute, each branch
denotes the outcome of a test, and each leaf node holds a class label. The
topmost node in the tree is the root node.”
3
4
OUTLOOK
WINDYHUMIDITY
NO YES YES NO
YES
SUNNY RAINY
OVERCAST
NORMALHIGH FALSE TRUE
Root node
branches
5
BUT HOW can WE GENERATE A DECISION TREE FROM Our DATA SET???
LET'S SOLVE THIS PROBLEM.
Yellow
Is the color of gold,
butter and ripe lemons.
In the spectrum of
visible light, yellow is
found between green
and orange.
Blue
Is the colour of the
clear sky and the deep
sea. It is located
between violet and
green on the optical
spectrum.
Red
Is the color of blood,
and because of this it
has historically been
associated with
sacrifice, danger and
courage.
7
FOR ATTRIBUTE A:
STEP1:INFORMATION GAIN
𝐼0 2,3 =
−
2
2+3
𝑙𝑜𝑔2
2
2+3
−
3
3+2
𝑙𝑜𝑔2
3
3+2
=0.97
𝐼1 4,1 =
−
4
4+1
𝑙𝑜𝑔2
4
4+1
−
1
1+4
𝑙𝑜𝑔2
1
1+4
=.206
𝐼 𝑇 6,4 =
−
6
6+2
𝑙𝑜𝑔2
6
6+2
−
2
2+6
𝑙𝑜𝑔2
2
2+6
=.970
8
A C1/YES C2/NO
0 2 3
1 4 1
Note:
𝑙𝑜𝑔2
2
2+3
or
𝑙𝑜𝑔10(
2
2+3
)
𝑙𝑜𝑔10(2)
FOR ATTRIBUTE A:
STEP2:ENTROPY
𝐸 𝐶𝐿𝐴𝑆𝑆 𝐿𝐴𝐵𝐸𝐿, 𝐴
= 𝑃 0 𝐼0 + 𝑃 1 𝐼1
=
2+3
10
∗ .97 +
4+1
10
*.206
=.588
9
A C1/YES C2/NO
0 2 3
1 4 1
FOR ATTRIBUTE A:
STEP3:GAIN
𝐺𝐴𝐼𝑁 = 𝐼 𝑇 - E
=0.97 - .588
=0.38
Now, will follow these 3 steps to find out the
gain of attribute B.
10
FOR ATTRIBUTE B:
STEP1: INFORMATION GAIN
𝐼0 2,4 =0.05
𝐼1 4,0 =0
STEP2: ENTROPY
E=0.03
STEP3: GAIN
𝐼 𝑇 - E
=0.97 – 0.03 =.967
11
B C1/YES C2/NO
0 2 4
1 4 0
SEE!
12
B
0.967
A
0.38
SO, B ATTRIBUTE SPLIT THE DECISION TREE
B
A
NO YES
YES
10
10
B C1/YES C2/NO
0 2 4
1 4 0
1 has max no.
of c1(YES)
A C1/YES C2/NO
0 2 3
1 4 1
0 has
max no
of
C2(NO)
1 has max no.
of (YES)
1313
OUTLOOK
WINDYHUMIDITY
NO YES YES NO
YES
SUNNY RAINY
OVERCAST
NORMALHIGH FALSE TRUE
Root node
branches
14
THANKS!
Any questions?
You can find me at @iffat.firozy & ifirozy@gmail.com

More Related Content

More from Iffat Firozy

More from Iffat Firozy (7)

Association Rule Mining || Data Mining
Association Rule Mining || Data MiningAssociation Rule Mining || Data Mining
Association Rule Mining || Data Mining
 
Data Preprocessing || Data Mining
Data Preprocessing || Data MiningData Preprocessing || Data Mining
Data Preprocessing || Data Mining
 
K-means Clustering || Data Mining
K-means Clustering || Data MiningK-means Clustering || Data Mining
K-means Clustering || Data Mining
 
Hidden Markov Model
Hidden Markov ModelHidden Markov Model
Hidden Markov Model
 
Internet of things (Iot)
Internet of things (Iot)Internet of things (Iot)
Internet of things (Iot)
 
Hospital Introducer & Direction Giving Robot.
Hospital Introducer & Direction Giving Robot.Hospital Introducer & Direction Giving Robot.
Hospital Introducer & Direction Giving Robot.
 
How to calculate SGPA & CGPA
How to calculate SGPA & CGPAHow to calculate SGPA & CGPA
How to calculate SGPA & CGPA
 

Recently uploaded

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Decision Tree || Data Mining ..

  • 2. Hello! I am Iffat Firozy I am here because I love to teach. You can find me at ifirozy@gmail.com 2
  • 3. “A decision tree is a structure that includes a root node, branches, and leaf nodes. Each internal node denotes a test on an attribute, each branch denotes the outcome of a test, and each leaf node holds a class label. The topmost node in the tree is the root node.” 3
  • 4. 4 OUTLOOK WINDYHUMIDITY NO YES YES NO YES SUNNY RAINY OVERCAST NORMALHIGH FALSE TRUE Root node branches
  • 5. 5 BUT HOW can WE GENERATE A DECISION TREE FROM Our DATA SET???
  • 6.
  • 7. LET'S SOLVE THIS PROBLEM. Yellow Is the color of gold, butter and ripe lemons. In the spectrum of visible light, yellow is found between green and orange. Blue Is the colour of the clear sky and the deep sea. It is located between violet and green on the optical spectrum. Red Is the color of blood, and because of this it has historically been associated with sacrifice, danger and courage. 7
  • 8. FOR ATTRIBUTE A: STEP1:INFORMATION GAIN 𝐼0 2,3 = − 2 2+3 𝑙𝑜𝑔2 2 2+3 − 3 3+2 𝑙𝑜𝑔2 3 3+2 =0.97 𝐼1 4,1 = − 4 4+1 𝑙𝑜𝑔2 4 4+1 − 1 1+4 𝑙𝑜𝑔2 1 1+4 =.206 𝐼 𝑇 6,4 = − 6 6+2 𝑙𝑜𝑔2 6 6+2 − 2 2+6 𝑙𝑜𝑔2 2 2+6 =.970 8 A C1/YES C2/NO 0 2 3 1 4 1 Note: 𝑙𝑜𝑔2 2 2+3 or 𝑙𝑜𝑔10( 2 2+3 ) 𝑙𝑜𝑔10(2)
  • 9. FOR ATTRIBUTE A: STEP2:ENTROPY 𝐸 𝐶𝐿𝐴𝑆𝑆 𝐿𝐴𝐵𝐸𝐿, 𝐴 = 𝑃 0 𝐼0 + 𝑃 1 𝐼1 = 2+3 10 ∗ .97 + 4+1 10 *.206 =.588 9 A C1/YES C2/NO 0 2 3 1 4 1
  • 10. FOR ATTRIBUTE A: STEP3:GAIN 𝐺𝐴𝐼𝑁 = 𝐼 𝑇 - E =0.97 - .588 =0.38 Now, will follow these 3 steps to find out the gain of attribute B. 10
  • 11. FOR ATTRIBUTE B: STEP1: INFORMATION GAIN 𝐼0 2,4 =0.05 𝐼1 4,0 =0 STEP2: ENTROPY E=0.03 STEP3: GAIN 𝐼 𝑇 - E =0.97 – 0.03 =.967 11 B C1/YES C2/NO 0 2 4 1 4 0
  • 12. SEE! 12 B 0.967 A 0.38 SO, B ATTRIBUTE SPLIT THE DECISION TREE B A NO YES YES 10 10 B C1/YES C2/NO 0 2 4 1 4 0 1 has max no. of c1(YES) A C1/YES C2/NO 0 2 3 1 4 1 0 has max no of C2(NO) 1 has max no. of (YES)
  • 13. 1313 OUTLOOK WINDYHUMIDITY NO YES YES NO YES SUNNY RAINY OVERCAST NORMALHIGH FALSE TRUE Root node branches
  • 14. 14 THANKS! Any questions? You can find me at @iffat.firozy & ifirozy@gmail.com