Specification and knowledge representation
Advertisement
This presentation is the property of its rightful owner.
1 / 59

Specification and Knowledge Representation PowerPoint PPT Presentation

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.

Download Presentation

Specification and 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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Specification and knowledge representation

Specification and Knowledge Representation

CIS 488/588

Bruce R. Maxim

UM-Dearborn


Specification

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

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

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

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

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

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

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

Knowledge Representation Issues

  • Grain size or resolution detail

  • Scope or domain

  • Modularity

  • Understandability

  • Explicit versus implicit knowledge

  • Procedural versus declarative knowledge


Advantages

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

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

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

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

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

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

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

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

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

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

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

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

Representation Types

  • Symbols

  • Object-Attribute-Value (OAV)

  • Relational databases

  • Constraints

  • Predicate logic

  • Concept hierarchies

  • Semantic networks

  • Frames

  • Scripts


Symbols

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


Specification and knowledge representation

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

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

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

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


Animal hierarchy

Animal Hierarchy


Inheritance

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


Inheritance1

Inheritance


Value inheritance

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

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

Semantic Network

has

has

feathers

wings

bird

isa

isa

eagle

falcon


Semantic nets in c

Semantic Nets in C++


Problems with semantic nets

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

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

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

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 used1

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

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 fails1

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

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

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

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

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)


Scripts1

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


Scripts2

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?


Scripts3

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

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

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


Introspection

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


Specification phases

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


Role of sketching 1

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?


Role of sketching 2

Role of Sketching - 2

  • Output

    • How can a problem be decomposed into a sequence of actions?


Inspiration

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)


Formalizing

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)


Rationalizing

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?


Specification benefits

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


Sir tank

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


  • Login