cs 561, sessions 14-15 1 knowledge representation knowledge engineering: principles and pitfalls...

30
CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls • Ontologies • Examples

Post on 19-Dec-2015

274 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 1

Knowledge Representation

• Knowledge engineering: principles and pitfalls• Ontologies• Examples

Page 2: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 2

Knowledge Engineer

• Populates KB with facts and relations

• Must study and understand domain to pick important objects and relationships

• Main steps:Decide what to talk aboutDecide on vocabulary of predicates, functions &

constantsEncode general knowledge about domainEncode description of specific problem instancePose queries to inference procedure and get answers

Page 3: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 3

Knowledge engineering vs. programming

Knowledge Engineering Programming

1. Choosing a logic Choosing programming language

2. Building knowledge base Writing program3. Implementing proof theory Choosing/writing compiler4. Inferring new facts Running program

Why knowledge engineering rather than programming?Less work: just specify objects and relationships known to be true,

but leave it to the inference engine to figure out how to solve a problem using the known facts.

Page 4: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 4

Properties of good knowledge bases

• Expressive• Concise• Unambiguous• Context-insensitive• Effective• Clear• Correct• …

Trade-offs: e.g., sacrifice some correctness if it enhances brevity.

Page 5: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 5

Efficiency

• Ideally: Not the knowledge engineer’s problem

The inference procedure should obtain same answers no matter how knowledge is implemented.

• In practice:- use automated optimization- knowledge engineer should have some

understanding of how inference is done

Page 6: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 6

Pitfall: design KB for human readers

• KB should be designed primarily for inference procedure!

• e.g.,VeryLongName predicates:

BearOfVerySmallBrain(Pooh) does not allow inference procedure to infer that Pooh is a bear, an animal, or that he has a very small brain, …

Rather, use:

Bear(Pooh) b, Bear(b) Animal(b) a, Animal(a) PhysicalThing(a)…[See AIMA pp. 220-221 for full example]

In other words:BearOfVerySmallBrain(pooh) = x(pooh)

Page 7: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 7

Debugging

• In principle, easier than debugging a program,

because we can look at each logic sentence in isolation and tell whether it is correct.

Example: x, Animal(x) b, BrainOf(x) = b

means “there is some object that is the value of the BrainOf function applied to an animal”

and can be corrected to mean “every animal has a brain”

without looking at other sentences.

Page 8: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 8

Ontology

• Collection of concepts and inter-relationships

• Widely used in the database community to “translate” queries and concepts from one database to another, so that multiple databases can be used conjointly (database federation)

Page 9: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 9

Ontology ExampleK

han

& M

cLeod

, 2

00

0

Page 10: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 10

Towards a general ontology

Develop good representations for:

- categories- measures- composite objects- time, space and change- events and processes- physical objects- substances- mental objects and beliefs- …

Page 11: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 11

Representing Categories

• We interact with individual objects, but… much of reasoning takes place at the level of categories.

• Representing categories in FOL: - use unary predicates

e.g., Tomato(x)

- reification: turn a predicate or function into an objecte.g., use constant symbol Tomatoes to refer to set of all

tomatoes“x is a tomato” expressed as “xTomatoes”

• Strong property of reification: can make assertions about reified category itself rather than its members

e.g., Population(Humans) = 5e9

-in a table form (small set of objects)-based on its properties

Page 12: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 12

Categories: inheritance

• Allow to organize and simplify knowledge base

e.g., if all members of category Food are edibleand Fruits is a subclass of Foodand Apples is a subclass of Fruitsthen we know (through inheritance) that apples are

edible.

• Taxonomy: hierarchy of subclasses

• Because categories are sets, we handle them as such.e.g., two categories are disjoint if they have no member in common

a disjoint exhaustive decomposition is called a partitionetc…

Page 13: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 13

Example: Taxonomy of hand/arm movements

Hand/arm movement

Gestures Unintentional Movements

Manipulative Communicative

Acts Symbols

Mimetic Deictic ReferentialModalizing

Quek,1994, 1995.

Page 14: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 14

Measures

• Can be represented using units functionse.g., Length(L1) = Inches(1.5) = Centimeters(3.81)

• Measures can be used to describe objectse.g., Mass(Tomato12) = Kilograms(0.16)

• Caution: be careful to distinguish between measures and objectse.g., b, bDollarBills CashValue(b) = $(1.00)

Page 15: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 15

Composite Objects

• One object can be part of another.

• PartOf relation is transitive and reflexive:e.g., PartOf(Bucharest, Romania)

PartOf(Romania, EasternEurope)PartOf(EasternEurope, Europe)

Then we can infer Part Of(Bucharest, Europe)

• Composite object: any object that has parts

Page 16: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 16

Composite Objects (cont.)

• Categories of composite objects often characterized by their structure, i.e., what the parts are and how they relate.

e.g., a Biped(a) ll, lr, b Leg(ll) Leg(lr) Body(b) PartOf(ll, a) PartOf(lr, a) PartOf(b, a) Attached(ll, b) Attached(lr, b) ll lr x Leg(x) PartOf(x, a) (x = ll x = lr)

• Such description can be used to describe any objects, including events. We then talk about schemas and scripts.

Page 17: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 17

Events

• Chunks of spatio-temporal universe

e.g., consider the event WorldWarII it has parts or sub-events: SubEvent(BattleOfBritain, WorldWarII) it can be a sub-event: SubEvent(WorldWarII, TwentiethCentury)

• Intervals: events that include as sub-events all events occurring in a given time period (thus they are temporal sections of the entire spatial universe).

• Cf. situation calculus: fact true in particular situationevent calculus: event occurs during particular interval

Page 18: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 18

Events (cont.)

• Places: spatial sections of the spatio-temporal universe that extend through time

• Use In(x) to denote subevent relation between places; e.g. In(NewYork, USA)

• Location function: maps an object to the smallest place that contains it:

x,l Location(x) = l At(x, l) ll At(x, ll) In(l, ll)

Page 19: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 19

Times, Intervals and Actions

• Time intervals can be partitioned between moments (=zero duration) and extended intervals:

• Absolute times can then be derived from defining a time scale (e.g., seconds since midnight GMT on Jan 1, 1900) and associating points on that scale with events.

• The functions Start and End then pick the earliest and latest moments in an interval. The function Duration gives the difference between end and start times.

i Interval(i) Duration(i) = (Time(End(i) – Time(Start(i)))Time(Start(AD1900)) = Seconds(0)Time(Start(AD1991)) = Seconds(2871694800)Time(End(AD1991)) = Seconds(2903230800)Duration(AD1991) = Seconds(31536000)

Page 20: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 20

Times, Intervals and Actions (cont.)

• Then we can define predicates on intervals such as:

i, j Meet(i, j) Time(End(i)) = Time(Start(j))i, j Before(i, j) Time(End(i)) < Time(Start(j))i, j After(j, i) Before(i ,j)i, j During(i, j) Time(Start(j)) Time(Start(i))

Time(End(j)) Time(End(i))i, j Overlap(i, j) k During(k, i) During(k, j)

Page 21: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 21

Objects Revisited

• It is legitimate to describe many objects as events

• We can then use temporal and spatial sub-events to capture changing properties of the objects

e.g., Poland event19thCenturyPoland temporal sub-eventCentralPoland spatial sub-event

We call fluents objects that can change across situations.

Page 22: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 22

Substances and Objects

• Some objects cannot be divided into distinct parts – e.g., butter: one butter? no, some butter!

butter substance (and similarly for temporal substances)(simple rule for deciding what is a substance: if you cut it in

half, you should get the same).

How can we represent substances?

- Start with a categorye.g., x,y x Butter PartOf(y, x) y Butter

- Then we can state propertiese.g., x Butter(x) MeltingPoint(x, Centigrade(30))

Page 23: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 23

Example: Activity Recognition

• Goal: use network of video cameras to monitor human activity

• Applications: surveillance, security, reactive environments

• Research: IRIS at USC

• Examples: two persons meet, one person follows another, one person steals a bag, etc…

Page 24: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 24

Human activity detection

• Nevatia/Medioni/Cohen

Page 25: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 25

Low-level processing

Page 26: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 26

Spatio-temporal representation

Page 27: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 27

Page 28: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 28

Modeling Events

Page 29: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 29

Modeling Events

Page 30: CS 561, Sessions 14-15 1 Knowledge Representation Knowledge engineering: principles and pitfalls Ontologies Examples

CS 561, Sessions 14-15 30