1 / 63

Intro to Knowledge Based Systems

Intro to Knowledge Based Systems. CS 343 Elaine Rich. The Key Issues. What knowledge do we need? How can it be represented? How can we reason with it? Where does it come from? Our sandbox: Question answering. Stating the Facts. Painter(Leonardo) Composer(Palistrina) Country(Italy)

stevie
Download Presentation

Intro to Knowledge Based 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. Intro to Knowledge Based Systems CS 343 Elaine Rich

  2. The Key Issues • What knowledge do we need? • How can it be represented? • How can we reason with it? • Where does it come from? • Our sandbox: • Question answering

  3. Stating the Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Question: Name a painter ?Painter(x) Leonardo/xBind x to Leonardo and we have an answer

  4. Adding More Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) Painter(Rubens) Lived-In(Rubens, Europe) Question: Name an Italian painter.

  5. Adding More Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) Painter(Rubens) Lived-In(Rubens, Europe) Question: Name an Italian painter. ?Painter(x)  Lived-In(x, Italy)

  6. Adding More Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Question: Name a painter who lived in a moderate climate.

  7. Adding More Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  Climate(y, moderate)

  8. Adding More Facts Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  In(y, z)  Climate(z, moderate)

  9. Adding More Facts Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Painter(Rubens) Lived-In(Rubens, Europe) Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  In(y, z)  Climate(z, moderate)

  10. Making the KB More Flexible Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Painter(Rubens) Lived-In(Rubens, Europe) x,y ((In(x, y)  Climate(y, moderate))  Climate(x, moderate)) Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  Climate(y, moderate)

  11. Another Way to Do It Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Painter(Rubens) Lived-In(Rubens, Europe) x,y,z ((Lived-In(x, y)  In(y, z))  Lived-In(x, z)) Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  Climate(y, moderate)

  12. But We Still Haven’t Said it All Painter(Leonardo) Town(Anchiano) Country(Italy) Born-In(Leonardo, Anchiano) In(Anchiano, Italy) In(Italy, Europe) x,y,z ((Born-In(x, y)  In(y, z))  Born-In(x, z)) Question: Was Leonardo born in Europe? ?Born-In(Leonardo, Europe)

  13. Describing “in” More Generally Painter(Leonardo) Town(Anchiano) Country(Italy) Born-In(Leonardo, Anchiano) In(Anchiano, Italy) In(Italy,Europe) x,y,z ((Born-In(x, y)  In(y, z))  Born-In(x, z)) Question: Is Anchiano in Europe? ?In(Anchiano, Europe)

  14. Describing “in” More Generally Painter(Leonardo) Town(Anchiano) Country(Italy) Born-In(Leonardo, Anchiano) In(Anchiano, Italy) In(Italy,Europe) x,y,z ((Born-In(x, y)  In(y, z))  Born-In(x, z)) x,y,z ((In(x, y)  In(y, z))  In(x, z)) Question: Is Anchiano in Europe? ?In(Anchiano, Europe)

  15. But We Still Haven’t Said Everything about “in” Country(Italy) Person(Mike) Visited(Mike, Italy) In(Italy, Europe) Question: Name someone who visited Europe. ?Person(x)  Visited(x, Europe)

  16. But We Still Haven’t Said Everything about “in” Country(Italy) Person(Mike) KnowsThePopulationOf(Mike, Italy) In(Italy, Europe) Question: Name someone who knows the population of Europe. ?Person(x)  KnowsThePopulationOf(x, Europe)

  17. Predicate Names Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Question: Name a painter who once lived. ?Painter(x)  Lived(x)

  18. The Perils of Long Predicate Names BearOfVerySmallBrain(Pooh)

  19. The Perils of Long Predicate Names BearOfVerySmallBrain(Pooh) Name a bear. Is Pooh silly?

  20. The Perils of Long Predicate Names BearOfVerySmallBrain(Pooh) b (BearOfVerySmallBrain(b)  silly(b)) Name a bear. Is Pooh silly?

  21. Doing it Right 1. Pooh is a bear; Bears are animals; animals are objects, etc.                  Bear(Pooh)                  b (Bear(b)  Animal(b) )                 a (Animal(a)  Object(a))2. Pooh has a very small brain.                  size(Brain(Pooh)) = very(small)3. Brains are parts of animals; an animal has only one.         a, b (Brain(a) = b animal(a)  brain(b)  haspart(a,b))4. Animals with brains that are small (or below) are silly.                 a (Size(Brain(a))  small  silly(a))5. Every object has a size.  Sizes are on a scale from Tiny to Huge. x (object(x)  s (size(x) = s))                 Tiny < Small < Medium < Large < Huge                  -2  <  -1   <    0   <   1   <  26. The function Very maps a point on a scale to a more extreme value: either positive or negative.        x (magnitude(Very(x)) > x  sign(Very(x)) = sign(x) )

  22. Implementing The Reasoning Engine • Building a theorem prover • Unification • Representing the facts so they are easy to use • An inference procedure that is sound and complete • Search algorithm • Adding other structure to support common operations

  23. Reasoning Forward (1) Painter(Leonardo) (2) Lived-In(Leonardo, Italy) (3) In(Italy,Europe) (4) Climate(Europe, moderate) (5) x,y ((In(x, y)  Climate(y, moderate) ) Climate(x, moderate)) (6) x (Climate(x, moderate)  GrowsIn(x, boxwood)) Question: ?Painter(x)  Lived-In(x,y)  GrowsIn(y, boxwood) Reasoning forward: Italy/x, Europe/y in (5): (7) (In(Italy, Europe)  Climate(Europe, moderate)) Climate(Italy, moderate) Italy/x in (6): (8) Climate(Italy, moderate) GrowsIn(Italy, boxwood) Leonardo/x, Italy/y in (the question): Painter(Leonardo)  Lived-In(Leonardo, Italy)  GrowsIn(Italy, boxwood)

  24. Reasoning Backward Painter(x)  Lived-In(x,y)  GrowsIn(y, boxwood) Napolean/x,France/y Rivera/x Painter(Napolean)  GrowsIn(France,boxwood) Leonardo/x Lived-In(Rivera,y)  GrowsIn(y, boxwood) Lived-In(Leonardo,y)  GrowsIn(y, boxwood) Italy/y GrowsIn(Italy, boxwood) Climate(Italy, moderate) In(Italy, Europe) Climate(Europe, moderate)

  25. Unification A fundamental operation in both of these processes is matching. In propositional logic, matching is trivial: Example: Prove Q  W given: P P  Q W Q  W Q P True

  26. Unification But in FOL, it is not so trivial. What should we do about: x, y (Lived-In(x, y)) Lived-In(Leonardo, Italy) Or: x (P(x, x)) P(Leonardo, Leonardo) P(Leonardo, Rubens) Or: x (P(x, FatherOf(x))) P(Leonardo, Rubens)

  27. Unification The term unification is used for a variety of matching processes: Typically two expressions “unify” if they can be about the same individual. In other words they are consistent. x, y (Lived-In(x, y)) Lived-In(Leonardo, Italy) Or: x (P(x, x)) P(Leonardo, Leonardo) P(Leonardo, Rubens)

  28. Unification Is Used With Other Representational Systems, e.g., Grammars John likes Coke. * John like Coke. * I likes Coke. [NUMBER SG]  [NUMBER SG] = [NUMBER SG] [NUMBER SG]  [NUMBER PL] Fails [NUMBER SG]  [NUMBER [] ] = [NUMBER SG] [NUMBER SG]  [PERSON 3 ] = NUMBER SG PERSON 3 Two feature structures can be unified if there is no conflict between them.

  29. Adding Unification to Grammar Rules The rule S  NP VP [CAT S HEAD [1] STRUCT [SUBJECT [A1] VP [A2] ] ]  A1: [CAT NP AGREEMENT [2]: [] ] A2: [CAT VP HEAD [1] AGREEMENT [2] ] Note: The STRUCT feature is used here to record the tree structure of the constituents as they are produced.

  30. Applying the Grammar Rule This rule says that we can build an S from two components, A1 and A2. To apply this rule to two candidate components X and Y, the parser must: Copy the rule structure to create a new instance of S. (Unification is destructive and we’ll need to be able to reuse the rule.) Unify the feature structure of X with the specification for A1 on the right side of the rule. This will succeed if the CAT of X unifies with NP, and if it succeeds, it will bind [2] to the AGREEMENT structure of X and A1 to X. Unify the feature structure of Y with the specification for A2 on the right side of the rule. This will succeed if the CAT of Y unifies with VP and if the AGREEMENT structure of Y unifies with [2], namely the agreement structure of X. If it succeeds, it will bind [1] to the HEAD feature of Y and A2 to Y.

  31. Example of Applying the Rule A1: [CAT NP HEAD dogs STRUCT [NOM dogs] AGREEMENT [NBR PL PERS 3] ] A2: [CAT VP HEAD ran STRUCT [V ran] AGREEMENT [] ]  [CAT S HEAD [ran] STRUCT [SUBJECT [CAT NP HEAD dogs STRUCT [NOM dogs] AGREEMENT [2]: [NBR PL PERS 3] ] VP [CAT VP HEAD ran STRUCT [V ran] AGREEMENT [2] ] ] ]

  32. Search Painter(x)  Lived-In(x,y)  Climate(y, moderate) Leonardo/x Rubens/x Sargent/x America/y Europe/y Italy/y Japan/y Europe/y Italy/y Japan/y Which search algorithm should we use?

  33. Object-Oriented Representations • We can constrain the search by: • Organizing the facts in ways that reflect how they are likely to be used. • Taking advantage of the fact that some specific kinds of inference are very powerful. It may be possible to limit the kinds of facts that can be expressed and still retain enough power while, at the same time, increasing efficiency.

  34. Alternatives to a Flat List of Facts Painter(Leonardo) Composer(Palistrina) x (Painter(x)  Artist(x)) x (Composer(x)  Artist(x)) x (Artist(x)  Temperamental(x)) x (Person(x)  y Mother-Of(x, y)) x (Person(x)  Likes(x, x)) Country(Italy) Lived-In(Leonardo, Italy) In(Italy, Europe) Climate(Europe, moderate) x,y ((In(x, y)  Climate(y, moderate))  Climate(x, moderate)) We present the facts as a flat list. There’s no built in grouping, as, for example, all the things we know about Palistrina.

  35. Frame Systems Organize the facts around the objects in the KB. • (*Leonardo instance-of Painter) • (*Leonardo has (lived-in (*Italy))) • (showme *Leonardo) • (*Leonardo has (instance-of (Painter)) • (lived-in (*Italy)))

  36. Classes, Instances, and Slots • In a frame system, there are three fundamental kinds of objects: • Instances, e.g., Palistrina, Italy • Classes, e.g., Artist, Person, Country, Thing, Event • Slots, which capture the relationships among instances and classes. Examples: instance-of, lived-in, superclasses, parts

  37. Classes The backbone of any frame system is a hierarchy of classes, from which properties can be inherited. Most modern frame systems support multiple inheritance. Thing Living-thing Person Artist Italian Painter *Leonardo

  38. Ontologies Ontology is the study of what exists. An ontology, as used in AI, is a definition of a set of classes of things that exist, typically augmented with relationships among them.

  39. Ontologies Thing Entity Event State ChickenNoodleSoup The top part is often called an “upper ontology”.

  40. Tweety Facts about individuals and categories represented in FOL: All robins are birds All birds have two wings All birds lay eggs All robins have red breasts Tweety is a robin x ((robin(x) bird(x)) x (bird(x)yz (haspart (x, y) wing(y) wing (z) haspart(x,z) y  z)) x (bird (x) birthmode(x, eggs)) x (robin (x) color(breast (x), red)) robin (Tweety) Other kinds of facts represented in FOL: Red breasted birds are easily visible x bird(x)  color(breast(x), red)  visible(x)

  41. The Facts in a Frame System eggs birds has-part wings birthmodehas-partIS-A IS-A IS-A wing1 wing2 robins instance-of Tweety Early representation systems like this were called semantic nets. They evolved into frame systems that allow richer representations that may be harder to view graphically.

  42. Why are Classes and Instances Special? • Logically, they are not. (At least not yet.) • But it may be useful to represent them differently because: • Indexing facts by classes may help the inference engine find useful facts quickly. • Organizing facts by classes may make it easier for people to enter knowledge. • Some facts apply to the classes themselves. • Some kinds of reasoning arise naturally from class membership.

  43. Inheritance Some specific kinds of reasoning are especially useful. Painter(Leonardo) x Artist(x)  Temperamental(x)

  44. Inheritance Some specific kinds of reasoning are especially useful. Painter(Leonardo) x Artist(x)  Temperamental(x) x Painter(x)  Artist(x)

  45. Inheritance Some specific kinds of reasoning are especially useful. Painter(Leonardo) x Artist(x)  Temperamental(x) x Painter(x)  Artist(x) Person is-a Artist is-a Painter instance-of Leonardo

  46. What About Slots and Their Values? • When frames are a just way of indexing FOL expressions to improve efficiency. • Localizing the search • Specifying forward vs. backward reasoning (Country (Climate x (IF-NEEDED ((In SELF y)  (Climate y z)  (x := z))))) (Continent (Climate x (IF-ADDED ((IN y SELF)  Climate(y, x)))))

  47. What About Slots and Their Values? • When frames are a just way of indexing FOL expressions to improve efficiency. • Localizing the search • Specify forward vs. backward reasoning • When frames are a way of indexing procedures. • Arbitrary procedures (Continent (Population x (IF-NEEDED (Sum-Pops-of-Countries)))) We can’t reason about what goes on inside the procedure. • A procedural implementation of inheritance

  48. How Inheritance is Implemented Can Matter • Reasoning in FOL is monotonic. • But inheritance may not be: • Tweety is a bird. • Birds fly. • Does Tweety fly?

  49. Implementing Inheritance birds canfly T ISAISA robins ostriches canfly F Instance-of Instance-of Tweety Richy More on nonmonotonic reasoning later.

  50. Multiple Inheritance Person subclass subclass pacifist pacifist Quaker Republican FALSE TRUE instance instance Person

More Related