decision trees
play

Decision Trees Petr Po s k This lecture is largely based on the - PowerPoint PPT Presentation

CZECH TECHNICAL UNIVERSITY IN PRAGUE Faculty of Electrical Engineering Department of Cybernetics Decision Trees Petr Po s k This lecture is largely based on the book Artificial Intelligence: A Modern Approach, 3rd ed. by Stuart


  1. CZECH TECHNICAL UNIVERSITY IN PRAGUE Faculty of Electrical Engineering Department of Cybernetics Decision Trees Petr Poˇ s´ ık This lecture is largely based on the book Artificial Intelligence: A Modern Approach, 3rd ed. by Stuart Russell and Peter Norvig (Prentice Hall, 2010). P. Poˇ s´ ık c � 2015 Artificial Intelligence – 1 / 29

  2. Decision Trees P. Poˇ s´ ık c � 2015 Artificial Intelligence – 2 / 29

  3. What is a decision tree? Decision tree ■ is a function that Decision Trees ■ takes a vector of attribute values as its input, and • What is a decision tree? ■ returns a “decision” as its output. • Attribute description ■ Both input and output values can be measured on a nominal, ordinal, interval, • Expressiveness of and ratio scales, can be discrete or continuous. decision trees Learning a Decision ■ The decision is formed via a sequence of tests: Tree Generalization and ■ each internal node of the tree represents a test, Overfitting ■ the branches are labeled with possible outcomes of the test, and Broadening the Applicability of ■ each leaf node represents a decision to be returned by the tree. Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 3 / 29

  4. What is a decision tree? Decision tree ■ is a function that Decision Trees ■ takes a vector of attribute values as its input, and • What is a decision tree? ■ returns a “decision” as its output. • Attribute description ■ Both input and output values can be measured on a nominal, ordinal, interval, • Expressiveness of and ratio scales, can be discrete or continuous. decision trees Learning a Decision ■ The decision is formed via a sequence of tests: Tree Generalization and ■ each internal node of the tree represents a test, Overfitting ■ the branches are labeled with possible outcomes of the test, and Broadening the Applicability of ■ each leaf node represents a decision to be returned by the tree. Desicion Trees Summary Decision trees examples: ■ classification schemata in biology (urˇ covac´ ı kl´ ıˇ ce) ■ diagnostic sections in illness encyclopedias ■ online troubleshooting section on software web pages ■ . . . P. Poˇ s´ ık c � 2015 Artificial Intelligence – 3 / 29

  5. Attribute description Example: A computer game. The main character of the game meets various robots along his way. Some behave like allies, others like enemies. Decision Trees • What is a decision tree? ally head body smile neck holds class • Attribute description circle circle yes tie nothing ally • Expressiveness of decision trees circle square no tie sword enemy Learning a Decision . . . . . . . . . . . . . . . . . . Tree Generalization and Overfitting The game engine may use e.g. the following tree to assign the Broadening the ally or enemy attitude to the generated robots: Applicability of Desicion Trees enemy neck Summary other tie body smile triangle other s e no y ally enemy ally enemy P. Poˇ s´ ık c � 2015 Artificial Intelligence – 4 / 29

  6. Expressiveness of decision trees The tree on previous slide is a Boolean decision tree: ■ the decision is a binary variable (true, false), and Decision Trees ■ the attributes are discrete. • What is a decision tree? ■ It returns ally iff the input attributes satisfy one of the paths leading to an ally leaf: • Attribute description ally ⇔ ( neck = tie ∧ smile = yes ) ∨ ( neck = ¬ tie ∧ body = triangle ) , • Expressiveness of decision trees Learning a Decision i.e. in general Tree Goal ⇔ ( Path 1 ∨ Path 2 ∨ . . . ) , where Generalization and ■ Overfitting Path is a conjuction of attribute-value tests, i.e. ■ Broadening the Applicability of ■ the tree is equivalent to a DNF of a function. Desicion Trees Summary Any function in propositional logic can be expressed as a dec. tree. ■ Trees are a suitable representation for some functions and unsuitable for others. ■ What is the cardinality of the set of Boolean functions of n attributes? ■ It is equal to the number of truth tables that can be created with n attributes. ■ The truth table has 2 n rows, i.e. there is 2 2 n different functions. ■ The set of trees is even larger; several trees represent the same function. ■ We need a clever algorithm to find good hypotheses (trees) in such a large space. P. Poˇ s´ ık c � 2015 Artificial Intelligence – 5 / 29

  7. Learning a Decision Tree P. Poˇ s´ ık c � 2015 Artificial Intelligence – 6 / 29

  8. A computer game Example 1: Can you distinguish between allies and enemies after seeing a few of them? Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics Generalization and Overfitting Broadening the Applicability of Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 7 / 29

  9. A computer game Example 1: Can you distinguish between allies and enemies after seeing a few of them? Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics Hint: concentrate on the shapes of heads and bodies. Generalization and Overfitting Broadening the Applicability of Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 7 / 29

  10. A computer game Example 1: Can you distinguish between allies and enemies after seeing a few of them? Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics Hint: concentrate on the shapes of heads and bodies. Generalization and Overfitting Answer: Seems like allies have the same shape of their head and body. Broadening the How would you represent this by a decision tree? (Relation among attributes.) Applicability of Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 7 / 29

  11. A computer game Example 1: Can you distinguish between allies and enemies after seeing a few of them? Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics Hint: concentrate on the shapes of heads and bodies. Generalization and Overfitting Answer: Seems like allies have the same shape of their head and body. Broadening the How would you represent this by a decision tree? (Relation among attributes.) Applicability of How do you know that you are right? Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 7 / 29

  12. A computer game Example 2: Some robots changed their attitudes: Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics Generalization and Overfitting Broadening the Applicability of Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 8 / 29

  13. A computer game Example 2: Some robots changed their attitudes: Decision Trees Enemies Allies Learning a Decision Tree • A computer game • A computer game • Alternative hypotheses • How to choose the best tree? • Learning a Decision Tree • Attribute importance • Choosing the test attribute • Choosing the test attribute (special case: binary classification) • Choosing the test attribute (example) • Choosing subsequent test attribute • Decision tree building procedure • Algorithm characteristics No obvious simple rule. Generalization and Overfitting How to build a decision tree discriminating the 2 robot classes? Broadening the Applicability of Desicion Trees Summary P. Poˇ s´ ık c � 2015 Artificial Intelligence – 8 / 29

Recommend


More recommend