specification and knowledge representation

59
03/22/22 1 Specification and Knowledge Representation CIS 488/588 Bruce R. Maxim UM-Dearborn

Upload: chastity-battle

Post on 30-Dec-2015

21 views

Category:

Documents


2 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

04/19/23 1

Specification and Knowledge Representation

CIS 488/588

Bruce R. Maxim

UM-Dearborn

04/19/23 2

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

04/19/23 3

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

04/19/23 4

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

04/19/23 5

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

04/19/23 6

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

04/19/23 7

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?

04/19/23 8

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

04/19/23 9

Knowledge Representation Issues

• Grain size or resolution detail• Scope or domain• Modularity• Understandability• Explicit versus implicit knowledge• Procedural versus declarative knowledge

04/19/23 10

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

04/19/23 11

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

04/19/23 12

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

04/19/23 13

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

04/19/23 14

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)

04/19/23 15

State Space Representation

1. How can individual objects and facts be represented?

2. How do you combine individual object descriptions to form a representation of the complete problem state?

3. How can the sequences of problem states that arise be represented efficiently?

04/19/23 16

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

04/19/23 17

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

04/19/23 18

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

04/19/23 19

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)

04/19/23 20

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?

04/19/23 21

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

04/19/23 22

Representation Types• Symbols• Object-Attribute-Value (OAV)• Relational databases• Constraints• Predicate logic• Concept hierarchies• Semantic networks• Frames• Scripts

04/19/23 23

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”]

04/19/23 24

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”)

04/19/23 25

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

04/19/23 26

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

04/19/23 27

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

04/19/23 28

Animal Hierarchy

04/19/23 29

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

04/19/23 30

Inheritance

04/19/23 31

Value InheritanceForm 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.

04/19/23 32

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)

04/19/23 33

Semantic Network

birdfeathers wings

eaglefalcon

has

isaisa

has

04/19/23 34

Semantic Nets in C++

1. bird 2. falcon 3. eagle 4. wings 5.feathers

1.bird has has

2.falcon isa

3.eagle isa

4.wings

5.feathers

04/19/23 35

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?

04/19/23 36

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

04/19/23 37

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

04/19/23 38

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

04/19/23 39

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

04/19/23 40

What happens when frame instantiation fails?

• You may be able to follow pre-defined links between frames in a frame system

chair

stooldesk

table bench

no kneehole

no back, too high

no back, too widedrawers

no back, too big

dresser

04/19/23 41

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

04/19/23 42

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

04/19/23 43

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

04/19/23 44

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

04/19/23 45

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)

04/19/23 46

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

04/19/23 47

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?

04/19/23 48

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?

04/19/23 49

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

04/19/23 50

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

04/19/23 51

Introspection

• For KR formalisms to have any impact they need to be implemented in such a way as to allow introspection

• Introspection means that the AI is allowed to query knowledge properties dynamically

• This may require the use of extra variables or data structures that can be examined during active game play

04/19/23 52

Specification Phases

• Sketching– Typical brainstorming activity– Ideas are collected and described informally

• Rationalization– Ideas are checked for consistency with existing

requirements– Valid ideas are formalized by converting the

sketch into some KR– The KR is checked for consistency with

requirements

04/19/23 53

Role of Sketching - 1• Context

– What goes on behind the interfaces that allows the problem to be solved?

– Which variables are involved and how can their complexity be minimized?

• Input– Select relevant inputs by asking “what info

does human use in this case?– What problem variables for a programmer to

solve this problem?

04/19/23 54

Role of Sketching - 2

• Output– How can a problem be decomposed into a

sequence of actions?

04/19/23 55

Inspiration

• Where do the idea for sketching come from?– Research (journals and conference proceedings)– Reading (look for developer reviews and game

postmortems)– Relative work (look for open source projects to

examine)– Borrowing idea (look for things that work in other

domains)

04/19/23 56

Formalizing• Involves selecting a KR language• Determining data structures needed to

implement the KR in the target programming language

• Outputs are often easier to formalize than inputs (do this first)

• Failing to create good formalisms for inputs is a frequent cause of failures later

• The supporting variables from the context are often defined abstractly (they can be done last)

04/19/23 57

Rationalizing• Does each model allow case studies to be

satisfied and do they match the informal requirements?

• How does model affect other requirements? (e.g. HW and SW)

• Is the specification consistent with the rest of the design (interfaces and hierarchical dependencies)?

• Are the interfaces flexible enough to handle all propose, applicable implementations?

04/19/23 58

Specification Benefits

• High-level understanding– Separates implementation and design, allowing

focus to be on architecture rather than programming

• Abstraction– Only need to be concerned with module inputs

and outputs

• Comparison– If interface remains constant alternative prototype

implementations can be investigated

04/19/23 59

Sir Tank

• Uses straight forward reactive behaviors to bounce off of obstacles

• Sir Tank’s behavior does not take orientation into account

• This allows movement to be separated from other capabilities such as aiming