You are on page 1of 27

Artificial Intelligence

Knowledge Representation Techniques


By Prof. Dr. Shaiq Haq

Mechatronics Engineering, Air University, Islamabad

Agenda (Knowledge Representation)


n n

What is Knowledge ? Knowledge Representing Methods u logic (propositional, predicate, first order, temporal, fuzzy) u production rules u semantic nets u frames u O-A-V triplets u lists, decision tables, decision trees u scripts Why use knowledge representation languages

Knowledge Pyramid
META Knowledge knowledge about how to use knowledge

MetaKnowledge Information Data Noise

Stages of Knowledge
1.

Acquisition
u u

structure of facts integration of old & new knowledge chunking of data and searching Deduction - formal reasoning; theorem proving procedural reasoning Expert System Induction - reasoning by analogy (very hard for machines), reasoning from examples abstraction simplification

2. 3.

Retrieval (recall)
u

Reasoning (various types)


u u u

Logic Representation
n

Logic Representation is the most common method of representing knowledge. Logic is language like representation of knowledge. Usually its statements are built up of two parts; u premises: information and observations u inferences: conclusions drawn from premises There are various types of Logic Representation; u Propositional Logic (symbolic representation) u Predicate Logic (language like representation) u First order logic (a mix of Propositional and Predicate) u Temporal Logic u Fuzzy Logic

Propositional Logic
n n

A proposition is a statement that is either true or false A string of symbols separated by conjunctions (AND), disjunctions (OR) negations (NOT). Propositional Logic assumes that knowledge contains only facts. once the truth of a statement is known, it becomes a premise that can be used to derive new propositions or inferences Logic Symbols or connectives used in propositional logic are shown as:
(and) (or) (not) (implication) if-then (equivalence) (for all) (there exists)

Propositional Logic: Syntax


n

n n n

Symbols (e.g., letters, words) are used to represent facts about the world, e.g., u P represents the fact Ali likes chocolate u Q represents the fact Ali has chocolate These are called atomic propositions Logical connectives are used to represent and: , or: , ifthen: , not: . Statements or sentences in the language are constructed from atomic propositions and logical connectives. u P Q Ali likes chocolate and he doesnt have any. u P Q If Ali likes chocolate then Ali has chocolate

Predicate Logic
n

Language like representation of knowledge that facilitates inference using predicate calculus. uses the same concept and rules as propositional logic. Assumes the world contains only objects and relationships. can be broken down into an object, a characteristic of the object, or an assertion about the object
t t

n n

likes(arshad, books) likes(ali , chocolates) ^ does_not_have(ali, chocolates)

The trouble with propositional logic is that it is not possible to write general statements in it, such as Arshad eats everything that he likes. We'd have to have lots of rules, for every different thing that Arshad liked. Predicate logic makes such general statements possible.

First Order Logic


n

A mix of Propositional Logic and Predicate Logic

Examples: n x At(x,AU) Smart(x) means Everyone is at AU and everyone is smart


n n

x At(x,AU) Smart(x) means Someone at AU is smart

Other Logic Types


n

Temporal Logic
u

Allows time-based description of facts and knowledge.

Fuzzy Logic
It is a multi-valued logic based on set theory. u In Fuzzy Logic the answer can be other than 0 or 1. u It assigns likelihood to facts, instead of only yes or no.
u

Production Rules
n

with production rules, knowledge is represented in condition -action pairs


u

IF this condition THEN some action will occur

each production rule implements an autonomous piece of expertise in practice, knowledge-based rules are not independent declarative rules state facts and relationships procedural rules advise how to solve a problem

n n

Production Rules
n

frequently used to formulate the knowledge in expert systems formal variation is Backus-Naur form (BNF) u metalanguage for the definition of language syntax u a grammar is a complete, unambiguous set of production rules for a specific language u a parse tree is a graphic representation of a sentence in that language u provide only a syntactic description of the language

Advantages of Rules
Rules are simple and easy to understand n straightforward implementation in computers is possible n inference and explanations are easily derived n formal foundations for some variants n modifications are relatively easy n it is easy to combine uncertainty with the rules n each rule is usually independent of the others
n

Limitations of Rules
complex knowledge will require many rules, creating problems in using and maintaining the system. Large sets of rules become difficult to understand and maintain n some types of knowledge are not easily expressed in such rules n simple implementations are very inefficient n because they are easy to use, KEs may try to enforce all the knowledge into rules rather than using a more appropriate representation
n

Uncertainty & Confidence Factor


Assuming that any rule will be either true or false is a bit artificial; human knowledge is often inexact n some concepts that must be represented are relative (inexact) rather than absolute n another source of uncertainty is when a user cannot provide a definite answer n imprecise and incomplete information are other sources of uncertainty
n

Semantic Nets
n

semantic nets are graphical depictions of knowledge. It is composed of nodes and links (arcs) that show hierarchical relationships between objects because of their hierarchical nature, and their ability to represent class relationships; e.g has, is-a etc., semantic nets can show inheritance

Semantic Net Example

Mini fly is a robin is a bird

lives

nest

in

pine tree in

can have

are

endangered protected by government

Wangs yard

wings

Semantic Nets Problems


Semantic nets are fine at representing relationships between two objects but for relationship with more than two objects it can not represent the relationship. n For example we want to represent the fact that John gives Mary the book This might be represented in logic as; gives(john, mary, book1) n Graphical representation can be very large for complex problems.
n

Semantic Nets Problems (cont)


n

expressiveness u no internal structure of nodes u relationships between multiple nodes is not possible u no easy way to represent heuristic information u extensions are possible, but cumbersome u best suited for binary relationships efficiency u may result in large sets of nodes and links u search may lead to combinatorial explosion t especially for queries with negative results usability u lack of standards for link types u naming of nodes t classes, instances

Frames
n n

a frame includes all the knowledge about an object the knowledge in a frame is divided into slots u a slot can describe declarative or procedural knowledge u each slot contains one or more facets u facets describe some knowledge or procedures about the attribute in the slot

values t default t range t action


t

frames support the inheritance of information

Frame Example
Bird Frame Families: Robin Government Protected Frame Endangered species: robins, eagles

Robin Frame is a: Bird is an: Endangered species fly: Yes wings Yes instance of Mini: instance frame is a: robin lives in: nest Facet location: pine tree

Facet location: Wangs yard

Objects, Attribute, and Values


using O-A-V triplets is a common way to represent knowledge n objects may be physical or conceptual n attributes are the characteristics of the objects n values are specific measures of the attributes
n
Lake Object temperature depth Attribute 53 - 82 degrees F 1 - 33 feet Value

Lists, Tables, and Trees


n n

a list is a series of related items u represents groups or classes of similar items a decision table is organised in columns and rows u there are two parts: a list of attributes, and for each attribute, a list of all possible values u different configurations of attributes are matched to conclusions a decision tree is a hierarchical representation of knowledge relationships u can simplify the knowledge acquisition process

Scripts
n n

a script describes a sequence of events elements of a script may include: u entry conditions- situations that must be satisfied before the events in the script can occur u props- objects that are used in the scripts events u roles - the people involved in the script u tracks- variations that may occur in the script u scenes - the actual sequence of events u useful in capturing everyday, stereotypical situations and events

Script Example
Place: Roles: Self-service place for food, etc. Customer Cashier Entry conditions: Customer needs supplies Customer has money Supermarket has supplies Props: Shopping carts Shopping bags Counters Money Supplies Scene 1: Entry Customer parks car Customer enters supermarket Customer gets shopping cart Scene 2: Shopping

Comparison of KR Approaches
n n

So far we have discussed three KR approaches structured objects, logic, and rules. Structured objects are useful for representing declarative information about collections of related objects/concepts, and in particular where there is a clear class hierarchy. Structured objects are no good if you want to draw a wide range of different sorts of inferences, maybe using IF-THEN rules. For this you could use a logic -based approach, or you could use a rule based system.

KR Languages and Programming Languages


n how

is a knowledge representation language different from a programming language (e.g. Java, C++)? u programming languages can be used to express facts and states n what about "there is a pit in [2,2] or [3,1] (but we don't know for sure)" or "there is a wumpus in some square" n programming languages are not expressive enough for situations with incomplete information u we only know some possibilities which exist

You might also like