Presentation on theme: "1 Knowledge Representation Representing Common Sense Knowledge MSc Decision Support Notes 2."— Presentation transcript:
1 Knowledge Representation Representing Common Sense Knowledge MSc Decision Support Notes 2
2 How to represent advice? Memory? Plans? Common Sense? What’s this Or this How many legs does the man have? The tortoise? –How do you know? Is it in the picture?
3 How to answer a question? Help - my laser printer doesn’t work? –Is it plugged in? Is the power on at the wall? –Is it connected to the computer? –Does it have paper? –Does it print a test sheet? –Have you turned everything off, turned on the printers, then rebooted the computer?
4 How to understand a story John went into the restaurant. He sat down. When the waiter came he ordered a pizza. He waited for forty minutes. Finally, he got up and left. The waiter rushed after him very angry. John was also very angry. –Why was John angry? Why was the waiter angry? –How do you know?
5 Two parts to most knowledge representations Knowledge of the things in the world and how the relate –The “Ontology” or “Static knowledge” Semantic Nets, Frames, Description Logics, Conceptual Graphs,… –BEWARE “The ‘O’ word” “Ontology” means different things to different people –Declarative Logic like Knowledge of what to do and how –The “Operational knowledge” Rules, Problem Solving Methods, Methods, Operations… –Procedural Program like or Condition-Action rules –Usually “Heuristic”
6 NB: Real “Expertise” is different Tacit, automatic, semi-conscious Experts may reconstruct an explanation but can rarely explain what they do –See Johnson papers on “Links”
7 Classic Knowledge Based Systems Knowledge base –Typically in “Frames” The problem solving methods or “Heuristics” –Typically in “Rules”
8 by the way… vocabulary… “Algorithms” & “Heuristics” Algorithms – methods guaranteed to do something –Guaranteed to get an answer –Example: Long division, manual extraction of a square root, ‘exhaustive chess algorithm’ –Never need more than one for any one problem –May take a very long (age of universe n ) time We will return to topic when we discuss ontologies, OWL, and description logics Heuristics – rules of thumb for doing things –Often work, but may not –A good heuristic either gets the right answer or fails –Usually apply several to each problem to give a high probability that one will work –Usually chosen to be relatively quick
9 The knowledge base How to represent the things in the world and their relationships –Or more accurately: our conceptualisation of the things in the world & their relationships –The starting metaphor was to explain our memory –How might we represent the knowledge we need to understand the restaurant story?
10 Memory and Association Customer Restaurant Food Money Waiter Hunger Anger Boredom
11 Semantic Net - Label the arcs Hunger Anger Boredom Customer Restaurant Food Money Waiter has Pays to Works for causes has Serves food Takes order has
12 Add the classes Customer Restaurant Food Money Waiter Hunger Anger Boredom has Pays to Works for has causes has Serves food Takes order has Person Emotion Thing Organisa- tion
13 A Real Example: Use cases from UK Drug Messages
14 From Evans & Patel, Cog Sci in Biomedicine pg 72
15 It’s getting messy! What do all those lines mean? Can we find a better way to write it down? Frames are one systematic way to write down semantic nets –Formalised by the language KL-ONE Re-formalised as “Description Logics” –Being restandardised as OIL: (Ontology Inference Layer) - new proposed interchange language DAML+OIL or “OWL” www.w3.org/2001/sw/WebOnt/ http://oiled.man.ac.uk/ www.ontoknowledge.org/oil (click here) www.w3.org/2001/sw/WebOnt/ http://oiled.man.ac.uk/(click here) Other more formal ways are: –Conceptual graphs (click here) (click here) A complete alternative notation for logic –John Sowa http://www.bestweb.net/~sowa/direct/jfsbio.htm http://www.bestweb.net/~sowa/direct/jfsbio.htm
16 Frames May be regarded as –A knowledge representation formalism –A way of writing down semantic networks –A set of data structures –A housekeeping trick No real standards –Grew up informally –Much confusion of vocabulary and notation Hence the development of detailed standards with different names
17 Basic ideas Types/ classes –The categories of things that are: Analogous to sets Best expressed as plurals but usually written as singular –Mammal, Dog, Bottle Instances / objects –The things themselves Analogous to members of sets best expressed as singular, or with ‘the’ or ‘this’ or ‘these’, etc. –Fido, This bottle of milk
18 Basic ideas A hierarchy of classes –LivingThings Animals Mammals Dogs Golden Retrievers Sansue Golden Retrievers Sansue Golden Retrievers from the Phoenix line... Instances Mia is-instance-of Sansu Golden Retrievers Mammals is-kind-of of Animals
19 Basic ideas Types/ classes Subclasses linked to classes by “is-kind-of” / “specialises” / “is subsumed by” “ako” (“is kind of”) Classes linked to subclasses by “has-kind” / “subsumes” / “is generalisation of” Dog is-kind-of Mammal is-kind-of Vertebrate is-kind-of Animal Animal subsumes Vertebrate subsumes Mammal subsumes Dog Individuals/ Instances / objects Instances linked to types by “is-instance-of” –BEWARE “is-a” may mean “is-instance-of” or “is-kind-of” depending on the system! Fido is-instance-of Dog; John is-instance-of Man; This bottle is-instance-of Bottle
20 Graphic Notation Arrows (should) always point up Animal Mammal Dog Fido Conventions Arrows always point up Open arrows for is-kind-of Closed arrows for is-instance-of In this course Round boxes for Types/Classes Ovals for instances/objects
22 Inheritance What is true of the superclass –is (generally) true of the subclass In many frame systems, the ‘default’ values can be over-ridden –In description logics and OIL, faults do not exist as such Vocabulary –“Defeasible” can be over-ridden –defaults –“Indefeasible” not defeasible –cannot be over-ridden
23 Inheritance: All Slots are inherited LivingThing mode-of-reproduction: ? Animal (mode of reproduction: ?) source-of-food: ? covering: ? means-of-feeding-young: ? Mammal: (mode of reproduction: ?) (source-of-food: ?) (means-of-feeding-young: ?) (covering: ?) normal-body-termperature: ? Dog...
24 Inheritance: Default values are inherited Mammal: (mode of reproduction: live-birth) (source-of-food: ?) (means-of-feeding-young: milk) (covering: fur) normal-body-termperature: ? Dog (mode of reproduction: live-birth) (source-of-food: ?) (means-of-feeding-young: milk) (covering: fur) ( normal-body-termperature: ?)
25 Inheritance: Default values can be overridden Mammal: (mode of reproduction: live-birth) (source-of-food: ?) (means-of-feeding-young: milk) (covering: fur) normal-body-termperature:? Platypus (mode of reproduction: lays-eggs) (source-of-food: ?) (means-of-feeding-young: milk) (covering: fur) ( normal-body-termperature: ?)
26 Single and Multiple Inheritance Person Quaker Republican Nixon Nixon is an instance of both Quaker and Republican
27 Multiple Inheritance with Defaults The ‘Nixon Diamond’ Person Quaker Republican Nixon :pacifist true :pacifist false Is Nixon a pacifist?
28 Multiple inheritance and defaults Each seem a minor change Each alone works Together they spell disaster –Computational consequences are often unintuitive In classification they are rarely intuitive
29 Advantages of Frames An orderly easy-to-understand structure Inheritance helps to keep knowledge modular Efficient inference –If a single hierarchy
30 Problems with frames Negation cannot be represented –“Jim does not have pneumonia” Disjunction cannot be represented Semantics ambiguous –Woods: What’s in a link –Brachman: What IS-A is and IS-A isn’t
31 Frames and Object Oriented Programming Frame systems were one of the ancestors of OO programming –As used, slots are very similar to instance variables –Default values can be implemented as class variables –Many frame systems allow methods in slots Analogous to methods in OO programming
32 Exercises Start up PROTÉGÉ Work through the tutorial Load the Newspapers example Create a new kind of “Article” - “Editorial” - and give it a new slot “Stance” Create a new kind of “Article” - “Guest editorial” - and give it a new slots “Own organisation” and “political orientation” Find the Biological Process (malaria) model on the web from http://protege.stanford.edu and explore ithttp://protege.stanford.edu