Decision Tree
Decision Tree
Decision Tree
Machine Learning
Topics: Decision Tree, Naı̈ve Bayes Classifier
Partha Basuchowdhuri
Assistant Professor,
Department of Computer Science and Engineering,
Heritage Institute of Technology,
Kolkata, INDIA
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
1 Predictive Modelling
2 Decision Tree
Introduction, Impurity Measures
Decision Tree Construction
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Validation data: May be the model still does not account for
a few cases. This type of data further improves the model by
taking some corrective measures.
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Validation data: May be the model still does not account for
a few cases. This type of data further improves the model by
taking some corrective measures.
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Validation data: May be the model still does not account for
a few cases. This type of data further improves the model by
taking some corrective measures.
Say, your model can identify - 8 dogs out of which 3 are actually
cats
TRUE + TRUE +
Precision = Predicted TRUE = (TRUE +)+(FALSE +)
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Say, your model can identify - 8 dogs out of which 3 are actually
cats
TRUE + TRUE +
Precision = Predicted TRUE = (TRUE +)+(FALSE +)
TRUE + TRUE +
Recall = Actual TRUE = (TRUE +)+(FALSE −)
Say, your model can identify - 8 dogs out of which 3 are actually
cats
5 5
Precision = 5+3 = 8 (what is the significance?)
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Predictive Modelling
Decision Tree
Say, your model can identify - 8 dogs out of which 3 are actually
cats
5 5
Precision = 5+3 = 8 (what is the significance?)
5 5
Recall = 5+4 = 9 (what is the significance?)
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
1 Predictive Modelling
2 Decision Tree
Introduction, Impurity Measures
Decision Tree Construction
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Observations:
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Observations:
Every path starting from the root and ending at a leaf node,
would form a rule to achieve the target.
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Observations:
Every path starting from the root and ending at a leaf node,
would form a rule to achieve the target.
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Nature of Entropy
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Misclassification Error -
c
ME (D) = 1 − maxi=1 (pi )
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Misclassification Error -
c
ME (D) = 1 − maxi=1 (pi )
Example:
!2 ! !2
5 9
G ([9+, 5−]) = 1 − + = 0.46
14 14
!
9 5
ME ([9+, 5−]) = 1 − max , = 0.357
14 14
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Impurity Measures -
Example 1:
Node N1 Count E(0+,6-) = - (0/6)log2 (0/6) - (6/6)log2 (6/6) = 0
Class 0 0 G(0+,6-) = 1 - (0/6)2 - (6/6)2 = 0
Class 1 6 ME(0+,6-) = 1 - max((0/6), (6/6)) = 0
Example 2:
Node N1 Count E(1+,5-) = - (1/6)log2 (1/6) - (5/6)log2 (5/6) = 0.65
Class 0 1 G(1+,5-) = 1 - (1/6)2 - (5/6)2 = 0.278
Class 1 5 ME(1+,5-) = 1 - max((1/6), (5/6)) = 0.167
Example 3:
Node N1 Count E(0+,6-) = - (3/6)log2 (3/6) - (3/6)log2 (3/6) = 1
Class 0 3 G(0+,6-) = 1 - (3/6)2 - (3/6)2 = 0.5
Class 1 3 ME(0+,6-) = 1 - max((3/6), (3/6)) = 0.5
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier
Introduction, Impurity Measures
Predictive Modelling
Decision Tree Construction
Decision Tree
Overfitting in Decision Tree
Partha Basuchowdhuri Machine Learning Topics: Decision Tree, Naı̈ve Bayes Classifier