1、智能计算研究中心Learning from Observations(chapter18)Autumn 2012Instructor: Wang XiaolongHarbin Institute of Technology, Shenzhen Graduate SchoolIntelligent Computation Research Center(HITSGS ICRC)2Outlines Learning agents Inductive learning Decision tree learning Measuring learning performance3Learning Lea
2、rning is essential for unknown environments, i.e., when designer lacks omniscience Learning is useful as a system construction method, i.e., expose the agent to reality rather than trying to write it down Learning modifies the agents decision mechanisms to improve performance4Learning agents5Learnin
3、g element Design of a learning element is affected by Which components of the performance element are to be learned What feedback is available to learn these components What representation is used for the components Type of feedback: Supervised learning: involves learning a function from examples of
4、 its input and outputs. Unsupervised learning: involves learning patterns in the input when no specific output values are supplied. Reinforcement learning: learn from rewards (reinforcement)6Inductive learning Simplest form: learn a function from examplesf is the target functionAn example is a pair
5、(x, f(x)Problem: find a hypothesis hsuch that h fgiven a training set of examples(This is a highly simplified model of real learning: Ignores prior knowledge Assumes examples are given)7Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on
6、 all examples)E.g., curve fitting:8Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on all examples)E.g., curve fitting:9Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on a
7、ll examples)E.g., curve fitting:10Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on all examples)E.g., curve fitting:11Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on a
8、ll examples)E.g., curve fitting:12Inductive learning methodConstruct/adjust h to agree with f on training set(h is consistent if it agrees with f on all examples)E.g., curve fitting:Ockhams razor: prefer the simplest hypothesis consistent with data - In Latin, it means “Entities are not to be multip
9、lied beyond necessity”13Learning decision treesProblem: decide whether to wait for a table at a restaurant, based on the following attributes:1.Alternate: is there an alternative restaurant nearby?2.Bar: is there a comfortable bar area to wait in?3.Fri/Sat: is today Friday or Saturday?4.Hungry: are
10、we hungry?5.Patrons: number of people in the restaurant (None, Some, Full)6.Price: price range ($, $, $)7.Raining: is it raining outside?8.Reservation: have we made a reservation?9.Type: kind of restaurant (French, Italian, Thai, Burger)10. WaitEstimate: estimated waiting time (0-10, 10-30, 30-60, 6
11、0)14Attribute-based representationsExamples described by attribute values (Boolean, discrete, continuous)E.g., situations where I will/wont wait for a table:Classification of examples is positive (T) or negative (F)15Decision treesOne possible representation for hypothesesE.g., here is the “true” tr
12、ee for deciding whether to wait:16ExpressivenessDecision 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 nondeterminis
13、tic in x) but it probably wont generalize to new examplesPrefer to find more compact decision trees17Hypothesis spacesHow many distinct decision trees with n Boolean attributes?= number of Boolean functions= number of distinct truth tables with 2n rows = 22nE.g., with 6 Boolean attributes, there are
14、 18,446,744,073,709,551,616 treesMore expressive hypothesis space increases chance that target function can be expressed increases number of hypotheses consistent with training set may get worse predictions18Decision tree learningAim: find a small tree consistent with the training examplesIdea: (rec
15、ursively) choose most significant attribute as root of (sub)tree19Choosing an attribute Idea: a good attribute splits the examples into subsets that are (ideally) all positive or all negativePatrons? is a better choice20Using information theoryInformation answers questionsThe more clueless I am abou
16、t the answer initially, the more information is contained in the answerInformation Content (Entropy):I(P(v1), , P(vn) = i=1 -P(vi) log2 P(vi)For a training set containing p positive examples and n negative examples:npnnpnnppnppnpnnppI22loglog),(21Information gainA chosen attribute A divides the trai
17、ning set E into subsets E1, , Ev according to their values for A, where A has v distinct values.Information Gain (IG) or reduction in entropy from the attribute test:Choose the attribute with the largest IGviiiiiiiiinpnnppInpnpAremainder1),()()(),()(AremaindernpnnppIAIG22Information gainFor the trai
18、ning set, p = n = 6, I(6/12, 6/12) = 1 bitConsider 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 rootbits 0)42,42(124)42,42(124)21,21(122)21,21(1221)(bits 0541.)64,62(126)0 , 1 (124) 1 , 0(1221)(IIIITypeIGII
19、IPatronsIG23Example contd. Decision tree learned from the 12 examples: Substantially simpler than “true” tree-a more complex hypothesis isnt justified by small amount of data24Performance measurementHow do we know that h f ?1. Use theorems of computational/statistical learning theory2. Try h on a ne
20、w 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 size25SummaryLearning needed for unknown environments, lazy designersLearning agent = performance element + learning elementFor supervised learning, the aim is to find a simple hypothesis approximately consistent with training examplesDecision tree learning using information gain Learning performance = prediction accuracy measured on test set26Assignments Ex 18.3