1 / 51

Cooperating Intelligent Systems

Cooperating Intelligent Systems. Learning from observations Chapter 18, AIMA. Two types of learning in AI. Deductive : Deduce rules/facts from already known rules/facts. (We have already dealt with this) Inductive : Learn new rules/facts from a data set D.

dea
Download Presentation

Cooperating Intelligent Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cooperating Intelligent Systems Learning from observations Chapter 18, AIMA

  2. Two types of learning in AI Deductive: Deduce rules/facts from already known rules/facts. (We have already dealt with this) Inductive: Learn new rules/facts from a data set D. We will be dealing with the latter, inductive learning, now

  3. Two types of inductive learning Supervised: The machine has access to a teacher who corrects it. Unsupervised: No access to teacher. Instead, the machine must search for “order” and “structure” in the environment.

  4. Inductive learning - example A Etc... • f(x) is the target function • An example is a pair [x, f(x)] • Learning task: find a hypothesish such that h(x) f(x) given a training set of examples D = {[xi, f(xi) ]}, i = 1,2,…,N Inspired by a slide from V. Pavlovic

  5. Inductive learning – example B Inconsistent linear fit.Consistent 6th orderpolynomial fit. Consistent sinusoidal fit Consistent linear fit Consistent 7th order polynomial fit • Construct h so that it agrees with f. • The hypothesis h is consistent if it agrees with f on all observations. • Ockham’s razor: Select the simplest consistent hypothesis. • How achieve good generalization?

  6. y x Inductive learning – example C Example from V. Pavlovic @ Rutgers

  7. y x Inductive learning – example C Example from V. Pavlovic @ Rutgers

  8. y x Inductive learning – example C Example from V. Pavlovic @ Rutgers

  9. y x Inductive learning – example C Sometimes a consistent hypothesis is worse than an inconsistent Example from V. Pavlovic @ Rutgers

  10. f(x) Error H hopt(x) H The idealized inductive learning problem Find appropriate hypothesis spaceHandfindh(x)  Hwith minimum “distance” tof(x)(“error”) Our hypothesis space The learning problem is realizable if f(x) ∈H.

  11. Egen {f(x)} H {hopt(x)} The real inductive learning problem Find appropriate hypothesis spaceHand minimize the expected distance tof(x)(“generalization error”) Data is never noise free and never available in infinite amounts, so we get variation in data and model. The generalization error is a function of both the training data and the hypothesis selection method.

  12. Hypothesis spaces (examples) f(x) = 0.5 + x + x2 + 6x3 H1 H2 H3 H1 H2 H3 H1={a+bx}; H2={a+bx+cx2}; H3={a+bx+cx2+dx3}; Linear; Quadratic; Cubic;

  13. Learning problems • The hypothesis takes as input a set of attributes x and returns a ”decision” h(x) = the predicted (estimated) output value for the input x. • Discrete valued function ⇒ classification • Continuous valued function ⇒ regression

  14. Classification Order into one out of several classes Input space Output (category) space

  15. Example: Robot color vision Classify the Lego pieces into red, blue, and yellow. Classify white balls, black sideboard, and green carpet. Input = pixel in image, output = category

  16. Regression The “fixed regressor model” xObserved input f(x)Observed output g(x)True underlying function eI.I.Dnoise process with zero mean

  17. Example: Predict price for cotton futures Input: Past historyof closing prices,and trading volume Output: Predictedclosing price

  18. Decision trees • “Divide and conquer”: Split data into smaller and smaller subsets. • Splits usually on a single variable x1 > a ? no yes x2 > b ? x2 > g ? no yes no yes

  19. The wait@restaurant decision tree This is our true function.Can we learn this tree from examples?

  20. Inductive learning of decision tree • Simplest: Construct a decision tree with one leaf for every example = memory based learning.Not very good generalization. • Advanced: Split on each variable so that the purity of each split increases (i.e. either only yes or only no) • Purity measured,e.g, with entropy

  21. Inductive learning of decision tree • Simplest: Construct a decision tree with one leaf for every example = memory based learning.Not very good generalization. • Advanced: Split on each variable so that the purity of each split increases (i.e. either only yes or only no) • Purity measured,e.g, with entropy

  22. Inductive learning of decision tree • Simplest: Construct a decision tree with one leaf for every example = memory based learning.Not very good generalization. • Advanced: Split on each variable so that the purity of each split increases (i.e. either only yes or only no) • Purity measured,e.g, with entropy General form:

  23. The entropy is maximal whenall possibilities are equallylikely. The goal of the decision treeis to decrease the entropy ineach node. Entropy is zero in a pure ”yes”node (or pure ”no” node). Entropy is a measure of ”order” in asystem. The second law of thermodynamics: Elements in a closed system tend to seek their most probable distribution; in a closed system entropy always increases

  24. Decision tree learning algorithm • Create pure nodes whenever possible • If pure nodes are not possible, choose the split that leads to the largest decrease in entropy.

  25. Decision tree learning example 10 attributes: • Alternate: Is there a suitable alternative restaurant nearby? {yes,no} • Bar: Is there a bar to wait in? {yes,no} • Fri/Sat: Is it Friday or Saturday? {yes,no} • Hungry: Are you hungry? {yes,no} • Patrons: How many are seated in the restaurant? {none, some, full} • Price: Price level {$,$$,$$$} • Raining: Is it raining? {yes,no} • Reservation: Did you make a reservation? {yes,no} • Type: Type of food {French,Italian,Thai,Burger} • Wait: {0-10 min, 10-30 min, 30-60 min, >60 min}

  26. Decision tree learning example T = True, F = False 6 True, 6 False

  27. Decision tree learning example Alternate? Yes No 3 T, 3 F 3 T, 3 F Entropy decrease = 0.30 – 0.30 = 0

  28. Decision tree learning example Bar? Yes No 3 T, 3 F 3 T, 3 F Entropy decrease = 0.30 – 0.30 = 0

  29. Decision tree learning example Sat/Fri? Yes No 2 T, 3 F 4 T, 3 F Entropy decrease = 0.30 – 0.29 = 0.01

  30. Decision tree learning example Hungry? Yes No 5 T, 2 F 1 T, 4 F Entropy decrease = 0.30 – 0.24 = 0.06

  31. Decision tree learning example Raining? Yes No 2 T, 2 F 4 T, 4 F Entropy decrease = 0.30 – 0.30 = 0

  32. Decision tree learning example Reservation? Yes No 3 T, 2 F 3 T, 4 F Entropy decrease = 0.30 – 0.29 = 0.01

  33. Decision tree learning example Patrons? None Full Some 2 F 2 T, 4 F 4 T Entropy decrease = 0.30 – 0.14 = 0.16

  34. Decision tree learning example Price $ $$$ $$ 3 T, 3 F 1 T, 3 F 2 T Entropy decrease = 0.30 – 0.23 = 0.07

  35. Decision tree learning example Type French Burger 1 T, 1 F 2 T, 2 F Italian Thai 1 T, 1 F 2 T, 2 F Entropy decrease = 0.30 – 0.30 = 0

  36. Decision tree learning example Est. waitingtime 0-10 > 60 4 T, 2 F 2 F 10-30 30-60 1 T, 1 F 1 T, 1 F Entropy decrease = 0.30 – 0.24 = 0.06

  37. X? Decision tree learning example Largest entropy decrease (0.16)achieved by splitting on Patrons. Patrons? None Full Some 2 F 2 T, 4 F Continue like this, making new splits, always purifying nodes. 4 T

  38. Decision tree learning example Induced tree (from examples)

  39. Decision tree learning example True tree

  40. Decision tree learning example Induced tree (from examples) Cannot make it more complexthan what the data supports.

  41. How do we know it is correct? How do we know that h  f ? (Hume's Problem of Induction) • Try hon a new test setof examples(cross validation) ...and assume the ”principle of uniformity”, i.e. the result we get on this test data should be indicative of results on future data. Causality is constant. Inspired by a slide by V. Pavlovic

  42. Learning curve for the decision tree algorithm on 100 randomlygenerated examples in the restaurant domain.The graph summarizes 20 trials.

  43. Cross-validation Use a “validation set”. Split your data set into two parts, one for training your model and the other for validating your model. The error on the validation data is called “validation error” (Eval) Dtrain Dval Eval

  44. K-Fold Cross-validation More accurate than using only one validation set. Dtrain Dval Dtrain Dval Dtrain Dval Dtrain Eval(3) Eval(1) Eval(2)

  45. PAC • Any hypothesis that is consistent with a sufficiently large set of training (and test) examples is unlikely to be seriously wrong; it is probably approximately correct (PAC). • What is the relationship between the generalization error and the number of samples needed to achieve this generalization error?

  46. instance space X h f f and h disagree The error X = the set of all possible examples (instance space). D = the distribution of these examples. H = the hypothesis space (hH). N = the number of training data. Image adapted from F. Hoffmann @ KTH

  47. Probability for bad hypothesis Suppose we have a bad hypothesis h with error(h) > e. What is the probability that it is consistent with N samples? • Probability for being inconsistent with one sample = error(h) > e. • Probability for being consistent with one sample = 1 – error(h) < 1 – e. • Probability for being consistent with Nindependently drawn samples < (1 – e)N.

  48. Probability for bad hypothesis What is the probability that the set Hbad of bad hypotheses with error(h) > e contains a consistent hypothesis?

  49. Probability for bad hypothesis What is the probability that the set Hbad of bad hypotheses with error(h) > e contains a consistent hypothesis? If we want this to be less than some constant d, then

  50. Don’t expect to learn very well if H is large Probability for bad hypothesis What is the probability that the set Hbad of bad hypotheses with error(h) > e contains a consistent hypothesis? If we want this to be less than some constant d, then

More Related