Learning decision trees

Slides:



Advertisements
Similar presentations
Learning from Observations
Advertisements

Learning from Observations Chapter 18 Section 1 – 3.
ICS 178 Intro Machine Learning
Noise, Information Theory, and Entropy (cont.) CS414 – Spring 2007 By Karrie Karahalios, Roger Cheng, Brian Bailey.
DECISION TREES. Decision trees  One possible representation for hypotheses.
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
CPSC 502, Lecture 15Slide 1 Introduction to Artificial Intelligence (AI) Computer Science cpsc502, Lecture 15 Nov, 1, 2011 Slide credit: C. Conati, S.
Huffman code and ID3 Prof. Sin-Min Lee Department of Computer Science.
Data Compressor---Huffman Encoding and Decoding. Huffman Encoding Compression Typically, in files and messages, Each character requires 1 byte or 8 bits.
Final Exam: May 10 Thursday. If event E occurs, then the probability that event H will occur is p ( H | E ) IF E ( evidence ) is true THEN H ( hypothesis.
Learning Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Decision making in episodic environments
Machine Learning Group University College Dublin Decision Trees What is a Decision Tree? How to build a good one…
1 Huffman Codes. 2 Introduction Huffman codes are a very effective technique for compressing data; savings of 20% to 90% are typical, depending on the.
Learning from Observations Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 18 Fall 2005.
Cooperating Intelligent Systems
18 LEARNING FROM OBSERVATIONS
Learning From Observations
Learning from Observations Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 18 Fall 2004.
Induction of Decision Trees
Learning from Observations Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 18.
ICS 273A Intro Machine Learning
CSCE 580 Artificial Intelligence Ch.18: Learning from Observations
LEARNING DECISION TREES
Learning decision trees derived from Hwee Tou Ng, slides for Russell & Norvig, AI a Modern Approachslides Tom Carter, “An introduction to information theory.
Learning decision trees derived from Hwee Tou Ng, slides for Russell & Norvig, AI a Modern Approachslides Tom Carter, “An introduction to information theory.
ICS 273A Intro Machine Learning
Learning: Introduction and Overview
MACHINE LEARNING. What is learning? A computer program learns if it improves its performance at some task through experience (T. Mitchell, 1997) A computer.
CS 4700: Foundations of Artificial Intelligence
Induction of Decision Trees (IDT) CSE 335/435 Resources: – –
Machine learning Image source:
Fall 2004 TDIDT Learning CS478 - Machine Learning.
Machine Learning CPS4801. Research Day Keynote Speaker o Tuesday 9:30-11:00 STEM Lecture Hall (2 nd floor) o Meet-and-Greet 11:30 STEM 512 Faculty Presentation.
INTRODUCTION TO MACHINE LEARNING. $1,000,000 Machine Learning  Learn models from data  Three main types of learning :  Supervised learning  Unsupervised.
Inductive learning Simplest form: learn a function from examples
LEARNING DECISION TREES Yılmaz KILIÇASLAN. Definition - I Decision tree induction is one of the simplest, and yet most successful forms of learning algorithm.
Learning from observations
Learning from Observations Chapter 18 Through
CHAPTER 18 SECTION 1 – 3 Learning from Observations.
Lecture 7 : Intro to Machine Learning Rachel Greenstadt & Mike Brennan November 10, 2008.
Learning from Observations Chapter 18 Section 1 – 3, 5-8 (presentation TBC)
Learning from Observations Chapter 18 Section 1 – 3.
L6. Learning Systems in Java. Necessity of Learning No Prior Knowledge about all of the situations. Being able to adapt to changes in the environment.
Decision Trees. What is a decision tree? Input = assignment of values for given attributes –Discrete (often Boolean) or continuous Output = predicated.
Decision Trees Binary output – easily extendible to multiple output classes. Takes a set of attributes for a given situation or object and outputs a yes/no.
CSC 8520 Spring Paula Matuszek DecisionTreeFirstDraft Paula Matuszek Spring,
Chapter 18 Section 1 – 3 Learning from Observations.
Decision Tree. Classification Databases are rich with hidden information that can be used for making intelligent decisions. Classification is a form of.
Learning From Observations Inductive Learning Decision Trees Ensembles.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Anifuddin Azis LEARNING. Why is learning important? So far we have assumed we know how the world works Rules of queens puzzle Rules of chess Knowledge.
Decision Tree Learning CMPT 463. Reminders Homework 7 is due on Tuesday, May 10 Projects are due on Tuesday, May 10 o Moodle submission: readme.doc and.
Learning from Observations
Learning from Observations
Learning from Observations
DECISION TREES An internal node represents a test on an attribute.
Università di Milano-Bicocca Laurea Magistrale in Informatica
Introduce to machine learning
Decision Trees.
Presented By S.Yamuna AP/CSE
Ch9: Decision Trees 9.1 Introduction A decision tree:
Classification and Prediction
Decision making in episodic environments
Learning from Observations
Learning from Observations
Decision trees One possible representation for hypotheses
Decision Trees Jeff Storey.
Machine Learning: Decision Tree Learning
Decision Trees - Intermediate
Presentation transcript:

Learning decision trees derived from Hwee Tou Ng, slides for Russell & Norvig, AI a Modern Approach Tom Carter, “An introduction to information theory and Entropy” Roger Cheng, Karrie Karahalios, Brian Bailey, “Noise, Information Theory, and Entropy”

Learning decision trees Problem: decide whether to wait for a table at a restaurant, based on the following attributes: Alternate: is there an alternative restaurant nearby? Bar: is there a comfortable bar area to wait in? Fri/Sat: is today Friday or Saturday? Hungry: are we hungry? Patrons: number of people in the restaurant (None, Some, Full) Price: price range ($, $$, $$$) Raining: is it raining outside? Reservation: have we made a reservation? Type: kind of restaurant (French, Italian, Thai, Burger) WaitEstimate: estimated waiting time (0-10, 10-30, 30-60, >60)

Attribute-based representations Examples described by attribute values (Boolean, discrete, continuous) E.g., situations where I will/won't wait for a table: Classification of examples is positive (T) or negative (F)

Decision trees One possible representation for hypotheses E.g., here is the “true” tree for deciding whether to wait:

Expressiveness Decision trees can express any function of the input attributes. E.g., for Boolean functions, truth table row → path to leaf: Trivially, there is a consistent decision tree for any training set with one path to leaf for each example (unless f nondeterministic in x) but it probably won't generalize to new examples Prefer to find more compact decision trees

Hypothesis spaces How many distinct decision trees with n Boolean attributes? = number of Boolean functions of n arguments = number of distinct truth tables with 2n rows = 22n truth tables (since each row has 2 possible function values) E.g., with 6 Boolean attributes, there are 226 = 264 = 18,446,744,073,709,551,616 possible functions/trees

Choosing an attribute Aim: find a small tree consistent with the training examples by looking at attributes in sequence. Approach: (recursively) choose "most significant" attribute as root of (sub)tree, i.e., next attribute to consider. Idea: a good attribute splits the examples into subsets that are (ideally) all positive or all negative Patrons? is a better choice than Type?

Choosing an attribute (at a node) Cases There are no examples left. No such combination of attributes has been observed. Return a value calculated from the majority classification at the node’s parent. All the remaining examples are positive (or all negative). We are done; can answer Yes or No. There are examples (both positive and negative) left but no attributes. The remaining examples are identical (according to the available attributes). So these attributes are insufficient to answer the question. The main case: there are some positive and some negative examples, choose the best attribute to split them, e.g., Patrons?

Decision tree learning function DTL(examples, attributes) returns a decision tree best  Choose-Attribute(attributes, examples) tree  a new decision tree with root best for each value vi of best do examplesi  { elements of examples with best = vi } if examplesi is empty then add a leaf to tree with branch label vi with value Mode(examples) attributesi  attributes – {best} If attributesi is empty or all examplesi have the same classification then add a leaf to tree with branch label vi with value Mode(examplesi) else add DTL(examplesi, attributesi) as a child of tree with label vi return tree How to choose the best attribute on which to split? Choose the one that provides the most information. How to measure information?

Information theory We want an information measure I(p) to have these properties: Information is a non-negative quantity: I(p) ≥ 0. If an event has probability 1, we get no information from the occurrence of the event: I(1) = 0. If two independent events occur (whose joint probability is the product of their individual probabilities), then the information we get from observing the events is the sum of the two informations: I(p1 ∗ p2) = I(p1) + I(p2). (This is the critical property.) We want our information measure to be a continuous (and, in fact, monotonic) function of the probability. Slight changes in probability should result in slight changes in information.

Information theory The preceding implies that: I(pa) = a ∗ I(p) From this, we can derive the nice property: I(p) = − logb(p) = logb (1/p) for some base b. Since p ≤ 1, logb(p) < 0. So1/p ≥ 1 and , logb(p) < 0. If b = 2, then the value is in bits.

Use information theory to implement Choose-Attribute Information content (also known as entropy): I(p(v1), … , p(vn)) = Σi=1 -p(vi) log2 p(vi) where p(vi) is the probability of value vi For a training set containing p positive examples and n negative examples: Note: since p/(p+n) < 1, log2 p/(p+n) < 0. Note: if either p or n is zero, the other is 1 (no information). Hence I(p/(p+n), n/(p+n)) = 0. Note: if p = n, I(½, ½) = 2*(½)*log2(2) = 1.

Use information theory to implement Choose-Attribute I(p(v1), … , p(vn)) is the number of bits needed to characterize the typical element. In our case: yes or no. For the training set, p = n = 6,

Information gain A chosen attribute Aj divides the training set E into subsets E1, … , Ev according to their values for Aj, where Aj has v distinct values. This is the weighted sum of the information in the subnodes. Information Gain (IG) (or reduction in entropy) from the attribute test: entropy of node – entropy of subnodes Choose the attribute Aj with the largest IG, i.e., where the weighted sum of the entropies in the remaining subnodes is smallest, i.e., least amount of entropy left. j

Information gain For the training set, p = n = 6, Consider the attributes Patrons and Type (and others too): Patrons has the highest IG of all attributes and so is chosen by the DTL algorithm as the root

Attribute-based representations Examples described by attribute values (Boolean, discrete, continuous) E.g., situations where I will/won't wait for a table: Classification of examples is positive (T) or negative (F) 16

Example contd. Decision tree derived from the 12 examples: Substantially simpler than “true” tree---a more complex hypothesis isn’t justified by small amount of data Not a very logical tree!

Original “true” tree

Extras

Summary Learning needed for unknown environments, lazy designers Learning agent = performance element + learning element For supervised learning, the aim is to find a simple hypothesis approximately consistent with training examples Decision tree learning using information gain Learning performance = prediction accuracy measured on test set

Decision tree learning How to choose the best attribute on which to split? Choose the one that gives us the most information. How to measure information?

Performance measurement How do we know that h ≈ f ? Use theorems of computational/statistical learning theory Try h on a new test set of examples (use same distribution over example space as training set) Learning curve = % correct on test set as a function of training set size

Example Assume alphabet K of {A, B, C, D, E, F, G, H} In general, if we want to distinguish n different symbols, we will need to use, log2n bits per symbol, i.e. 3 since there are 8 symbols. Can code alphabet K as: A 000 B 001 C 010 D 011 E 100 F 101 G 110 H 111

Example “BACADAEAFABBAAAGAH” is encoded as the string of 54 bits 001000010000011000100000101000001001000000000110000111 (fixed length code)

A (8), B (3), C(1), D(1), E(1), F(1), G(1), H(1) Example But since the letters don’t appear equally often, can create a more efficient code. A (8), B (3), C(1), D(1), E(1), F(1), G(1), H(1) With this coding: A 0 B 100 C 1010 D 1011 E 1100 F 1101 G 1110 H 1111 100010100101101100011010100100000111001111 42 bits, saves more than 20% in space

Huffman Tree A (8), B (3), C(1), D(1), E(1), F(1), G(1), H(1)