330 likes | 364 Views
Learn how to represent common sense knowledge, answer questions, troubleshoot issues, understand stories, and create memory associations. Explore semantic nets, frames, description logics, and heuristics in knowledge representation.
E N D
Knowledge Representation Representing Common Sense Knowledge MSc Decision Support Notes 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?
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?
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?
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”
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”
Classic Knowledge Based Systems • Knowledge base • Typically in “Frames” • The problem solving methods or “Heuristics” • Typically in “Rules”
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 universen) 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
The knowledge base • How to represent the things in the world and their relationships • Or more accurately:ourconceptualisation 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?
Money Customer Restaurant Waiter Hunger Food Boredom Anger Memory and Association
Money Pays to has Customer Restaurant Serves food Worksfor has Takesorder Waiter has Hunger has Food causes Boredom has causes Anger Semantic Net - Label the arcs
Thing Organisa-tion Person Money Customer Emotion Restaurant Waiter Hunger Food Boredom Anger Add the classes Pays to has Serves food Works for has Takes order has has causes has causes
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) • Other more formal ways are: • Conceptual graphs (click here) • A complete alternative notation for logic • John Sowahttp://www.bestweb.net/~sowa/direct/jfsbio.htm
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
Basic ideas • Types/ classes • The categories of things that are: • Analogous to setsBest expressed as plurals but usually written as singular • Mammal, Dog, Bottle • Instances / objects • The things themselves • Analogous to members of setsbest expressed as singular, or with ‘the’ or ‘this’ or ‘these’, etc. • Fido, This bottle of milk
Basic ideas • A hierarchy of classes • LivingThings Animals Mammals Dogs Golden Retrievers Sansue Golden RetrieversSansue Golden Retrievers from the Phoenix line ... • Instances • Mia is-instance-of Sansu Golden Retrievers • Mammals is-kind-of of Animals
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
Animal Mammal Dog Fido Graphic NotationArrows (should) always point up • 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
Adding Slots • LivingThingsmode-of-reproduction: ?Animalssource-of-food: ? covering: ? means-of-feeding-young: ? Mammals: means-of-feeding-young: milk covering: fur normal-body-termperature: ?
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
Inheritance: All Slots are inherited • LivingThingmode-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 ...
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: ?)
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: ?)
Single and Multiple Inheritance Person Republican Quaker Nixon Nixon is an instance of both Quaker and Republican
Multiple Inheritance with DefaultsThe ‘Nixon Diamond’ Person Republican Quaker :pacifist false :pacifist true Nixon Is Nixon a pacifist?
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
Advantages of Frames • An orderly easy-to-understand structure • Inheritance helps to keep knowledge modular • Efficient inference • If a single hierarchy
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
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
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 it