• 沒有找到結果。

Knowledge Representation

N/A
N/A
Protected

Academic year: 2021

Share "Knowledge Representation"

Copied!
63
0
0

加載中.... (立即查看全文)

全文

(1)

Representation of Knowledge

• Overview

• Meaning of knowledge

• Methods of knowledge representation

– Backus- Naur form – Rules

– Semantic Nets

– Object-Attribute-Value – Schema (Frames, Scripts) – Logic

(2)

2

• know the basic principles and concepts for

knowledge representation

– knowledge - information - data

– meaning

• be familiar with the most frequently used

knowledge representation methods

– logic, rules, semantic nets, schemata

• differences between methods, advantages, disadvantages, performance, typical scenarios

(3)

• understand the relationship between

knowledge representation and reasoning

– syntax, semantics

– derivation, entailment

• apply knowledge representation methods

– usage of the methods for simple problems

(4)

4

• Epistemology

• Types of knowledge

• Hierarchy of knowledge

(5)

Meaning of Knowledge

2

Epistemology: The study of knowledge

EPISTEMOLOGY ( Gr. episteme, "knowledge"; logos,

"theory"), branch of philosophy concerned with the theory of knowledge. The main problems with which pistemology is concerned are the definition of knowledge and related concepts, the sources and criteria of knowledge, the kinds of knowledge possible and the degree to which each is

certain, and the exact relation between the one who knows and the object known. [Infopedia 1996]

(6)

6 Epistemology Philosophic Theories A Priori Knowledge A Posteriori Knowledge e.g. all triangles

have 180 degrees

e.g. the light is green

(7)

Meaning of Knowledge

4

• Types of knowledge

– a priori knowledge

• comes before knowledge perceived through senses • considered to be universally true

– a posteriori knowledge

• knowledge verifiable through the senses • may not always be reliable

(8)

8

Meaning of Knowledge

5

• Type of knowledge (con’t)

– procedural knowledge

• knowing how to do something

– declarative knowledge

• knowing that something is true or false

– tacit knowledge (Unconscious Knowledge)

(9)

Meaning of Knowledge

6

Rule 1: IF Rain THEN Bring Raincoat

Rule 2: IF Rain THEN Bring Umbrella

Meta Rule1: Try Rule 2 First

Meta Knowledge Knowledge Information Data Noise

(rules about rules) (rules + facts)

(facts) (facts) Knowledge Hierarchy

(10)

10

Meaning of Knowledge

7

13 71 78 76 68 32 52 51 56 43 00 15 1) Noise:

For people without it

2) Data:

For people with care about it

3) Information:

1. Group the number by two’s.

2. Ignore any two-digit numbers less than 32. 3. Substitute the ASCII characters.

Gold 438+ 4) Knowledge:

IF Gold is less than 500 and the price is rising (+) Then buy gold

5) Meta knowledge Example:

(11)

Meaning of Knowledge

8

Conventional

Programming

Knowledge-Based

Systems

Algorithms + Data Structures = Programs Knowledge + Inference = Expert System N. Wirth

(12)

12

Representation Methods

1

• Backus- Naur form

• Production Rules

• Semantic Nets

• Object-Attribute-Value

• Schema (Frames, Scripts)

• Logic

(13)

Backus-Naur form

(BNF)

• Define the syntax of a language

e.g. <sentence>::=<subject><verb><end-mark> <subject>::=I | You | We <verb>::=left | came <end-mark>::=. | ? | !

• Parse Tree

sentence came

subject verb end-mark You

(14)

14

Production Rules

IF your spouse is in a bad mood THEN don’t appear happy

Premise LHS Antecedent condition Conclusion action RHS chunk IF p1 THEN p2 IF p2 THEN p3 IF p2 THEN p4 p1 p2 p2 p3 p4

(15)

IF someone pretends to be unhappy THEN he will be in bad mood

IF your spouse is in a bad mood THEN pretend to be unhappy

IF two persons are both in bad mood THEN they will fight each other

IF two persons fight each other THEN one of them will die

(16)

16

Production Rules

• Match

• Conflict Resolution (Rule Selection)

• Fire

• Example:

Facts: A1=1, B1=2, IF A1=1 AND B1=3 THEN C =5 IF A1=1 AND B1=2 THEN C =6 IF A1=1 THEN D =7 IF A1=4 THEN D =8 IF B1=2 THEN E =9 IF A1=1 AND C=6 THEN F =10

(17)

Architecture of a production System

Rules Match (Conflict Set) Conflict resolution Fire (act) Modification Facts

(18)

18

AGENDA: A list of matched rules

KB (rules) Inference Engine AGENDA Working Memory (facts) Explanation facility Knowledge Acquisition facility User Interface

(19)

Advantages of Rule-based Systems:

1. Modular Nature:

– Easy to increase Knowledge

2. Similar to human cognitive process 3. Explanation facilities:

– Example 1:

IF A AND B THEN C IF C AND D THEN E Why (E)?

Because Explain (C) and Explain (D) Why (D)?

D is an input fact. Why (C )?

(20)

20

– Example 2:

Rule 1: IF h-fever AND r-spot THEN Danger-fever

Rule 2: IF temperature >38 THEN h-fever = true Why Danger fever?

Because Explain( h-fever) AND Explain(r-spot) According to Rule 1:

If a person has high fever and

a person has red spots over his body then the person may have Danger fever Why high fever?

According to Rule 2:

If a person’s temperature exceed 38 degree then the person has high fever.

(21)

Semantic Net

• Propositional Net

• Associative Net

• A label, directed graph

• Node: object

(22)

22 sister-of Ann wife-of husband-of wife-of husband-of

Bill Carol David

mother-of father-of mother-of father-of husband-of mother-of father-of Susan Tom John relationship

(23)

23

General Net

San Francisco Chicago New York

Los Angeles

(24)

24

IS-A and A-KIND-OF

• Special kinds of relationship in semantic nets

• IS-A:

– Related an instance of individual to a generic

class

• AKO:

– Related a generic class to another generic class

• Superclass and Subclass

• Attribute, Value, Property

• Inheritance

(25)

Example

Goodyear

aircraft

round balloon Propeller

driven jet

ellipsoidal blimp special DC-3 Concorde

Spirit of Air

has-shape DC-9

has-shape

AKO AKO AKO

AKO AKO AKO AKO AKO AKO

(26)

26 General purpose computer Multi processo r My count-logic board My calculato r Micro computer mini computer mainfram e Super computer dedicate d Board-level Compute r-on-a-chip Single processo r 80486 SX IBM S/34 VAX 6500 Weather monitor-predict system Computi ng system purpose Internal process AKO

AKO AKO AKO AKO AKO

purpose

purpose

purpose

ISA ISA ISA

Internal

process Internal process

Internal process

(27)

Semantix Net Example

Gaul Astérix Obélix Idéfix Dog Abraracourcix Panoramix Ordralfabetix Cétautomatix barks-at Human AKO

(28)

28

Semantix Net Cheats

• colors

– should properly be encoded as separate nodes with relationships to the respective objects

• font types

– implies different types of relationships

– again would require additional nodes and relationships

• class relationships

– not all dogs live with Gauls

– AKO (a-kind-of) relationship is special (inheritance)

• instances

– arrows from individual humans to the class Human omitted • assumes that AKO allows inheritance

• directionality

(29)

Object-Attribute-Value Triples

(OAV)

• especially useful for representing facts

• For only a single object:

Object

Attribute

Value

apple apple apple grapes grapes grapes color type quantity color type quantity red mcintosh 100 red seedless 500

(30)

30

Example

Wheel: 4 Function:run . . . Door: 3 . . . Door: 4 . . . Carry: people Size: small Carry: goods Size: big

Price: $$$ Price: $$$ Price: $$$ Price: $$$

year: 1998 Owner: gjh Year: 1992 Owner: crt Car Object Attribute Value AKO AKO AKO AKO AKO AKO R9 Civic IS-A IS-A

(31)

OAV-Triples

• object-attribute-value triplets

– can be used to characterize the knowledge in a semantic net

– quickly leads to huge tables

Object

Attribute

Value

Astérix

profession

warrior

Obélix

size

extra large

(32)

32

Limitations

• Lack of standard names for links and nodes

• Combinatorial explosion of searching nodes

• Logically inadequate

– no “for all” , “ there exist”…

• Heuristically inadequate

(33)

Schema Examples

• the most frequently used instances of

schemata are

– frames [Minsky 1975]

– scripts [Schank 1977]

• frames consist of a group of slots and fillers

to define a stereotypical objects

• scripts are time-ordered sequences of

frames

(34)

34

Frame

• Suitable for related knowledge about a narrow subject with much default knowledge

• Slot: Attribute • Fillers: Value

• Example: a car frame

Slots Fillers

Manufacturer General Motors Model Chevrolet Caprice Year 1979 Transmission Automatic Engine Gasoline Tires 4 Color blue

(35)

Filler

• An assigned value

• A default value

• Rules

• Graphics

• Comments

• Debugging information

• Questions for users

• Function

• Procedual attachment

• To other frame

(36)

36

Procedural Attachment

• If-needed • If-added • If-removed

• Example: Human Property

Slots Fillers

Name property

Specialization_of A kind_of object

Types (car, boat, house)

If-added: Procedure ADD_property

Owner Default: government

If-needed: Procedure find_owner

Location (home, work, mobile)

Status (missing, poor, good)

(37)

Hierarchy

Slots Fillers

Name Car

Specialization_of A-kind-of property

Types (sedan, sports, convertible) Manufacturer (GM, Ford, Chrysler)

Location Mobile

Wheels 4

Transmission (manual, automatic) Engine (gasoline, diesel)

Slots Fillers

Name John’s car

Specialization_of Is_a car Manufacturer GM

Owner John Doe

Transmission Automatic Engine Gasoline

Status Good

(38)

38

Script

• Shopping Script:

– Roles: C (customer), S(salesperson) – Props: M(merchandise), D(dollars) – Location: L( a store)

11. C leaves L

3. C looks for a specific M 4. C looks for any interesting M 5. C asks S for help

6.

7. C finds M’

9. C leaves L 10. C buys M’

2. C begins looking around

12.goto step 2

13. C leaves L

1. C enters L

8. C fails to find M

(39)

Example

Mary went shopping for a new coat.

She found a new one she really liked.

When she got it home, she discovered that it

went perfectly with her favorite dress.

• Question:

(40)

40

Overview of Frame Structure

• two basic elements: slots and facets (fillers, values, etc.); • typically have parent and offspring slots

– used to establish a property inheritance hierarchy (e.g., specialization-of)

• descriptive slots

– contain declarative information or data (static knowledge)

• procedural attachments

– contain functions which can direct the reasoning process (dynamic knowledge)

(e.g., "activate a certain rule if a value exceeds a given level")

• data-driven, event-driven ( bottom-up reasoning) • expectation-drive or top-down reasoning

• pointers to related frames/scripts - can be used to transfer control to a more appropriate frame

(41)

41

Slots

• each slot contains one or more facets

• facets may take the following forms:

– values – default

• used if there is not other value present – range

• what kind of information can appear in the slot – if-added

• procedural attachment which specifies an action to be taken when a value in the slot is added or modified (data-driven, event-driven or bottom-up reasoning)

– if-needed

• procedural attachment which triggers a procedure which goes out to get information which the slot doesn't have (expectation-driven; top-down reasoning)

– other

(42)

42

Usage of Frames

• filling slots in frames

– can inherit the value directly – can get a default value

– these two are relatively inexpensive

– can derive information through the attached procedures (or methods) that also take advantage of current context (slot-specific heuristics)

– filling in slots also confirms that frame or script is appropriate for this particular situation

(43)

43

Restaurant Frame Example

• generic template for restaurants

– different types

– default values

• script for a typical sequence of activities at

a restaurant

(44)

44

Generic Restaurant Frame

Generic RESTAURANT Frame

Specialization-of: Business-Establishment Types:

range: (Cafeteria, Fast-Food, Seat-Yourself, Wait-To-Be-Seated) default: Seat-Yourself

if-needed: IF plastic-orange-counter THEN Fast-Food,

IF stack-of-trays THEN Cafeteria,

IF wait-for-waitress-sign or reservations-made THEN Wait-To-Be-Seated, OTHERWISE Seat-Yourself.

Location:

range: an ADDRESS if-needed: (Look at the MENU) Name:

if-needed: (Look at the MENU) Food-Style:

range: (Burgers, Chinese, American, Seafood, French) default: American

if-added: (Update Alternatives of Restaurant) Times-of-Operation:

range: a Time-of-Day

default: open evenings except Mondays Payment-Form:

range: (Cash, CreditCard, Check, Washing-Dishes-Script) Event-Sequence:

default: Eat-at-Restaurant Script Alternatives:

range: all restaurants with same Foodstyle

if-needed: (Find all Restaurants with the same Foodstyle)

(45)

45

Restaurant Script

EAT-AT-RESTAURANT Script

Props: (Restaurant, Money, Food, Menu, Tables, Chairs) Roles: (Hungry-Persons, Wait-Persons, Chef-Persons) Point-of-View: Hungry-Persons

Time-of-Occurrence: (Times-of-Operation of Restaurant) Place-of-Occurrence: (Location of Restaurant)

Event-Sequence:

first: Enter-Restaurant Script

then: if (Wait-To-Be-Seated-Sign or Reservations)

then Get-Maitre-d's-Attention Script

then: Please-Be-Seated Script then: Order-Food-Script

then: Eat-Food-Script unless (Long-Wait) when Exit-Restaurant-Angry Script then: if (Food-Quality was better than Palatable)

then Compliments-To-The-Chef Script

then: Pay-For-It-Script

(46)

46

Frame Advantages

• fairly intuitive for many applications

– similar to human knowledge organization

– suitable for causal knowledge

– easier to understand than logic or rules

(47)

Frame Problems

• it is tempting to use frames as definitions of

concepts

– not appropriate because there may be valid instances of a concept that do not fit the stereotype

– exceptions can be used to overcome this

• can get very messy

• inheritance

– not all properties of a class stereotype should be propagated to subclasses

– alteration of slots can have unintended consequences in subclasses

(48)

48

Propositional

Logic

• Proposition:

• A sentence whose truth value can be

determined.

• e.g. it is raining

• Compound statement

(49)

• Tautology

– A compound statement that is always true

• e.g. P p

• Contradiction

– A compound statement that is always false

• e.g. P p

• Contingent statement

– Neither tautology nor contradiction

• e.g. P

~

~

(50)

50

First-Order Predicate Logic

• The basis of logic programming languages

e.g. Prolog

• Addition: Variable

For all

There exist

e.g. (x is a triangle x is a ploygon)

( x

)

(51)

Fuzzy Logic

• Statement + Membership

• Membership: [0,1]

• Example:

John is tall, m=0.7

(52)

52 • 2-6:

• Tautologies: a compound statement that is always true, whether its individual are true or false.

• Contradiction: a compound statement which is always false.

• Contingent: neither a taulogies nor a contradiction. <a> If I pass the course and make an ‘A’

Then I pass the course or I make an ‘A’. <sol>

LET: I pass the course ==>P I make an ‘A’ ====>A Truth table:

Always true: Tautologies

P A 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 A PPA (PA)→(pA)

(53)

<b>

If I pass the course then I make an ‘A’ AND

I pass this course and I do not make an ‘A’ Truth table:

Always false: Contradiction

P A ~A P-->A 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 0

A

P ~

(P−−> A)∧(P∧~ A)

(54)

54

<c>

Truth Table:

Always true: Tautologies

) ( ) ~ ( ) (AB −− > CC − − > A−− > B A B C A -->B 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 B A ~C∧ ~C (A∧~ B)−−> (C∧ ~C) (A∧~ B)−−>(C∧~C)−−(A−−> B) ~

(55)

<d>

Truth Table:

Always false: Contradiction

A B C A-- >B 0 0 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 C B∨ ~ A ~C (A∧~ B)−−> (C∧ ~C) (A∧~ B)−−>(C∧~C)−−(A−−> B)

(56)

56

<e>

A- ->~B

Truth Table:

Neither tautologies nor

Contradiction = =>A -- >~B

Contingent: ≒

~

(

A

B

)

A B A-->~B 0 0 1 0 1 1 1 0 1 1 1 0

(57)

Representation, Reasoning and

Logic

• two parts to knowledge representation

language:

– syntax

• describes the possible configurations that can constitute sentences

– semantics

• determines the facts in the world to which the sentences refer

(58)

58

Reasoning

• process of constructing new configurations

(sentences) from old ones

– proper reasoning ensures that the new

configurations represent facts that actually

follow from the facts that the old configurations

represent

– this relationship is called entailment and can be

expressed as

KB |= alpha

• knowledge base KB entails the sentence alpha

(59)

59

Inference Methods

• an inference procedure can do one of two things:

– given a knowledge base KB, it can derive new sentences α that are (supposedly) entailed by KB

KB |- α ==> KB |= α

– given a knowledge base KB and another sentence alpha, it can report whether or not alpha is entailed by KB

KB ∧ α ==> KB |= α

• an inference procedure that generates only entailed sentences is called sound or truth-preserving

• the record of operation of a sound inference procedure is called a proof

• an inference procedure is complete if it can find a proof for any sentence that is entailed

(60)

60

KR Languages and Programming

Languages

• how is a knowledge representation language

different from a programming language (e.g. Java,

C++)?

– programming languages can be used to express facts and states

• 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"

• programming languages are not expressive enough

for situations with incomplete information

– we only know some possibilities which exist

(61)

61

KR Languages and Natural

Language

• how is a knowledge representation language different from natural language

– e.g. English, Spanish, German, …

• natural languages are expressive, but have evolved to meet the needs of communication, rather than representation

• the meaning of a sentence depends on the sentence itself and on the context in which the sentence was spoken

– e.g. “Look!”

• sharing of knowledge is done without explicit representation of the knowledge itself

(62)

62

Good Knowledge Representation

Languages

• combines the best of natural and formal languages:

– expressive – concise

– unambiguous

– independent of context

• what you say today will still be interpretable tomorrow

– efficient

• the knowledge can be represented in a format that is suitable for computers

• practical inference procedures exist for the chosen format

– effective

• there is an inference procedure which can act on it to make new sentences

(63)

• KBS are useless without the ability to

represent knowledge

• different knowledge representation schemes

may be appropriate

– depending on tasks and circumstances

• knowledge representation schemes and

reasoning methods must be coordinated

參考文獻

相關文件

● the F&amp;B department will inform the security in advance if large-scaled conferences or banqueting events are to be held in the property.. Relationship Between Food and

 The pre-primary institution is able to design learning activities around themes to facilitate children’s acquisition of knowledge and skills from different learning strands and

– Knowledge to form the basis for decision aids – Knowledge that reveals underlying skills..

•It directly models prior semantic knowledge units, which enhances the ability to learn semantic representation?. • ERNIE learns the semantic representation of complete concepts by

Along with this process, a critical component that must be realized in order to assist management in determining knowledge objective and strategies is the assessment of

Potential knowledge management contributions to human performance technology research and practice Educational.. Technology”,Research

(1999), &#34;Mining Association Rules with Multiple Minimum Supports,&#34; Proceedings of ACMSIGKDD International Conference on Knowledge Discovery and Data Mining, San Diego,

(2007), “Selecting Knowledge Management Strategies by Using the Analytic Network Process,” Expert Systems with Applications, Vol. (2004), “A Practical Approach to Fuzzy Utilities