Supplemental slides for CSE 327 Prof. Jeff Heflin Ch. 18 – Learning Supplemental slides for CSE 327 Prof. Jeff Heflin
Decision Tree Learning function DEC-TREE-LEARN(examples,attribs,default) returns a decision tree if examples is empty then return default else if all examples have the same classification then return the classification else if attribs is empty then return MAJORITY-VALUE(examples) else best CHOOSE-ATTRIBUTE(attribs,examples) tree a new decision tree with root test best m MAJORITY-VALUE(examples) for each value vi of best do examplesi {elements of examples with best = vi} subtree DEC-TREE-LEARN(examplesi,attribs – best, m) add a branch to tree with label vi and subtree subtree return true From Figure 18.5, p. 658
Decision Tree Data Set Example Color Size Shape Goal Predicate X1 blue small square no X2 green large triangle X3 red circle yes X4 X5 yellow X6 X7 X8
Decision Tree Result Shape? No No Color? Yes No Yes Yes +: X3,X6 -: X1,X2,X4,X5,X7,X8 Shape? circle square triangle +: -: X2,X7 +: -: X1,X4,X8 +: X3,X6 -: X5 No No Color? green red yellow blue +: X3,X6 -: +: -: X5 +: -: +: -: Yes No Yes Yes