1 / 31

Knowledge Representation

Knowledge Representation. An Introduction. Knowledge Based Systems.

cyndi
Télécharger la présentation

Knowledge Representation

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. Knowledge Representation An Introduction

  2. Knowledge Based Systems “A computerized system that uses knowledge about some domain to arrive at a solution to a problem from that domain. This solution is essentially the same as that concluded by a person knowledgeable about the domain of the problem when confronted with the same problem“ Gonzalez & Dankel

  3. Architecture of a KBS

  4. Knowledge Engineering • The process of building knowledge based system is often called knowledge engineering. The knowledge engineer is involved with all components of a KBS. • Building KBS is generally an iterative process. The components and their interaction will be refined over the course of numerous meetings of the knowledge engineer with the experts and the users

  5. Knowledge Representation • The mappings used to encode knowledge should be tractable to enhance system performance. • A good representation system for a particular domain should possess the following properties: • Representational adequacy • ability to represent adequately complex facts • Inferential adequacy • ability to deduce new facts from existing knowledge • Inferential efficiency • inferences should be made quickly • Clear syntax and semantics • allowable expressions and what they mean • Naturalness • capturing structure of knowledge in an obvious way

  6. Knowledge Representation • English or natural language is an obvious way of representing and handling facts. spot is a dog all dogs have tails • We can then deduce: spot has a tail • Problems with natural language • Natural language is often ambiguous. • Syntax and semantics are not fully understood. • There is little uniformity in the structure of sentences.

  7. Representation Schemes • Four schemes of knowledge representation: • Networked Schemes • Semantic nets • Conceptual graphs • Structured Schemes • Frames • Scripts • Procedural Schemes • IF….THEN… rules • Logical Schemes • Predicate calculus • Propositional calculus

  8. Networked Schemes • Uses a graph to represent knowledge. Nodes of a graph displays objects or concepts in a domain, and arcs define relationship between them, their attributes and values of attributes. Inheritance is possible.

  9. Nodes & Arcs • Nodes of semantic nets can represent: • Concepts, objects, events, features, time etc. • Several kinds of relationships are possible: • “Class-superclass” or “is-a” with inheritance • “Instance-class” or “is an instance of” with inheritance • “Part-whole” or “part of” • “Object-attribute” or “has” • “Attribute-value” or “value” • Logical (e.g. and or not) • Linguistic (e.g. likes, owns, travels…)

  10. Examples of Semantic Nets

  11. Structured Schemes • Extend networked representation by displaying each node in a graph as a complex data structure • Frames represent knowledge as structured objects which is composed of labelled slots with their values • Each frame has: • a name. • slots: properties of the entity that has the name, and they have values.

  12. animal isa has_part mammal head isa colour size elephant grey large instance_of instance_of likes apples Clyde Nellie Frames - Example • A variant of semantic networks: Mammal: subclass: Animal has-part: head Elephant: subclass: Mammal colour: grey size: large Nellie: instance: Elephant likes: apples Clyde: instance: Elephant

  13. Inheritance and Default Values • In general children classes inherit the properties of the parent class • Default values - properties that are typical for a class • instances or subclasses whose properties differ from these default values are able to override them. • there are various ways of achieving overriding, for example: • any default value may be overridden • only marked slots allow the default value to be overridden

  14. Default Values • In this example only slots marked with an asterisk may be overridden. Mammal: subclass: Animal has-part: head warm-blooded: yes *furry: yes Elephant: subclass: Mammal *colour: grey *size: large *furry: no Nellie: instance: Elephant likes: apples owner: Fred colour: pink Clyde: instance: Elephant size: small

  15. Multiple Inheritance • We use the term simple (or single) inheritance when each object and class has only a single parent class. Multiple inheritance considers those cases where there is more than one parent class. Complication arises when some properties may be inherited from more than one of them. • The simplest solution is to define an order of precedence for the parent classes. Elephant: Cylde: subclass: Mammal instance: Circus-Animal Elephant has-trunk: yes colour: pink *colour: grey owner: Fred *size: large *habitat: jungle Nellie: instance: Circus-Animal Circus-Animal: subclass: Animal habitat: tent skills: balancing-on-ball *size: small

  16. Slots and Procedures • Both slot values and slots may be frames. • In the multiple inheritance example, we represented that Fred was Clyde’s owner. We may want to know some details about Fred, so we can use a frame to describe Fred’s properties. • Allowing a slot to be a frame means that we can specify a range of properties for a slot, e.g., we could specify that the slot owner • could only take the values of the class Person, • has an inverse slot owns, and • can take multiple values (i.e. more than one person can jointly own something).

  17. Slots and Procedures • Many systems allow slots to include procedures. The term, procedural attachment is used to represent this. • A piece of program code may be placed in a slot and be run every time a value for that slot is needed. • The code may also be run when a value is entered into the slot (event driven code). This code could do consistency checks or be used to propagate results to other slots. • The use of procedures and multiple inheritance can make it hard to predict what will be inferred about a given object just by looking at the set of frames. We need to know about how the underlying frame system is implemented.

  18. Procedural Schemes • Refers to several different knowledge representation schemes based on the general underlying idea of condition-actionpairs, which are also called if-then pairs,situation-action pairs,production rules, or just plain productions. • <condition, action> pairs • Agent checks if a condition holds • If so, the production rule “fires” and the action is carried out • This is a recognise-act cycle

  19. Production Rules (rule (name) (if (trigger fact 1) (trigger fact 2) : : (trigger fact n)) (then (conclusion fact 1, or action 1 ) (conclusion fact 2, or action 2) : : (conclusion fact n, or action n)))

  20. Production Rules if it is raining then the ground is wet if height of X > height of Y then X is taller than Y where X and Y are variables it is raining the ground is wet height of Tom = 6 height of Tim = 5 Tom is taller than Tim

  21. Control Schemes • Two main kinds of rule-based systems: forward chaining and backward chaining. • Forward chaining starts with the facts, and sees what rules apply given the facts. • Facts are held in a working memory • Condition-action rules represent actions to take when specified facts occur in working memory. • Typically the actions involve adding or deleting facts from working memory, until no rules can fire, or “halt” symbol added to working memory.

  22. Example – Forward Chaining Control Scheme (Intepreter – controls application of rules) Condition action rules R1: IF alarm_beeps THEN ADD smoky R2: IF hot AND smoky THEN ADD fire R3: IF fire THEN ADD switch_on_sprinklers Database of facts (normally representing things that are true) alarm-beeps hot • Working memory initially contains: • alarm_beeps, hot

  23. Example – Forward Chaining • Following the algorithm: First cycle.. • find all rules with conditions satisfied: R2 • choose one: R2, perform action: ADD smoky. • working memory now contains: alarm_beeps, hot, smoky • Next cycle: • find all rules with conditions satisfied : R1 • choose one and apply action: ADD fire • working memory now contains alarm_beeps, hot, smoky, fire. • Then: • Rules with conditions satisfied: R3 • apply action: ADD switch_on_sprinklers.

  24. Example - Backward Chaining • This allows rather more focused style of reasoning. (Forward chaining may result in a lot of irrelevant conclusions added to working memory.) • Start with possible hypothesis. Should I switch the sprinklers on? • Set this as a goal to prove. To prove this goal G: • If G is in the initial facts, it is proven. • Otherwise, find a rule which can be used to conclude G, and try to prove each of that rule’s conditions.

  25. Example - Backward Chaining Should we switch on the sprinklers? Set as a goal. • G1: switch_on_sprinklers • Is it in initial facts? No. Is there a rule which adds this as a conclusion? Yes, R3 • Set condition of R3 as new goal to prove: • G2: fire. • Is it in initial facts? No. Rule? Yes, R2 • Set conditions as new goals: G3: hot, G4: smoky.

  26. Example – Backward Chaining • Try to prove G3: hot. In initial facts. • Try to prove G4: smoky. Conclusion of rule R1 so.. • G5: alarm_beeps. • In initial facts, so all done… • Proved hypothesis switch_on_sprinklers.

  27. Logical Schemes • Representing knowledge by using mathematical or orthographic symbols. Inference rules are based on precisely defined syntax and semantics • Syntax • Symbols • Constants, variables, predicates, functions, quantifiers • First order predicate logic • Formal general language to represent knowledge • Expressive logic compared with propositional logic • A powerful way of deriving new knowledge from old, through mathematical deduction.

  28. Predicate Logic • Conjunctives and Disjunctives • The logical and called the conjunction of two logical propositions • The logical or called the disjunction of two logical propositions • The negation, or not connective • The implies connective • Vocabulary "  " material implication (implies) "  " not "  " or "  " and "  " for all "  " there exists

  29. Predicate Logic - Examples • It is raining. RAINING • It is sunny. SUNNY • It is windy. WINDY • If it is raining, then it is not sunny. RAINING  SUNNY • Logic enables us to consider the fact that: spot is a dog as dog(spot) • all dogs have tails can then be represented as dog(x)  hasatail(x) • Using appropriate backward mapping function the English sentence spot has a tail can be deduced: hasatail(spot)

  30. Predicate Logic - Examples • Elephants are grey • Grey (elephant) • All animals eat the food they like •  (x)  (y): animal (x)  food (y)  like (x, y)  eat (x, y) • Elephants are not carnivores • Elephant (x)   carnivore (x) • Fruit is food • Food (Fruit) • x is an elephant • Elephant (x) • Elephants are animals • Animals (elephants) • x like fruit • Like (x, fruit) • All animals eat fruit or meat •  (x) : animal (x)  eat (x, fruit) eat (x, meat)

  31. Acknowledgements The lecture slides are adapted from the following sources: G51IAI lecture slides by Dr. Rong Qu from Nottingham UK The Essence of Artificial Intelligence by Allison Cawsey, Prentice Hall

More Related