SlideShare a Scribd company logo
Chapter 3: Decision Tree
Algorithm
Mark. A. Magumba
Decision Trees: ID3 (Iterative Dichotomizer)
• Decision Trees operate on categorical data
• They are primarily classification algorithms
• However, they can be modified into regression trees
• One basic algorithm is ID3 which is based on entropy
• Entropy of some set X is given by:
Entropy
• Entropy is a measure of uncertainty, least entropy is when all the probability mass
is in one outcome and maximal entropy is when the probability mass is uniformly
distributed
ID3 Concrete Example: Data
ID3 Steps
1. Compute the entropy of the data (Entropy(S))
On our data
Entropy (S) =
Entropy (S) =
= 0.94
2. Next you compute the entropy given some attribute value
This can be expressed as:
=
In other words, this time we take the probabilities given each value v of the
attribute set V
Entropy given v
For Outlook
V = “Sunny”
=
= Entropy (S|”Sunny”) =
=
= 0.97
Entropy given v
• Similarly entropy for other branches of outlook can be computed
• = 0.97
• = 0
Information Gain
• Next we have to compute the information gain on the attribute
• This can be obtained by:
• In our case this is:
=
= 0.94 – 5/14*0.97 – 4/14* 0 – 5/14*0.97
= 0.246
Building the tree
• The Information gain for the other attributes can be similarly
computed to obtain the following values
• Gain(S, Temperature) = 0.029
• Gain(S, Humidity) = 0.152
• Gain(S, Windy) = 0.048
• From these values we fin that the maximal IG is on the outlook
attribute and this becomes our root node
Building the tree
Building the tree: Branching and leaf nodes
• ID3 is iterative
• The algorithm recursively calls itself on the branches until it
encounters some stopping condition
• These are the basic stopping conditions
• When there are no more attributes to check, ID3 returns the majority class
• When all remaining examples are one class again ID3 returns the majority
class, e.g. in our example all instances where outlook = overcast are positive
instances hence ID3 returns the leaf node “Yes”
• The branches for Outlook = “Sunny” and Outlook = “Rainy” have mixed
instances and since we have more attributes we can continue growing them
ID3 Weaknesses
• Given enough attributes, ID3 can end up perfectly classifying all of the
instances and overfit.
• Solutions: Have enough training data and in some cases it is beneficial to
specify a maximum tree depth to avoid very deep trees
• ID3 algorithm may also favor features with many branches leading to
sub optimal solutions.
• Solution: Some updates to the algorithm like c4.5 algorithm algorithmically
adjust for splitting. C4.5 normalizes information gain by dividing it with the
split information. The split information is given by:
Random Forests
• An additional solution to both problems is random forests
• Random forests algorithms generate multiple trees each on a subset
of the data
• The final decision is made after aggregating the output of these
different trees

More Related Content

PPTX
Decision Tree Learning: Decision tree representation, Appropriate problems fo...
PPT
Decision tree Using Machine Learning.ppt
PPT
Storey_DecisionTrees explain ml algo.ppt
PPTX
module_3_1.pptx
PPTX
module_3_1.pptx
PDF
Research scholars evaluation based on guides view using id3
PDF
Unit3_Classification_Decision Tree ID4, C4.5, CART.pdf
PDF
Research scholars evaluation based on guides view
Decision Tree Learning: Decision tree representation, Appropriate problems fo...
Decision tree Using Machine Learning.ppt
Storey_DecisionTrees explain ml algo.ppt
module_3_1.pptx
module_3_1.pptx
Research scholars evaluation based on guides view using id3
Unit3_Classification_Decision Tree ID4, C4.5, CART.pdf
Research scholars evaluation based on guides view

Similar to Chapter 3 Decision Trees.pptx by mark magumba (20)

PPTX
Machine Learning, Decision Tree Learning module_2_ppt.pptx
PDF
Machine Learning using python module_2_ppt.pdf
PDF
Decision trees
PDF
Efficient classification of big data using vfdt (very fast decision tree)
PPTX
Decision Trees Learning in Machine Learning
PPTX
BAS 250 Lecture 5
PPT
Lecture -3 Classification(Decision Tree).ppt
PPTX
Decision tree presentation
PPTX
Decision trees
PDF
Implementation of Improved ID3 Algorithm to Obtain more Optimal Decision Tree.
PPTX
Decision tree in artificial intelligence
PPTX
Decision tree
PPTX
Decision Tree (1).pptx in data science, helpful to understand about the decsi...
PDF
7 decision tree
PPTX
ID3 ALGORITHM
PDF
Deployment of ID3 decision tree algorithm for placement prediction
PDF
Decision treeDecision treeDecision treeDecision tree
PDF
Decision tree
PDF
decision tree.pdf
PPT
Decision Trees.ppt
Machine Learning, Decision Tree Learning module_2_ppt.pptx
Machine Learning using python module_2_ppt.pdf
Decision trees
Efficient classification of big data using vfdt (very fast decision tree)
Decision Trees Learning in Machine Learning
BAS 250 Lecture 5
Lecture -3 Classification(Decision Tree).ppt
Decision tree presentation
Decision trees
Implementation of Improved ID3 Algorithm to Obtain more Optimal Decision Tree.
Decision tree in artificial intelligence
Decision tree
Decision Tree (1).pptx in data science, helpful to understand about the decsi...
7 decision tree
ID3 ALGORITHM
Deployment of ID3 decision tree algorithm for placement prediction
Decision treeDecision treeDecision treeDecision tree
Decision tree
decision tree.pdf
Decision Trees.ppt
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Ad

Chapter 3 Decision Trees.pptx by mark magumba

  • 1. Chapter 3: Decision Tree Algorithm Mark. A. Magumba
  • 2. Decision Trees: ID3 (Iterative Dichotomizer) • Decision Trees operate on categorical data • They are primarily classification algorithms • However, they can be modified into regression trees • One basic algorithm is ID3 which is based on entropy • Entropy of some set X is given by: Entropy • Entropy is a measure of uncertainty, least entropy is when all the probability mass is in one outcome and maximal entropy is when the probability mass is uniformly distributed
  • 4. ID3 Steps 1. Compute the entropy of the data (Entropy(S)) On our data Entropy (S) = Entropy (S) = = 0.94 2. Next you compute the entropy given some attribute value This can be expressed as: = In other words, this time we take the probabilities given each value v of the attribute set V
  • 5. Entropy given v For Outlook V = “Sunny” = = Entropy (S|”Sunny”) = = = 0.97
  • 6. Entropy given v • Similarly entropy for other branches of outlook can be computed • = 0.97 • = 0
  • 7. Information Gain • Next we have to compute the information gain on the attribute • This can be obtained by: • In our case this is: = = 0.94 – 5/14*0.97 – 4/14* 0 – 5/14*0.97 = 0.246
  • 8. Building the tree • The Information gain for the other attributes can be similarly computed to obtain the following values • Gain(S, Temperature) = 0.029 • Gain(S, Humidity) = 0.152 • Gain(S, Windy) = 0.048 • From these values we fin that the maximal IG is on the outlook attribute and this becomes our root node
  • 10. Building the tree: Branching and leaf nodes • ID3 is iterative • The algorithm recursively calls itself on the branches until it encounters some stopping condition • These are the basic stopping conditions • When there are no more attributes to check, ID3 returns the majority class • When all remaining examples are one class again ID3 returns the majority class, e.g. in our example all instances where outlook = overcast are positive instances hence ID3 returns the leaf node “Yes” • The branches for Outlook = “Sunny” and Outlook = “Rainy” have mixed instances and since we have more attributes we can continue growing them
  • 11. ID3 Weaknesses • Given enough attributes, ID3 can end up perfectly classifying all of the instances and overfit. • Solutions: Have enough training data and in some cases it is beneficial to specify a maximum tree depth to avoid very deep trees • ID3 algorithm may also favor features with many branches leading to sub optimal solutions. • Solution: Some updates to the algorithm like c4.5 algorithm algorithmically adjust for splitting. C4.5 normalizes information gain by dividing it with the split information. The split information is given by:
  • 12. Random Forests • An additional solution to both problems is random forests • Random forests algorithms generate multiple trees each on a subset of the data • The final decision is made after aggregating the output of these different trees