620 likes | 1.6k Views
Specification and Knowledge Representation. CIS 488/588 Bruce R. Maxim UM-Dearborn. Specification. Seeks to find a way to represent the analysis concepts using formal notation or data structures Dealing with specification explicitly is a huge advantage when AI needs to be scaled up.
E N D
Specification and Knowledge Representation CIS 488/588 Bruce R. Maxim UM-Dearborn
Specification • Seeks to find a way to represent the analysis concepts using formal notation or data structures • Dealing with specification explicitly is a huge advantage when AI needs to be scaled up
Procedural View of AI • Consider the AI as a single procedure that needs to be passed information to return results or produce outputs • In C++ prototypes are used to describe function interfaces which describe the relationships among variables external to the function • At the end of the specification phase, an interface or scaffold is defined to describe how the AI fits into the rest of the system
Types of Knowledge • Objects • both physical & concepts • Events • usually involve time • maybe cause & effect relationships • Performance • how to do things • META Knowledge • knowledge about how to use knowledge
Stages of Knowledge Use - 1 • Acquisition • structure of facts • integration of old & new knowledge • Retrieval (recall) • roles of linking and chunking • means of improving recall efficiency
Stages of Knowledge Use - 2 • Reasoning • Formal reasoning • deductive theorem proving • Procedural Reasoning • expert system • Reasoning by Analogy • very hard for machines • Generalization • reasoning from examples • Abstraction • simplification
Knowledge Representation • Theory for expressing information in computer systems • The task of defining an interface is essentially KR • How should information passed to AI modules be encoded?
Representation • Set of syntactic and semantic conventions which make it possible to describe things • Syntax • specific symbols allowed and rules allowed • Semantics • how meaning is associated with symbol arrangements allowed by syntax
Knowledge Representation Issues • Grain size or resolution detail • Scope or domain • Modularity • Understandability • Explicit versus implicit knowledge • Procedural versus declarative knowledge
Advantages • Procedural representation • Easy to represent "how to do things" • Easy to represent any knowledge not fitting declarative format • Relatively easy to implement heuristic stuff on doing thing efficiently • Declarative representations • Store each fact once • Easy to add new facts
Good Knowledge Representations • Important things made clear /explicit • Expose natural constraints • Must be complete • Are concise • Transparent (easily understood) • Information can be retrieved & stored quickly • Detail suppressed (can be found as needed) • Computable using existing procedures
River Puzzle • Problem • There are four items a farmer, wolf, goose, and corn. The farmer can only take one item across the river at a time. • Constraints • Wolf will eat the goose if left alone with it • Goose will eat the corn if left alone with it
F=Farmer W=Wolf G=Goose C=Corn ~=River W F ~ W F G F W F G ~ G F ~ W C W C C ~ G F G ~ C F ~ W C F ~ C F W W G ~ G G ~ G C C C F C W ~ G W
Solution • Once graph is constructed finding solution is easy (simply find a path) • AI programs would rarely construct the entire graph explicitly before searching • AI programs would generate nodes as needed and restrict the path search to the nodes generated • May use forward reasoning (initial to goal) or backward reasoning (goal to initial)
State Space Representation • How can individual objects and facts be represented? • How do you combine individual object descriptions to form a representation of the complete problem state? • How can the sequences of problem states that arise be represented efficiently?
Attributes of Good KR Schemes -1 • Representational Adequacy • works for all knowledge in problem domain • Inferential Adequacy • provides ability to manipulate structures to desire new structures • Inferential Adequacy • ability to incorporate additional information in knowledge structures to help focus attention of promising new directions
Attributes of Good KR Schemes - 2 • Acquisitional Efficiency • easy to add new knowledge • Semantic Power • Supports truth theory • Provides for constraint satisfaction • Can cope with incomplete or uncertain knowledge • Contains some commonsense reasoning capability
KR Languages - 1 • Provide means for formalizing representation • Expressiveness • How well language represents knowledge in general • Information can expressed in notational (explicit) form or inferential (deduced from existing knowledge) form
KR Languages - 2 • Efficiency tradeoffs • Disk storage limits the use of notational forms • Computational power limits the use of highly inferential forms • Inference support as basis for understanding • Well-defined syntax (sentence structure) • Well-defined semantics (sentence meanings)
KR Language Attributes - 1 • Consistent • Guarantees that statements are valid and conclusions drawn by systems are sound • Complete • How well does the language express the required knowledge? • Extensible • How easy is it to customize to particular problems?
KR Language Attributes - 2 • Natural • Easy to understand by humans (esp. domain experts) • Easy for humans to write when communicating with the computer • There is a strong link between reasoning and representation • However, most KR formalisms can be converted from one to another
Representation Types • Symbols • Object-Attribute-Value (OAV) • Relational databases • Constraints • Predicate logic • Concept hierarchies • Semantic networks • Frames • Scripts
Symbols • Facts can be stored as text strings or numbers • This scheme can be implemented using any standard programming data types • The disadvantage is that every concept needs its own variable • Examples: [left_obstacle_distance 4.0] [right_obstacle “unknown”]
OAV • Objects or concepts can have multiple variables associated with them • Implemented as C structs, C++ classes, Lisp property lists, Prolog predicates, database records,hash tables • Generally notated as A(O,V) • Examples: distance(left_obstacle,4.0) presence(right_obstacle,”unknown”)
Semantic Networks • A declarative representation in which complex entities are described as collections of attributes and associated values • Sometimes called a “slot and filler” type structure • To assist in their implementation AI languages provide some type of associative memory in which object can be stored as OAV triples
Decomposition • Most complex sets of objects can be decomposed into smaller subsets • These decompositions often contain two types of relations “isa” and “ispart” dog isa pet isa animal isa living thing finger ispart hand ispart body
Inverse Relations • Sometimes it is also useful to define inverse relationships “ako” (a kind of) as inverse of “isa” “haspart” as inverse of “ispart” dog ako pet ako animal ako living thing finger haspart hand haspart body
Inheritance • These relations form a partial ordering of the network • This allows us to use transitivity relations to aid in search • Storage of information is more efficient since inheritance can be used to “copy” information from a class to its subclasses
Value Inheritance Form a queue consisting of node F and all class nodes found in F’s “isa” slot Until queue is empty or value found if queue front has value in slot S then value found else remove first queue element and add nodes related by “isa” slot If value found then report value found in slot S else announce failure.
Semantic Nets • How do semantic networks differ from ordinary directed graphs? • In semantic networks there must be some underlying meeting associated with the representation (especially the edge or link labels)
Semantic Network has has feathers wings bird isa isa eagle falcon
Problems with Semantic Nets • When do you have enough semantic primitives? • How do you know the selected primitives are correct? • What is the smallest number of link types needed to span all human knowledge? • How do you represent quantified knowledge?
Frames • Can be looked at as being similar to a “pre-defined” semantic network • Frames contain information that can be used even if not observed • Frames contain attributes true of all instances of object or events • Frames contain stereotypical instances of objects or events
Frame Attributes • Based on stereotypes • Slot & filler type static representation • Make use of procedural attachment (demons) to fill in missing values • Allow us to use current explanation provided by frame until the “current view” is proven to be incorrect
How are frame used? • People may select a frame from a list of proposed frames candidates based on a small amount of partial evidence (e.g. bigot) • The attributes of a selected frame are instantiated with observed attributes from the current object or event description
How are frame used? • As values for slots are found they are copied to the evolving frame description • If slot values cannot be found or begin to contradict slot constraints a new frame candidate may need to be selected • You may also need to be alert for changes in the object or event while the frame is being instantiated
What happens when frame instantiation fails? • You may be able to follow pre-defined links between frames in a frame system bench table no back, too big no back, too wide drawers chair no back, too high desk stool dresser no kneehole
What happens when frame instantiation fails? • Another option is to follow the inheritance links in the hierarchical structure formed by the frames (e.g. dog mammal animal) until a sufficiently “general” frame that does not conflict with the evidence is found
Problems with Frames • Frames are not very frame-like (e.g. there are more atypical mammals than typical mammals) • Definitions are more important than most people think • Cancellation of default properties is very a tricky business
Scripts • If frames can be viewed as using semantic networks to structure static information • Scripts can be viewed as using a series of related frames to represent dynamic information as a sequence a stereotypic events from a some context
Script Attributes • Entry conditions • When does the script apply? • Result • What will be true once script is completed • Props • Roles • Track • Variation or specialization of usual script pattern • Scenes • Actual event sequences
Restaurant Script • Track: Coffee Shop • Props: Tables, menu, food (F), check, money • Roles: Customer (S), waiter (W), cook (C), casher (M), owner (O) • Entry conditions: • S is hungry, S has money • Results: • S has less money, O has more money, S not hungry, S happy (optional)
Scripts • Are useful because they record patterns of the occurrence of events from the real world • These patterns are based on causal relationships between events (e.g. agents perform one action to be able to perform another action) • The sequence of script events define a causal chain that will facilitate reasoning about unobserved events
Scripts • Can be used in question answering program (e.g. story comprehension) • Why did a waiter bring John a menu? • Scripts can also help to focus attention on unusual events as script departures • John went to a restaurant, was shown to a table, ordered a large steak waited for a long time, got angry, and left. • Why did John get angry?
Scripts • When a script is known to be appropriate to a given situation it can be used to predicate the occurrence of future events • Example: • I went to a restaurant, ordered food, paid my bill, and left • Did I eat?
Strengths of Scripts • Can be used to predicate events and answer questions • Provide a framework for integrating observations into a coherent interpretation • Scripts provide scheme for detecting unusual events
Weaknesses of Scripts • Less general than frames so not appropriate for some knowledge types • If scripts can only account for all details in a restricted domain • It is unlikely that scripts can account for every real life scenario