Top Banner
Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University [email protected] http:// cs.tju.edu.cn/faculties/gongxj/course/ai /
38

Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University [email protected]

Dec 24, 2015

Download

Documents

Beverly Gilmore
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Chapter 5

Knowledge Representation

Xiu-jun GONG (Ph. D)School of Computer Science and Technology, Tianjin

University

[email protected]

http://cs.tju.edu.cn/faculties/gongxj/course/ai/

Page 2: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Outline Knowledge & Knowledge representation Methodology for KR

Logic Production System Semantic Net Frame Script Object-Oriented

Summary

Page 3: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Knowledge

What is Knowledge ?

Information

Knowledge

Knowledge = Facts + Rules + Control Strategy +(sometimes ) Faiths

Data

Signal

Page 4: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Taxonomy of Knowledge Facts: declarative knowledge

thief(john), likes(john, wine) Rules: procedural knowledge

may_steal(X, Y) if thief(X) and likes(X, Y) Control Strategy: meta, super knowledge

reasoning strategy note form search strategy

Page 5: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Attributes of Knowledge Range : Special ←→ General

Intend : Expository ←→ Instructional

Certainty : Certain ←→ Uncertain

Contain/Conflict :←→ Contain Conflict ( in faith)

Page 6: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Knowledge Representation Knowledge representation is an issue

that arises in both cognitive science and AI. In cognitive science it is concerned with how

people store and process information. In AI, the primary aim is to store knowledge so

that programs can process it and achieve the verisimilitude of human intelligence.

AI researchers have borrowed representation theories from cognitive science.

Page 7: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Some issues in KR How do people represent knowledge? What is the nature of knowledge and how

do we represent it? Should a representation scheme deal with

a particular domain or should it be general purpose?

How expressive is a representation scheme?

Should the scheme be declarative or procedural?

Page 8: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Methodology of KR Logic Production System Semantic Net Frame Script

Page 9: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Propositional Logic Propositional logic uses true statements to form

or prove other true statements. Representation (syntax): How to represent a proposition. Reasoning (algorithm): How to create or prove new

propositions. Representation of propositional logic

A propositional symbol and connectives (!, *, +, =>, <=> )

Example: C = “It’s cold outside” ; C is a proposition O = “It’s October” ; O is a proposition If O then C ;if it’s October then it’s cold outside

Page 10: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Predicate Logic Same connectives as propositional logic Propositions have structure: Predicate/Function +

arguments. R, 2 ; Terms. Terms are not individuals, not propositions Red(R), (Red R) ; A proposition, written in two ways (southOf UnicornCafe UniHall) ;a proposition (+ 2 2) ; Term, since the function + ranges over numbers

Quantifiers enable general axioms to be written (forall ?x

(iff (Triangle ?x) (and (polygon ?x) (numberOfSides ?x 3)))

Easy to inference

Page 11: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Logic as a KR language advantages

With a semantics Expressiveness

Disadvantages Inefficient Undecidability Unable to express procedural knowledge Unable to do default reasoning No abduction

Page 12: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Production System (1) Production rules are one of the most popular and

widely used knowledge representation languages Production rule system consists of three

components working memory contains the information that the

system has gained about the problem thus far. rule base contains information that applies to all the

problems that the system may be asked to solve. interpreter solves the control problem, i.e., decide which

rule to execute on each selection-execute cycle. Used both for KR and Problem solving system

Page 13: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Production System (2) Advantages:

Naturalness of expression Modularity Restricted syntax Ability to Represent Uncertain Knowledge

Disadvantages Inefficient Less expressive

Page 14: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Semantic Nets Intuition base:

An important feature of human memory is the high number of connections or associations between the different pieces of information contained in it.

There are two types of primitive Nodes correspond to objects, or classes of

objects, in the world Links are unidirectional connections between

nodes and correspond to relationships between these objects

Page 15: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Semantic Nets Major problem with semantic nets is that

although the name of this knowledge representation language is semantic nets, there is not, ironically, clear semantics of the various network representations. For the above example, it can be interpreted as the representation of a

specific bird named Tweety, or it can be interpreted as a representation of

some relationship between Tweety, birds and animals.

Page 16: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Common used links IS-A

PART-OF

MODIFILES: on, down, up, bottom, moveto,…

Link types are set up for specific domain knowledge

Page 17: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Examples of Semantic Net (1) Represent a table

leg4leg1 leg3

table

leg2

topSupport

is-a

Page 18: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Analysis of Semantic Net For a particular Domain, you

make up a set of link-types create a set of nodes connect them together ascribe meaning

Write Programs to manipulate the knowledge Lisp CL

Page 19: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Examples of Semantic Net (2) My car is tan and John’s car is green

car

car1 tan

car2 green

I

john

owner

owner

color

color

is-a

is-a

Page 20: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Inference in a Semantic Net (1) Inheritance

the is-a and instance-of representation provide a mechanism to implement this.

Inheritance also provides a means of dealing with default reasoning

A C AB CIS-A IS-A IS-A

clyde bird bird fly clyde flyIS-A can can

Page 21: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Inference in a Semantic Net (2) Intersection search

The notion that spreading activation out of two nodes and finding their intersection finds relationships among objects.

Many advantages including entity-based organization and fast parallel implementation.

However very structured questions need highly structured networks

Page 22: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Inference in a Semantic Net (3)

car

car1 tan

car2 green

I

john

I

car1 what?

car

is-a

is-a

is-a

owner

owner

owner

color

color

color

What color is the car1?What color is the car1?

tan

Page 23: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Frame representation Frame: a knowledge representation

technique which attempts to organize concepts into a form which exploits interrelatioships and common beliefs

frame-based KR is analogous to object-oriented programming; the difference is the entities encoded

A frame is similar to a record data structure or database record:

Frame has slot names and slot fillers, and usually arranged in a hierarchy

Page 24: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Structure of frame (1)Frame name slot: value , value, …… . . . slot: facet: value, value, …… facet: value, value, ……

Frame: printer superset: office-machine subset: {laser-printer, ink-jet-printer} energy-source: wall-outlet maker: Epson date: 1-April-2003

Page 25: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Structure of frame (2) Frames often allowed slots to contain

procedures. “if-needed” procedures, run when value

needed if-added” procedures, run when a value is

added (to update rest of data, or inform user).

Page 26: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Class and instance frames

(frame) instance: representing” lowest-level” object; a single object or entity

(frame) class: describes different frames (either instances or classes)

every instance has an “is-a” link, pointing to its class possibly more than one “is-a”

Page 27: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Example of frames (1)Frame Name:

Properties:

Bird

ColourWingsFlies

Unknown2

True

Frame Name:

Class:

Properties:

Tweety

Bird

ColourWingsFlies

Yellow1

False

Class frame

Instance frame

Page 28: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Example of frames (2)

Panda

Type: AnimalColour: Black and whiteFood: EatFunc: ……..

Name:Height:Age: 0Sibling

Bamboo

Type: PlantGrowFunc: ……..

Location: Height: 2

Jenny

Name: JennyHeight: 1.6Age: 5Sibling:

Vicky

Name: VickyHeight: 0.7Age: 1Sibling:

Page 29: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Capability of frame representation Advantages

Domain knowledge model reflected directly Support default reasoning Efficient Support procedural knowledge

Disadvantages Lack of semantics Expressive limitations

Page 30: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Scripts for KR Rather similar to frames: uses inheritance

and slots; describes stereotypical knowledge, (i.e. if the system isn't told some detail of what's going on, it assumes the "default" information is true), but concerned with events.

Somewhat out of the mainstream of expert systems work. More a development of natural-language-processing research.

Page 31: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Definition of scripts A script is a remembered precedent,

consisting of tightly coupled, expectation-suggesting primitive-action and state-change frames [Winston, 1992]

A script is a structured representation describing a stereotyped sequence of events in a particular context [Luger, Stubblefield,1998]

Page 32: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Why scripts? (1) Because real-world events do follow

stereotyped patterns. Human beings use previous experiences to understand verbal accounts; computers can use scripts instead.

Because people, when relating events, do leave large amounts of assumed detail out of their accounts. People don't find it easy to converse with a system that can't fill in missing conversational detail

Page 33: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Why scripts? (2) Scripts predict unobserved events. Scripts can build a coherent account from

disjointed observations. Applications

This sort of knowledge representation has been used in intelligent front-ends, for systems whose users are not computer specialists.

It has been employed in story-understanding and news-report-understanding systems.

Page 34: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Components of Scripts Script name

Entry conditions: Roles Props Scene 1 Scene 2 … Results

Page 35: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Script: restaurant example (1)Script: RESTAURANTTrack: Coffee ShopProps: Tables Menu Food Check MoneyRoles: Customer Waiter Cook Cashier Owner

Scene 1:Entering顾客进入餐厅注意桌子看往哪里坐朝桌子走去在座位坐下

Scene 2:Ordering(Menu on table)顾客拿起菜单顾客招呼服务员服务员走向顾客

(Customer ask for Menu)

顾客招呼服务员服务员走向顾客

顾客向服务员要菜单服务员去拿菜单服务员走向桌子

服务员把菜单交给顾客* 顾客从菜单中选择菜肴

服务员说“没有”

服务员记下服务员通知厨师厨师制作菜肴

进入 Scene 3

进入 Scene 4

不付款离开餐厅

Page 36: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Script: restaurant example (2)

Entry conditions: Customer is hungry Customer has money

Results: Customer has less money Owner has more money Customer is not hungry Customer is pleased(optional) Scene 4:Leaving

服务员写帐单顾客把钱交给服务员顾客把小费交给服务员服务员走向出纳员服务员把钱交给出纳员

不付款离开餐厅

Scene 3:Eating厨师把菜肴交给服务员服务员把菜肴交给顾客吃下菜肴

返回 Scene 2 *

顾客离开餐厅

Page 37: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

Summary: KR as Logic (Declarative)

Propositional Predicate

Procedural Rules Productions systems

Structure Frames Scripts

Associations Semantic net

Page 38: Chapter 5 Knowledge Representation Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn

White and black 1.6m

2m 0.7m

Animal Panda Jenny 5 yr

Plant Bamboo Vicky 1 yr

Kind_of

Kind_of

IS_A

IS_A

AGE

AGE

With_Color

has_food

Height Height

Height

Is_ sibling