SlideShare a Scribd company logo
Decision Tree
Created By:
Muhammad Umer Khan 2017-cs-027
Basit Hussain 2017-cs-050
Introduction
A decision tree is a decision support tool that
uses a tree like graph or model of decisions and
their possible consequences, including chance
event outcomes, resource cost, and profitable.
A decision tree is a graphical representation of possible
solutions to a decision based on certain conditions. It's
called a decision tree because it starts with a single box
(or root), which then branches off into a number of
solutions, just like a tree.
Strengths and Weakness
The strengths of decision tree methods are:
▪ Decision trees are able to generate understandable
rules.
▪ Decision trees perform classification without requiring
much computation.
▪ Decision trees are able to handle both continuous and
categorical variables.
▪ Decision trees provide a clear indication of which
fields are most important for prediction or
classification.
Strengths and Weakness
The weaknesses of decision tree methods :
▪ Decision trees are less appropriate for estimation
tasks where the goal is to predict the value of a
continuous attribute.
▪ Decision trees are prone to errors in classification
problems with many class and relatively small
number of training examples.
Formula
▪ Information Gain:
I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n) ………..(i)
▪ Entropy:
E(A) = ∑ [(pi + ni) / (P + n)] [I (p,n)] ………..(ii)
▪ Gain:
(A) = I(p,n) – E(A) ………..(iii)
V
i = 1
Decision Tree Example
Person
20
2%
20-50
50
5%U M
10% 20% 80%
Uk k
Dataset
Age Vehicles Type Profit
Old Yes Car Down
Old No Car Down
Old No Bike Down
Mid Yes Car Down
Mid Yes Bike Down
Mid No Bike Up
Mid No Car Up
New Yes Car Up
New No Bike Up
New No Car Up
Class attribute
Entropy of Class Attribute
P N
5 5
I (Pi , Ni) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n)
= -5/10 log2 (5/10) – 5/10 log2 (5/10)
= 1
Dataset
Age Vehicles Type Profit
Old Yes Car Down
Old No Car Down
Old No Bike Down
Mid Yes Car Down
Mid Yes Bike Down
Mid No Bike Up
Mid No Car Up
New Yes Car Up
New No Bike Up
New No Car Up
Pi Ni I(Pi, Ni)
Old 0 3 0
Mid 2 2 1
New 3 0 0
I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n)
Entropy (Age):
E(A) = ∑ [(pi + ni) / (P + n)] [I (p,n)]
= (0+3/5+5)(0) + (2+2/ 5+5)(1)+(3+0/5+5)(0)
= 4 / 10
= 0.4
Gain = Class Entropy – Entropy(Age)
= 1 – 0.4
= 0.6
Age
Pi Ni I(Pi, Ni)
Yes 1 3 0.8112
No 4 2 0.9182
I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n)
Entropy (Vehicles):
= (1+3/5+5)(0.8112) + (4+2/ 5+5)(0.9182)
= 0.8754
Gain = Class Entropy – Entropy(vehicles)
= 1 – 0.8754
= 0.1245
Vehicles
Pi Ni I(Pi, Ni)
Car 3 3 1
Bike 2 2 1
Entropy (Type):
= (3+3/5+5)(1) + (2+2/ 5+5)(1)
= 6/10+ 4/10
=10/10
= 1
Gain = Class Entropy – Entropy(type)
= 1 – 1
= 0
Type
Information Gain
Age 0.6
Vheicles 0.1245
Type 0
Age
Root Node
Down
?
Up
Age Profit
Old Down
Old Down
Old Down
Age Profit
New Up
New Up
New Up
Mid
Information Gain(Contd…)
Age Vehicles Type Profit
Mid Yes Car Down
Mid Yes Bike Down
Mid No Bike Up
Mid No Car Up
Vehicles
Pi Ni I(Pi, Ni)
Yes 0 2 0
No 2 0 0
Entropy (vehicles):
= (2/4)(0) + (2/ 4)(0)
= 0
Gain = Class Entropy – Entropy(vehicles)
= 1 – 0
= 1
Type
Pi Ni I(Pi, Ni)
Car 1 1 1
Bike 1 1 1
Entropy (competition):
= (2/4)(1) + (2/ 4)(1)
= 1
Gain = Class Entropy – Entropy(competition)
= 1 – 1
= 0
Gain
Vehicles 1 node
Type 0
Age
Down Up
Vehicles
Down Up
Mid
Thank You 

More Related Content

Similar to Decision tree

Order of operations
Order of operationsOrder of operations
Order of operations
formatic20
 
www1.cs.columbia.edu
www1.cs.columbia.eduwww1.cs.columbia.edu
www1.cs.columbia.edu
butest
 
Classification (ML).ppt
Classification (ML).pptClassification (ML).ppt
Classification (ML).ppt
rajasamal1999
 
Evaluating algebraic expression
Evaluating algebraic expressionEvaluating algebraic expression
Evaluating algebraic expression
Marites Ablay
 
GPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
GPU Accelerated Backtesting and Machine Learning for Quant Trading StrategiesGPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
GPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
Daniel Egloff
 
Quantitative Aptitude & Mathematics 13 October
Quantitative Aptitude & Mathematics 13 OctoberQuantitative Aptitude & Mathematics 13 October
Quantitative Aptitude & Mathematics 13 October
Dr. Trilok Kumar Jain
 
Ferdinand petra excel modelling (extract)
Ferdinand petra   excel modelling (extract)Ferdinand petra   excel modelling (extract)
Ferdinand petra excel modelling (extract)
Ferdinand PETRA
 
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic ConceptsData Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
Salah Amean
 
CJA474 v9Effective Practices for Managers and Supervisors CJA.docx
CJA474 v9Effective Practices for Managers and Supervisors CJA.docxCJA474 v9Effective Practices for Managers and Supervisors CJA.docx
CJA474 v9Effective Practices for Managers and Supervisors CJA.docx
mccormicknadine86
 
Scaling decision trees - George Murray, July 2015
Scaling decision trees - George Murray, July 2015Scaling decision trees - George Murray, July 2015
Scaling decision trees - George Murray, July 2015
Seattle DAML meetup
 
Cs501 classification prediction
Cs501 classification predictionCs501 classification prediction
Cs501 classification prediction
Kamal Singh Lodhi
 
26 Augustquantitative Aptitude Ii
26 Augustquantitative Aptitude  Ii26 Augustquantitative Aptitude  Ii
26 Augustquantitative Aptitude Ii
Dr. Trilok Kumar Jain
 
2167 class 2 fin statements & ethics
2167 class 2 fin statements & ethics2167 class 2 fin statements & ethics
2167 class 2 fin statements & ethics
mrjlm
 
WEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic MethodsWEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic Methods
weka Content
 
WEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic MethodsWEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic Methods
DataminingTools Inc
 
ID3 Algorithm & ROC Analysis
ID3 Algorithm & ROC AnalysisID3 Algorithm & ROC Analysis
ID3 Algorithm & ROC Analysis
Talha Kabakus
 
Quantitative Aptitude 7 October
Quantitative Aptitude 7 OctoberQuantitative Aptitude 7 October
Quantitative Aptitude 7 October
Dr. Trilok Kumar Jain
 
ID3 -rks.pdf
ID3 -rks.pdfID3 -rks.pdf
ID3 -rks.pdf
RamakrushnaSwain4
 
ML-08.pdf
ML-08.pdfML-08.pdf
ML-08.pdf
Mohammad Akbari
 
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
hyacinthshackley2629
 

Similar to Decision tree (20)

Order of operations
Order of operationsOrder of operations
Order of operations
 
www1.cs.columbia.edu
www1.cs.columbia.eduwww1.cs.columbia.edu
www1.cs.columbia.edu
 
Classification (ML).ppt
Classification (ML).pptClassification (ML).ppt
Classification (ML).ppt
 
Evaluating algebraic expression
Evaluating algebraic expressionEvaluating algebraic expression
Evaluating algebraic expression
 
GPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
GPU Accelerated Backtesting and Machine Learning for Quant Trading StrategiesGPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
GPU Accelerated Backtesting and Machine Learning for Quant Trading Strategies
 
Quantitative Aptitude & Mathematics 13 October
Quantitative Aptitude & Mathematics 13 OctoberQuantitative Aptitude & Mathematics 13 October
Quantitative Aptitude & Mathematics 13 October
 
Ferdinand petra excel modelling (extract)
Ferdinand petra   excel modelling (extract)Ferdinand petra   excel modelling (extract)
Ferdinand petra excel modelling (extract)
 
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic ConceptsData Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
 
CJA474 v9Effective Practices for Managers and Supervisors CJA.docx
CJA474 v9Effective Practices for Managers and Supervisors CJA.docxCJA474 v9Effective Practices for Managers and Supervisors CJA.docx
CJA474 v9Effective Practices for Managers and Supervisors CJA.docx
 
Scaling decision trees - George Murray, July 2015
Scaling decision trees - George Murray, July 2015Scaling decision trees - George Murray, July 2015
Scaling decision trees - George Murray, July 2015
 
Cs501 classification prediction
Cs501 classification predictionCs501 classification prediction
Cs501 classification prediction
 
26 Augustquantitative Aptitude Ii
26 Augustquantitative Aptitude  Ii26 Augustquantitative Aptitude  Ii
26 Augustquantitative Aptitude Ii
 
2167 class 2 fin statements & ethics
2167 class 2 fin statements & ethics2167 class 2 fin statements & ethics
2167 class 2 fin statements & ethics
 
WEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic MethodsWEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic Methods
 
WEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic MethodsWEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic Methods
 
ID3 Algorithm & ROC Analysis
ID3 Algorithm & ROC AnalysisID3 Algorithm & ROC Analysis
ID3 Algorithm & ROC Analysis
 
Quantitative Aptitude 7 October
Quantitative Aptitude 7 OctoberQuantitative Aptitude 7 October
Quantitative Aptitude 7 October
 
ID3 -rks.pdf
ID3 -rks.pdfID3 -rks.pdf
ID3 -rks.pdf
 
ML-08.pdf
ML-08.pdfML-08.pdf
ML-08.pdf
 
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
11414 2.3 Homework (Quadratic Equations)courses.thinkwel.docx
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 

Decision tree

  • 2. Created By: Muhammad Umer Khan 2017-cs-027 Basit Hussain 2017-cs-050
  • 3. Introduction A decision tree is a decision support tool that uses a tree like graph or model of decisions and their possible consequences, including chance event outcomes, resource cost, and profitable. A decision tree is a graphical representation of possible solutions to a decision based on certain conditions. It's called a decision tree because it starts with a single box (or root), which then branches off into a number of solutions, just like a tree.
  • 4. Strengths and Weakness The strengths of decision tree methods are: ▪ Decision trees are able to generate understandable rules. ▪ Decision trees perform classification without requiring much computation. ▪ Decision trees are able to handle both continuous and categorical variables. ▪ Decision trees provide a clear indication of which fields are most important for prediction or classification.
  • 5. Strengths and Weakness The weaknesses of decision tree methods : ▪ Decision trees are less appropriate for estimation tasks where the goal is to predict the value of a continuous attribute. ▪ Decision trees are prone to errors in classification problems with many class and relatively small number of training examples.
  • 6. Formula ▪ Information Gain: I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n) ………..(i) ▪ Entropy: E(A) = ∑ [(pi + ni) / (P + n)] [I (p,n)] ………..(ii) ▪ Gain: (A) = I(p,n) – E(A) ………..(iii) V i = 1
  • 8. Dataset Age Vehicles Type Profit Old Yes Car Down Old No Car Down Old No Bike Down Mid Yes Car Down Mid Yes Bike Down Mid No Bike Up Mid No Car Up New Yes Car Up New No Bike Up New No Car Up Class attribute
  • 9. Entropy of Class Attribute P N 5 5 I (Pi , Ni) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n) = -5/10 log2 (5/10) – 5/10 log2 (5/10) = 1
  • 10. Dataset Age Vehicles Type Profit Old Yes Car Down Old No Car Down Old No Bike Down Mid Yes Car Down Mid Yes Bike Down Mid No Bike Up Mid No Car Up New Yes Car Up New No Bike Up New No Car Up
  • 11. Pi Ni I(Pi, Ni) Old 0 3 0 Mid 2 2 1 New 3 0 0 I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n) Entropy (Age): E(A) = ∑ [(pi + ni) / (P + n)] [I (p,n)] = (0+3/5+5)(0) + (2+2/ 5+5)(1)+(3+0/5+5)(0) = 4 / 10 = 0.4 Gain = Class Entropy – Entropy(Age) = 1 – 0.4 = 0.6 Age
  • 12. Pi Ni I(Pi, Ni) Yes 1 3 0.8112 No 4 2 0.9182 I (P , n) = -p/p+n log2 ( p/p+n) – n/p+n log2 (n/p+n) Entropy (Vehicles): = (1+3/5+5)(0.8112) + (4+2/ 5+5)(0.9182) = 0.8754 Gain = Class Entropy – Entropy(vehicles) = 1 – 0.8754 = 0.1245 Vehicles
  • 13. Pi Ni I(Pi, Ni) Car 3 3 1 Bike 2 2 1 Entropy (Type): = (3+3/5+5)(1) + (2+2/ 5+5)(1) = 6/10+ 4/10 =10/10 = 1 Gain = Class Entropy – Entropy(type) = 1 – 1 = 0 Type
  • 14. Information Gain Age 0.6 Vheicles 0.1245 Type 0 Age Root Node Down ? Up Age Profit Old Down Old Down Old Down Age Profit New Up New Up New Up Mid
  • 15. Information Gain(Contd…) Age Vehicles Type Profit Mid Yes Car Down Mid Yes Bike Down Mid No Bike Up Mid No Car Up
  • 16. Vehicles Pi Ni I(Pi, Ni) Yes 0 2 0 No 2 0 0 Entropy (vehicles): = (2/4)(0) + (2/ 4)(0) = 0 Gain = Class Entropy – Entropy(vehicles) = 1 – 0 = 1
  • 17. Type Pi Ni I(Pi, Ni) Car 1 1 1 Bike 1 1 1 Entropy (competition): = (2/4)(1) + (2/ 4)(1) = 1 Gain = Class Entropy – Entropy(competition) = 1 – 1 = 0
  • 18. Gain Vehicles 1 node Type 0 Age Down Up Vehicles Down Up Mid