Presentation on theme: "CSM6120 Introduction to Intelligent Systems Knowledge representation."— Presentation transcript:
CSM6120 Introduction to Intelligent Systems Knowledge representation
What is knowledge?
Representation AI agents deal with knowledge (data) Facts (believe & observe knowledge) Procedures (“how to” knowledge) Meaning (relate & define knowledge) Right representation is crucial Early realisation in AI Wrong choice can lead to project failure Active research area
Choosing a representation For certain problem solving techniques ‘Best’ representation already known Often a requirement of the technique Or a requirement of the programming language (e.g. Prolog) Examples First order theorem proving… first order logic Inductive logic programming… logic programs Neural networks learning… neural networks Some general representation schemes Suitable for many different (and new) AI applications
What is a Logic? A language with concrete rules No ambiguity in representation (may be other errors!) Allows unambiguous communication and processing Very unlike natural languages e.g. English Many ways to translate between languages A statement can be represented in different logics And perhaps differently in same logic Not to be confused with logical reasoning Logics are languages, reasoning is a process (may use logic)
What is a Logic? Knowledge can be represented using first-order predicate logic More on this later in the module
Non-logical representations Logic representations have restrictions and can be hard to work with Many AI researchers searched for better representations Non-logical Semantic networks Conceptual graphs Frames Scripts Production rules ...
What we’ve ignored Objects in the world tend to be related to each other Classes, superclasses & subclasses Part / whole hierarchies Properties are inherited across relationships The state of the world can change over time Explicit representation of time Frame problem Non-monotonic reasoning We must reason without complete knowledge Closed world assumption Not all knowledge is “black & white” (later modules on CSM…) Uncertainty Statistics, fuzzy logic
Classes “I want to buy a basketball” I want to buy BB27341 (NO) I want to buy an object that is a member of the basketball class (YES) Objects organized into a hierarchy by class BB27341 basketballs basketballs balls Facts (objects) & rules (classes) All balls are round All basketballs are in diameter BB27341 is red, white and blue BB27341 is a basketball (Therefore BB27341 is round and in diameter)
Inheritance If a property is true of a class, it is true of all subclasses of that class If a property is true of a class, it is true of all objects that are members of that class (If a property is true of a class, it is true of all objects that are members of subclasses of that class) There are exceptions (to be dealt with later…)
Part/whole inheritance A cow has 4 legs Each leg is part of the cow The cow is in the field All of the cow’s parts are also in the field The cow is (entirely) brown All of the cow’s parts are brown The cow is happy All of the cow’s parts are happy (?) Note: some properties are inherited by parts, others are not. This is generally made explicit by rules, such as part-of(x,y) and location(y,z) -> location(x,z)
Defaults and exceptions Exception for a single object Set a property of the object to the (exception) value Default for a class Set a property of the class to the (default) value If there are multiple default values, the one “closest” to the object wins
Example All birds can fly Birds with broken wings are birds, but cannot fly Penguins are birds, but they cannot fly Magical penguins are penguins that can fly Who can fly? Tweety is a bird Peter is a penguin Penelope is a magical penguin Note that beliefs can be changed as new information comes in that changes the classification of an object
Semantic networks Semantic networks are essentially a generalization of inheritance hierarchies Each node is an object or class Each link is a relationship is-a (the usual subclass or element relationship) has-part or part-of Any other relationship that makes sense in context Note: semantic networks pre-dated OOP Inheritance: follow one member-of link, as many subclass or other links as necessary
Graphical representation Graphs easy to store in a computer To be of any use must impose a formalism Jason is 15, Bryan is 40, Arthur is 70, Jim is 74 How old is Julia?
Semantic networks Because the syntax is the same, we can guess that Julia’s age is similar to Bryan’s
Knowledge represented as a network or graph subclass has-part subclass instance likes size Animal Reptile Elephant Nellie Mammal apples large head Africa lives-in Semantic networks
By traversing network we can find: That Nellie has a head (by inheritance) That certain concepts related in certain ways (e.g., apples and elephants) But: meaning of semantic networks not always well defined Are all Elephants large, or just typical elephants? Do all Elephants live in the “same” Africa? Do all animals have the same head? For machine processing these things must be defined
Frames Devised by Marvin Minsky, 1974 Incorporates certain valuable human thinking characteristics: Expectations, assumptions, stereotypes. Exceptions. Fuzzy boundaries between classes The essence of this form of knowledge representation is typicality, with exceptions, rather than definition
Frames Frames allow more convenient “packaging” of facts about an object We use the terms “slots” and “slot values” mammal: subclass: animal elephant: subclass: mammal size: large has-part: trunk Nellie: instance: elephant likes: apples mammal: subclass: animal elephant: subclass: mammal size: large has-part: trunk Nellie: instance: elephant likes: apples
Frames Frames often allowed you to say which things were just typical of a class, and which were definitional, so couldn’t be overridden Frames also allow multiple inheritance (Nellie is an Elephant and is a circus animal) Elephant: subclass: mammal has-part: trunk * colour: grey * size: large Elephant: subclass: mammal has-part: trunk * colour: grey * size: large
Frame representations Semantic networks where nodes have structure Frame with a number of slots (age, height,...) Each slot stores specific item of information When agent faces a new situation Slots can be filled in (value may be another frame) Filling in may trigger actions May trigger retrieval of other frames Inheritance of properties between frames Very similar to objects in OOP
Example: Frame representation
Flexibility in frames Slots in a frame can contain Information for choosing a frame in a situation Relationships between this and other frames Procedures to carry out after various slots filled Default information to use where input is missing Blank slots: left blank unless required for a task Other frames, which gives a hierarchy Can also be expressed in first order logic
How frames are organised In the higher levels of the frame hierarchy, typical knowledge about the class is stored The value in a slot may be a range or a condition In the lower levels, the value in a slot may be a specific value, to overwrite the value which would otherwise be inherited from a higher frame Note that a frames system may allow multiple inheritance but, if it does so, it must make provision for cases when inherited values conflict...
Multiple inheritance and views Multiple inheritance Sub-concept inherits descriptions from several superconcepts Possibly conflicting information ( = ambiguity) Skeptical reasoners: “don’t know” (no conclusion) Credulous reasoners: “whatever” (several conclusions) Views Description of concept from different viewpoints Inheritance of multiple, complementing descriptions e.g. view computer as machine or as equipment
Other varieties of structured object Knowledge representation researchers - particularly Roger Schank and his associates - devised some interesting variations on the theme of structured objects In particular, they invented the idea of scripts (1973) A script is a description of a class of events in terms of contexts, participants, and sub-events
Scripts Rather similar to frames: uses inheritance and slots; describes stereotypical knowledge (i.e. if the system isn't told some detail of what's going on, it assumes the "default" information is true) but concerned with events These are somewhat out of the mainstream of expert systems work More a development of natural-language-processing research
Scripts Why represent knowledge in this way? Because real-world events follow stereotyped patterns Human beings use previous experience to understand verbal accounts; computers can use scripts instead Because people, when relating events, leave large amounts of assumed detail out of their accounts People don't find it easy to converse with a system that can't fill in missing conversational detail
Non-monotonic logic Once true (or false) does not mean always true (or false) As information arrives, truth values can change (Penelope is a bird, penguin, magic penguin) Implementations Circumscription Bird(x) and not abnormal(x) -> flies(x) We can assume not abnormal(x) unless we know abnormal(x) Default logic “x is true given x does not conflict with anything we already know”
Truth maintenance systems These systems allow truth values to be changed during reasoning (belief revision) When we retract a fact, we must also retract any other fact that was derived from it Penelope is a bird(can fly) Penelope is a penguin(cannot fly) Penelope is magical(can fly) Retract (Penelope is magical)(cannot fly) Retract (Penelope is a penguin)(can fly)
Types of TMS Justification-based TMS For each fact, track its justification (facts and rules from which it was derived) When a fact is retracted, retract all facts that have justifications leading back to that fact, unless they have independent justifications Assumption-based TMS Represent all possible states simultaneously For each fact, use list of assumptions that make that fact true; each world state is a set of assumptions When a fact is retracted, change state sets
Structured objects: final comments At best, structured objects provide data & control structures which are more flexible than those in conventional languages, and so more suited to simulating human reasoning However, if we just want an AI system to act rationally (rather than think/act humanly), then logic might be better...