module_4 complete module_4 completmodule_4 complet (1).pptx
AdityaPatil176916
0 views
149 slides
Oct 08, 2025
Slide 1 of 149
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
About This Presentation
module_4 completmodule_4 completmodule_4 completmodule_4 completmodule_4 completmodule_4 completmodule_4 complet
Size: 36.07 MB
Language: en
Added: Oct 08, 2025
Slides: 149 pages
Slide Content
MODULE - 4 DECISION TREE LEARNING
Decision tree learning is a supervised predictive learning model, classifies data instances with high accuracy. The model performs inductive inference that reaches a general conclusion from observed examples. Used for complex classification applications. Decision tree is a concept tree which summarizes the information contained in the training dataset in the form of a tree structure. Once the concept model is built, test data can be easily classified. 2
DECISION TREE REPRESENTATION F I G U R E: A decision tree for the concept PlayTennis . An example is classified by sorting it through the tree to the appropriate leaf node, then returning the classification associated with this leaf 8
11 Decision trees represent a disjunction of conjunctions of constraints on the attribute values of instances. Each path from the tree root to a leaf corresponds to a conjunction of attribute tests, and the tree itself to a disjunction of these conjunctions For example, The decision tree shown in above figure corresponds to the expression (Outlook = Sunny ∧ Humidity = Normal) ∨ ∨ (Outlook = Overcast) (Outlook = Rain ∧ Wind = Weak)
13 THE BASIC DECISION TREE LEARNING ALGORITHM Mos t a lg o rith m s that have b een dev e loped for lear n ing de c ision trees are variations on a core algorithm that employs a top-down, greedy search through the space of possible decision trees. This approach is exemplified by the ID3 algorithm and its successor C4.5
ENTROPY MEASURES HOMOGENEITY OF EXAMPLES Entropy measures the impurity of a collection of examples. It is the amount of uncertainty or randomness in the outcome of a random variable or an event. Given a collection S, containing positive and negative examples of some target concept, the entropy of S relative to this Boolean classification is Where, p + is the proportion of positive examples in S p - is the proportion of negative examples in S. 14
Example: Entropy Suppose S is a collection of 14 examples of some boolean concept, including 9 positive and 5 negative examples. Then the entropy of S relative to this boolean classification is 15
16 The entropy is 0 if all members of S belong to the same class The entropy is 1 when the collection contains an equal number of positive and negative examples If the collection contains unequal numbers of positive and negative examples, the entropy is between 0 and 1
18
21 What is the ID3 algorithm? ID3 stands for Iterative Dichotomiser 3 ID3 is a precursor to the C4.5 Algorithm. The ID3 algorithm was invented by Ross Quinlan in 1975 Used to generate a decision tree from a given data set by employing a top-down, greedy search, to test each attribute at every node of the tree. The resulting tree is used to classify future samples.
23 ID3 algorithm
24 Which Attribute Is the Best Classifier? The central choice in the ID3 algorithm is selecting which attribute to test at each node in the tree. A st a tis t ic a l property c al l ed inf o r m a t i on g a in that m easures how w e ll a g iven attribute separates the training examples according to their target classification. ID3 uses information gain measure to select among the candidate attributes at each step while growing the tree.
INFORMATION GAIN MEASURES THE EXPECTED REDUCTION IN ENTROPY Information gain, is the expected reduction in entropy caused by partitioning the examples according to this attribute. The infor m ation g a in, Gain( S, A ) of an attri b ute A , rel a tive to a c o ll e c t i on of examples S, is defined as 25
26 Example: Information gain Let, Values ( Wind ) = { Weak , Strong } S S Weak S St r ong = [9+, 5−] = [6+, 2−] = [3+, 3−] Information gain of attribute Wind : Gain ( S , Wind ) = Entropy ( S ) − 8/14 Entropy ( S Weak ) − 6/14 Entropy ( S Strong ) = 0.94 – (8/14)* 0.811 – (6/14) *1.00 = 0.048
ID3 Algorithm — Purpose and Role ID3 is used in machine learning to: 🔹 1. Classify Data Using Decision Trees ID3 creates a decision tree that can be used to classify new instances by following the path from the root to a leaf node based on feature values. 🔹 2. Learn from Examples It learns patterns from labeled training data (supervised learning). Example: Given data about weather conditions, ID3 can learn to decide whether to play tennis. 🔹 3. Select Features Based on Information Gain It uses information gain (based on entropy) to choose the best feature to split the data at each step. The goal is to maximize purity in child nodes (i.e., group similar labels together). 🔹 4. Produce a Readable Model The output is a human-understandable decision tree structure, useful for interpretation and explanation.
Example Use Cases Medical diagnosis (e.g., classifying disease presence based on symptoms) Loan approval systems Spam detection Customer segmentation
What is Information Gain? Information Gain (IG) is a metric used to decide which feature to split the data on when building a decision tree (like in the ID3 algorithm). It measures how much “information” a feature gives us about the target variable . Purpose of Information Gain: To select the attribute that best splits the data into pure subsets (i.e., subsets where most or all samples belong to the same class). Formula:
What is Entropy ? Entropy is a measure of impurity , uncertainty , or disorder in a dataset. It is used in decision tree algorithms like ID3 , C4.5 , etc., to quantify the heterogeneity of a dataset. Entropy Formula :
Entropy Formula:
44 An Illustrative Example To illustrate the operation of ID3, consider the learning task represented by the training examples of below table. Here t h e ta r get a ttrib ut e Pl a y T ennis , w h ich c an have v al ues yes o r n o f o r different days. Consider the first step through the algorithm, in which the topmost node of the decision tree is created.
45 Day Outlook Temperature Humidity Wind PlayTennis D1 Sunny Hot High Weak No D2 Sunny Hot High Strong No D3 Overcast Hot High Weak Yes D4 Rain Mild High Weak Yes D5 Rain Cool Normal Weak Yes D6 Rain Cool Normal Strong No D7 Overcast Cool Normal Strong Yes D8 Sunny Mild High Weak No D9 Sunny Cool Normal Weak Yes D10 Rain Mild Normal Weak Yes D11 Sunny Mild Normal Strong Yes D12 Overcast Mild High Strong Yes D13 Overcast Hot Normal Weak Yes D14 Rain Mild High Strong No
ID3 determines the information gain for each candidate attribute (i.e., Outlook, Temperature, Humidity, and Wind), then selects the one with highest information gain 46
49 = 0.246 = 0.151 = 0.048 The information gain values for all four attributes are Gain(S, Outlook) Gain(S, Humidity) Gain(S, Wind) Gain(S, Temperature) = 0.029 According to the information gain measure, the Outlook attribute provides the best prediction of the target attribute, PlayTennis , over the training examples. Therefore, Outlook is selected as the decision attribute for the root node, and branches are created below the root for each of its possible values i.e., Sunny, Overcast, and Rain.
50
S Rain = { D4, D5, D6, D10, D14} Gain (S Rain , Humidity) = 0.970 – (2/5)1.0 – (3/5)0.917 = 0.019 Gain (S Rain , Temperature) = 0.970 – (0/5)0.0 – (3/5)0.918 – (2/5)1.0 = 0.019 Gain (S Rain , Wind) = 0.970 – (3/5)0.0 – (2/5)0.0 = 0.970 51
53
C4.5 CONSTRUCTION
C4.5
Validation and Pruning
PRUNING Using the number of instances classified correctly and instances classified wrongly Average Squad Error
BAYESIAN LEARNING
CAR THEFT classify a Red Domestic SUV is getting stolen or not
Since 0.144 > 0.048, Which means given the features RED SUV and Domestic, our example gets classified as ’NO’ the car is not stolen.