1 Create the root node of the tree S
|
2 if all instances belong to the same class C then
|
3 S= leaf note labeled with class C
|
4 if attribute list (A l) is empty then
|
5 S= leaf node labeled with the majority class |
6 Otherwise
|
7 Select test attribute (A t) from A l with the greatest information gain |
8 Label node S as A t
|
9 For each possible value v i of A t
|
10 grow a branch from S where the test attribute A t = v i
|
11 Let S v be the subset of S for each value of Attribute A t = v i
|
12 if S v is empty then
|
13 label the node S v as a leaf with the most common class |
14 Else below this branch add the subtree node |