• No results found

Probabilistic (Logic) Programming Concepts. Angelika Kimmig SUM 2016

N/A
N/A
Protected

Academic year: 2022

Share "Probabilistic (Logic) Programming Concepts. Angelika Kimmig SUM 2016"

Copied!
197
0
0

Loading.... (view fulltext now)

Full text

(1)

Probabilistic (Logic)

Programming Concepts

Angelika Kimmig

SUM 2016

(2)

A key question in AI:

Dealing with uncertainty

Reasoning with relational data

Learning

?

(3)

A key question in AI:

Dealing with uncertainty

Reasoning with relational data

Learning

?

logic

databases

• programming

...

(4)

A key question in AI:

Dealing with uncertainty

Reasoning with relational data

Learning

?

logic

databases

• programming

...

• probability theory

• graphical models

...

(5)

A key question in AI:

Dealing with uncertainty

Reasoning with relational data

Learning

?

logic

databases

• programming

...

• probability theory

• graphical models

...

• parameters

structure

(6)

A key question in AI:

Dealing with uncertainty

Reasoning with relational data

Learning

Statistical relational learning, probabilistic logic learning, probabilistic programming, ...

?

logic

databases

• programming

...

• probability theory

• graphical models

...

• parameters

structure

(7)

border border

border border

Alliance 2 Alliance 3

Alliance 4

Alliance 6

P 2

1081

895 1090

1090

1093

1084

1090

915 1081

1040

770

1077

955 1073

804 1054

830

942 1087

786

621 P 3

744

748 559

P 5

861

P 6

950 644

985

932 837 871

777 P 7

946

878

864 913

P 9

NELL: http://rtw.ml.cmu.edu/rtw/

(8)

Two main streams

Lifted graphical models

Probabilistic (logic) programming

A. Kimmig, L. Mihalkova, and L. Getoor. Lifted graphical models: a survey. MLJ, 99(1), 1-45, 2015.

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

grade(S,C) difficult(C) demanding(P)

takes(S,C)

1(grade(S, C), difficult(C)) teaches(P,C)

2(demanding(P), difficult(C))

(9)

Two main streams

Lifted graphical models

Probabilistic (logic) programming

A. Kimmig, L. Mihalkova, and L. Getoor. Lifted graphical models: a survey. MLJ, 99(1), 1-45, 2015.

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

grade(S,C) difficult(C) demanding(P)

takes(S,C)

1(grade(S, C), difficult(C)) teaches(P,C)

2(demanding(P), difficult(C))

(10)

ProbLog

probabilistic Prolog

Dealing with uncertainty

Reasoning with relational data

Learning

(11)

Prolog / logic programming

ProbLog

probabilistic Prolog

Dealing with uncertainty

Learning

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

(12)

Prolog / logic programming

ProbLog

probabilistic Prolog

Dealing with uncertainty

Learning

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

one world

(13)

Prolog / logic programming

atoms as random variables

ProbLog

probabilistic Prolog

Learning

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

one world

(14)

Prolog / logic programming

atoms as random variables

ProbLog

probabilistic Prolog

Learning

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

one world

several possible worlds

(15)

Prolog / logic programming

atoms as random variables

ProbLog

probabilistic Prolog

Learning

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

one world

several possible worlds

Distribution Semantics [Sato, ICLP 95]:

probabilistic choices + logic program

→ distribution over possible worlds

(16)

parameter learning, adapted relational learning techniques Prolog / logic

programming

atoms as random variables

ProbLog

probabilistic Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

one world

several possible worlds

Distribution Semantics [Sato, ICLP 95]:

probabilistic choices + logic program

→ distribution over possible worlds

(17)

Dealing with uncertainty

Reasoning with relational data

Probabilistic Databases [Suciu et al 2011]

(18)

Dealing with uncertainty

relational database

Probabilistic Databases

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

[Suciu et al 2011]

(19)

Dealing with uncertainty

relational database

Probabilistic Databases

one world

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

[Suciu et al 2011]

(20)

relational database

tuples as random variables

Probabilistic Databases

one world

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn

person city P

ann london 0.87

bob york 0.95

eve new york 0.90

tom paris 0.56

bornIn

city country P

london uk 0.99

york uk 0.75

paris usa 0.40

cityIn

select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

[Suciu et al 2011]

(21)

relational database

tuples as random variables

Probabilistic Databases

one world

several possible worlds

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn

person city P

ann london 0.87

bob york 0.95

eve new york 0.90

tom paris 0.56

bornIn

city country P

london uk 0.99

york uk 0.75

paris usa 0.40

cityIn

select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

[Suciu et al 2011]

(22)

relational database

tuples as random variables

Probabilistic Databases

one world

several possible worlds

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn

person city P

ann london 0.87

bob york 0.95

eve new york 0.90

tom paris 0.56

bornIn

city country P

london uk 0.99

york uk 0.75

paris usa 0.40

cityIn

select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

probabilistic tables + database queries

→ distribution over possible worlds

[Suciu et al 2011]

(23)

Probabilistic Logic Programming

Distribution Semantics [Sato, ICLP 95]:

probabilistic choices + logic program

→ distribution over possible worlds

e.g., PRISM, ICL, ProbLog, LPADs, CP-logic, ...

multi-valued switches

probabilistic

probabilistic facts

annotated

causal-

probabilistic

laws

(24)

Extensions of basic PLP

Distribution Semantics [Sato, ICLP 95]:

probabilistic choices + logic program

→ distribution over possible worlds

continuous RVs decisions

constraints

time & dynamics

programming constructs

semiring labels

...

(25)

Roadmap

Modeling

Reasoning

• Language extensions

(26)

Modeling

(27)

ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

(28)

0.4 :: heads.

ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

probabilistic fact: heads is true with

probability 0.4 (and false with 0.6)

(29)

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

annotated disjunction: first ball is red

with probability 0.3 and blue with 0.7

(30)

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green);

0.5 :: col(2,blue).

annotated disjunction: second ball is red with probability 0.2, green with 0.3, and blue with 0.5

ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

(31)

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green);

0.5 :: col(2,blue).

win :- heads, col(_,red). logical rule encoding background knowledge ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

(32)

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green);

0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

logical rule encoding background knowledge ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color)

(33)

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green);

0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

ProbLog by example:

A bit of gambling h

• toss (biased) coin & draw ball from each urn

• win if (heads and a red ball) or (two balls of same color) probabilistic choices

consequences

(34)

Questions

Probability of win?

Probability of win given col(2,green)?

Most probable world where win is true?

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

(35)

Questions

Probability of win?

Probability of win given col(2,green)?

Most probable world where win is true?

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

marginal probability

query

(36)

Questions

Probability of win?

Probability of win given col(2,green)?

Most probable world where win is true?

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

marginal probability

conditional probability

evidence

(37)

Questions

Probability of win?

Probability of win given col(2,green)?

Most probable world where win is true?

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

marginal probability

conditional probability

MPE inference

(38)

Possible Worlds

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

(39)

Possible Worlds

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

(40)

Possible Worlds

H

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

0.4

(41)

Possible Worlds

H

R

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4

(42)

Possible Worlds

H

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3 0.4

G

(43)

Possible Worlds

H

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3 0.4

G

(44)

Possible Worlds

H

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4)

G

(45)

Possible Worlds

H

R

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3

G

(46)

Possible Worlds

R R

H

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2

G

(47)

Possible Worlds

W

R R

H

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2

G

(48)

Possible Worlds

W

R R

H

W

R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2 (1−0.4)

G

(49)

Possible Worlds

W

R R

H

W

R R

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2 (1−0.4) ×0.3

G

(50)

Possible Worlds

W

R R

H

W

R R G

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2 (1−0.4) ×0.3 ×0.3

G

(51)

Possible Worlds

W

R R

H

W

R R G

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2 (1−0.4) ×0.3 ×0.3

G

(52)

Possible Worlds

W

R R

H

W

R R G

×0.3

0.4 :: heads.

0.3 :: col(1,red); 0.7 :: col(1,blue).

0.2 :: col(2,red); 0.3 :: col(2,green); 0.5 :: col(2,blue).

win :- heads, col(_,red).

win :- col(1,C), col(2,C).

×0.3

0.4 (1−0.4) ×0.3 ×0.2 (1−0.4) ×0.3 ×0.3

G

(53)

All Possible Worlds

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

(54)

Most likely world where win is true?

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

MPE Inference

(55)

Most likely world where win is true?

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

MPE Inference

(56)

P(win)=

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

? Probability Marginal

(57)

P(win)=

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

Probability Marginal

(58)

P(win)=

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

=0.562 Probability Marginal

(59)

P(win|col(2,green))=

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

? Conditional

Probability

(60)

=P(win∧col(2,green))/P(col(2,green)) P(win|col(2,green))=

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

∑ / ∑ Conditional

Probability

(61)

P(win|col(2,green))=

=0.036/0.3=0.12

W

R R

H

W

R B

H

W

R G

H

W

R R

R G

R B

H

W

B B

H

B G

H

W

R

B B R

G B

W

B B

0.024

0.036

0.060

0.036

0.054

0.090

0.056 0.084

0.084 0.126

0.140 0.210

∑ / ∑ Conditional

Probability

(62)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

(63)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

query

(64)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

query

subset of probabilistic

facts

(65)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

query

subset of probabilistic

facts

Prolog

rules

(66)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

query

subset of probabilistic

facts

Prolog rules

sum over possible worlds

where Q is true

(67)

Distribution Semantics

(with probabilistic facts)

[Sato, ICLP 95]

P (Q) = X

F [R|=Q

Y

f 2F

p(f ) Y

f 62F

1 p(f )

query

subset of probabilistic

facts

Prolog rules

sum over possible worlds where Q is true

probability of

possible world

(68)

Alternative view:

CP-Logic

[Vennekens et al, ICLP 04]

throws(john).

0.5::throws(mary).

0.8 :: break :- throws(mary).

0.6 :: break :- throws(john).

probabilistic causal laws

John throws Window breaks

Window breaks Window breaks

doesn’t break

doesn’t break doesn’t break

Mary throws doesn’t throw Mary throws doesn’t throw 1.0

0.6 0.4

0.5 0.5 0.5 0.5

0.8 0.2 0.8 0.2

P(break)=0.6×0.5×0.8+0.6×0.5×0.2+0.6×0.5+0.4×0.5×0.8

(69)

• Discrete- and continuous-valued random variables

Distributional Clauses (DC)

(70)

• Discrete- and continuous-valued random variables

Distributional Clauses (DC)

length(Obj) ~ gaussian(6.0,0.45) :- type(Obj,glass).

random variable with Gaussian distribution

(71)

• Discrete- and continuous-valued random variables

Distributional Clauses (DC)

length(Obj) ~ gaussian(6.0,0.45) :- type(Obj,glass).

stackable(OBot,OTop) :-

≃length(OBot) ≥ ≃length(OTop), ≃width(OBot) ≥ ≃width(OTop).

comparing values of

random variables

(72)

• Discrete- and continuous-valued random variables

Distributional Clauses (DC)

length(Obj) ~ gaussian(6.0,0.45) :- type(Obj,glass).

stackable(OBot,OTop) :-

≃length(OBot) ≥ ≃length(OTop), ≃width(OBot) ≥ ≃width(OTop).

ontype(Obj,plate) ~ finite([0 : glass, 0.0024 : cup,

0 : pitcher, 0.8676 : plate, 0.0284 : bowl, 0 : serving, 0.1016 : none])

:- obj(Obj), on(Obj,O2), type(O2,plate).

random variable with

discrete distribution

(73)

• Discrete- and continuous-valued random variables

Distributional Clauses (DC)

length(Obj) ~ gaussian(6.0,0.45) :- type(Obj,glass).

stackable(OBot,OTop) :-

≃length(OBot) ≥ ≃length(OTop), ≃width(OBot) ≥ ≃width(OTop).

ontype(Obj,plate) ~ finite([0 : glass, 0.0024 : cup,

0 : pitcher, 0.8676 : plate, 0.0284 : bowl, 0 : serving, 0.1016 : none])

:- obj(Obj), on(Obj,O2), type(O2,plate).

(74)

relational

tuples as random variables

Probabilistic Databases

person city ann london

bob york

eve new york bornIn

city country

london uk

york uk

paris usa

cityIn

person city P

ann london 0.87

bob york 0.95

eve new york 0.90

tom paris 0.56

bornIn

city country P

london uk 0.99

york uk 0.75

paris usa 0.40

cityIn

select x.person, y.country from bornIn x, cityIn y

where x.city=y.city

probabilistic tables + database queries

→ distribution over possible worlds

[Suciu et al 2011]

(75)

Example:

Information Extraction

instances for many

different relations degree of certainty

(76)

Querying: probabilistic db

(77)

Querying: probabilistic db

select x.Product, x.Company

from ProducesProduct x, HeadquarteredIn y where x.Company=y.Company and

y.City=‘san_jose’

same query -

probabilities handled implicitly

(78)

Querying: probabilistic db

select x.Product, x.Company

from ProducesProduct x, HeadquarteredIn y where x.Company=y.Company and

y.City=‘san_jose’

0.96x0.99=0.95

(79)

Querying: probabilistic db

select x.Product, x.Company

from ProducesProduct x, HeadquarteredIn y where x.Company=y.Company and

y.City=‘san_jose’

0.9x0.93=0.83

(80)

Querying: probabilistic db

select x.Product, x.Company

from ProducesProduct x, HeadquarteredIn y where x.Company=y.Company and

y.City=‘san_jose’

0.87x0.93=0.80

(81)

answer tuples ranked by probability

Querying: probabilistic db

select x.Product, x.Company

from ProducesProduct x, HeadquarteredIn y where x.Company=y.Company and

y.City=‘san_jose’

(82)

PDB with tuple-level

uncertainty in ProbLog?

(83)

PDB with tuple-level uncertainty in ProbLog?

0.96::producesProduct(sony,walkman).

0.96::producesProduct(microsoft,mac_os_x).

0.96::producesProduct(ibm,personal_computer).

0.9::producesProduct(microsoft,mac_os).

0.9::producesProduct(adobe,adobe_indesign).

0.87::producesProduct(adobe,adobe_dreamweaver).

...

(84)

ProbLog by example:

Rain or sun?

(85)

0.5::weather(sun,0) ; 0.5::weather(rain,0).

ProbLog by example:

Rain or sun?

day 0

0.5

0.5

(86)

0.5::weather(sun,0) ; 0.5::weather(rain,0).

0.6::weather(sun,T) ; 0.4::weather(rain,T)

:- T>0, Tprev is T-1, weather(sun,Tprev).

ProbLog by example:

Rain or sun?

day 0

0.5 0.5

day 1

0.6 0.4

day 2

0.6 0.4

day 3

0.6 0.4

day 4

0.6 0.4

day 5

0.6 0.4

day 6

0.6

0.4

(87)

0.5::weather(sun,0) ; 0.5::weather(rain,0).

0.6::weather(sun,T) ; 0.4::weather(rain,T)

:- T>0, Tprev is T-1, weather(sun,Tprev).

0.2::weather(sun,T) ; 0.8::weather(rain,T)

:- T>0, Tprev is T-1, weather(rain,Tprev).

ProbLog by example:

Rain or sun?

day 0

0.5 0.5

day 1

0.6 0.4

day 2

0.6 0.4

day 3

0.6 0.4

day 4

0.6 0.4

day 5

0.6 0.4

day 6

0.6 0.4

0.8 0.2

0.8 0.2

0.8 0.2

0.8 0.2

0.8 0.2

0.8

0.2

(88)

0.5::weather(sun,0) ; 0.5::weather(rain,0).

0.6::weather(sun,T) ; 0.4::weather(rain,T)

:- T>0, Tprev is T-1, weather(sun,Tprev).

0.2::weather(sun,T) ; 0.8::weather(rain,T)

:- T>0, Tprev is T-1, weather(rain,Tprev).

ProbLog by example:

Rain or sun?

day 0

0.5 0.5

day 1

0.6 0.4

day 2

0.6 0.4

day 3

0.6 0.4

day 4

0.6 0.4

day 5

0.6 0.4

day 6

0.6 0.4

0.8 0.2

0.8 0.2

0.8 0.2

0.8 0.2

0.8 0.2

0.8 0.2

infinite possible worlds! BUT: finitely many partial

worlds suffice to answer any given ground query

(89)

day 0

0.5

day 1

0.6

day 2

0.4

?- weather(rain,2).

day 0

0.5

day 1 day 2

0.4 0.2

day 0

0.5

day 1

0.4

day 2

0.8

day 0

0.5

day 1 day 2

0.8 0.8

Possible worlds

P1=0.12

P=P1+P2+P3+P4 P2=0.16

P3=0.04 P4=0.32

(90)

probabilistic choices + their consequences

• probability distribution over possible worlds (as in probabilistic databases)

• next: how to efficiently answer questions?

ProbLog

(91)

Roadmap

Modeling

Reasoning

• Language extensions

(92)

Reasoning

(93)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

(94)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

possible worlds

inf easible

(95)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

possible worlds

inf easible

logical reasoning

probabilistic inference

data structure

(96)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

possible worlds

inf easible

logical reasoning

probabilistic inference

data structure

knowledge

compilation

(97)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

possible worlds

inf easible

logical reasoning

probabilistic inference

data structure 1. using proofs

2. using models knowledge

compilation

(98)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

(99)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

(100)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl).

(101)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

(102)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

(103)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

(104)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob).

(105)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

(106)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

(107)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

(108)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- stress(ann).

(109)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

(110)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

(111)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

(112)

Logical Reasoning:

Proofs in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

proof = facts used in successful derivation:

Y=bob

Y1=ann

(113)

Proofs in ProbLog

0.8::stress(ann).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

influences(bob,carl)&influences(ann,bob)&stress(ann)

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

Y=bob

Y1=ann

probability of proof = 0.2 × 0.6 × 0.8 = 0.096

(114)

influences(bob,carl)

& influences(ann,bob)

& stress(ann)

Proofs in ProbLog

0.8::stress(ann).

0.4::stress(bob).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

Y=bob

Y1=ann

0.2×0.6×0.8

= 0.096

(115)

influences(bob,carl)

& influences(ann,bob)

& stress(ann)

Proofs in ProbLog

0.8::stress(ann).

0.4::stress(bob).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

Y=bob

Y1=ann

0.2×0.6×0.8

= 0.096

(116)

influences(bob,carl)

& influences(ann,bob)

& stress(ann)

Proofs in ProbLog

0.8::stress(ann).

0.4::stress(bob).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

Y=bob

Y1=ann

influences(bob,carl)

& stress(bob)

0.2×0.6×0.8

= 0.096 0.2×0.4

= 0.08

(117)

influences(bob,carl)

& influences(ann,bob)

& stress(ann)

Proofs in ProbLog

0.8::stress(ann).

0.4::stress(bob).

0.6::influences(ann,bob).

0.2::influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

?- stress(carl). ?- influences(Y,carl),smokes(Y).

?- smokes(bob).

?- stress(bob). ?- influences(Y1,bob),smokes(Y1).

?- smokes(ann).

?- influences(Y2,ann),smokes(Y2).

?- stress(ann).

Y=bob

Y1=ann

influences(bob,carl)

& stress(bob)

0.2×0.6×0.8

= 0.096 0.2×0.4

= 0.08

proofs overlap!

cannot sum probabilities

(118)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

possible worlds

(119)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

influences(bob,carl) &

influences(ann,bob) & stress(ann)

possible worlds

(120)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

influences(bob,carl) & stress(bob)

influences(bob,carl) &

influences(ann,bob) & stress(ann)

possible worlds

(121)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

influences(bob,carl) & stress(bob)

influences(bob,carl) &

influences(ann,bob) & stress(ann)

possible worlds

sum of proof probabilities: 0.096+0.08 = 0.1760

(122)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

influences(bob,carl) & stress(bob)

influences(bob,carl) &

influences(ann,bob) & stress(ann)

possible worlds

sum of proof probabilities: 0.096+0.08 = 0.1760 0.0576 0.0384 0.0256 0.0096 0.0064

∑ = 0.1376

(123)

infl(bob,carl) & infl(ann,bob) & st(ann) & \+st(bob) infl(bob,carl) & infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & st(ann) & st(bob) infl(bob,carl) & infl(ann,bob) & \+st(ann) & st(bob) infl(bob,carl) & \+infl(ann,bob) & \+st(ann) & st(bob) ...

Disjoint-Sum-Problem

influences(bob,carl) & stress(bob)

influences(bob,carl) &

influences(ann,bob) & stress(ann)

possible worlds

sum of proof probabilities: 0.096+0.08 = 0.1760 0.0576 0.0384 0.0256 0.0096 0.0064

∑ = 0.1376

solution: knowledge compilation

(124)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision

Diagram (BDD)

(125)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision Diagram (BDD)

0.4::heads(1).

0.7::heads(2).

0.5::heads(3).

win :- heads(1).

win :- heads(2),heads(3).

win

(126)

heads(1)

heads(2) & heads(3)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision Diagram (BDD)

0.4::heads(1).

0.7::heads(2).

0.5::heads(3).

win :- heads(1).

win :- heads(2),heads(3).

win

(127)

heads(1)

heads(2) & heads(3)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision Diagram (BDD)

0.4::heads(1).

0.7::heads(2).

0.5::heads(3).

win :- heads(1).

win :- heads(2),heads(3).

win

h(1)

h(2)

h(3)

0 1

(128)

heads(1)

heads(2) & heads(3)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision Diagram (BDD)

0.4::heads(1).

0.7::heads(2).

0.5::heads(3).

win :- heads(1).

win :- heads(2),heads(3).

win

false true

win?

h(1)

h(2)

h(3)

0 1

(129)

heads(1)

heads(2) & heads(3)

Initial Approach

(ProbLog1 & others)

Find all proofs of query

calculate marginal by dynamic programming

Binary Decision Diagram (BDD)

0.4::heads(1).

0.7::heads(2).

0.5::heads(3).

win :- heads(1).

win :- heads(2),heads(3).

win

win?

h(1)

0.4

h(2)

h(3)

0 1

0.6 0.3 0.7

0.5 0.5 P(win) =

probability of

reaching 1-leaf

(130)

Answering Questions

program queries evidence

marginal probabilities

conditional probabilities

MPE state

Given: Find:

?

possible worlds

inf easible

logical reasoning

probabilistic inference

data structure 1. using proofs

2. using models

(131)

• Forward reasoning to construct unique model:

Logical Reasoning:

Models in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

(132)

• Forward reasoning to construct unique model:

• Start with database facts

Logical Reasoning:

Models in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

stress(ann).

influences(ann,bob).

influences(bob,carl).

(133)

• Forward reasoning to construct unique model:

• Start with database facts

• Use rules to add more facts

Logical Reasoning:

Models in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(ann).

(134)

• Forward reasoning to construct unique model:

• Start with database facts

• Use rules to add more facts

Logical Reasoning:

Models in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(ann).

smokes(bob).

(135)

• Forward reasoning to construct unique model:

• Start with database facts

• Use rules to add more facts

Logical Reasoning:

Models in Prolog

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(X) :- stress(X).

smokes(X) :-

influences(Y,X), smokes(Y).

?- smokes(carl).

stress(ann).

influences(ann,bob).

influences(bob,carl).

smokes(ann).

smokes(bob).

smokes(carl).

References

Related documents

Prior researches on corporate governance and firm’s performance focused on the role of outside director, internal directors, board composition (team size, different experiences,

Based on a series of decadal land use/land cover data sets in the plain (1910s–2010s), this study simulated the water balance in each decade using the Weather Research and

We Operate Customer Service Hours From 8:30 AM To 5:00 PM E.S.T., And Orders And Questions May Be Presented Monday Through Friday During These Hours.. International Calls May

[The new welfare state – abdication of party politics?] In Ann-Helén Bay, Axel West Pedersen and Jo Saglie (eds.), “Når velferd blir politikk.. Partier, organisasjoner og

Electrical generation sources may include diesel generator sets, solar photovoltaics (PV), small wind turbines, biomass energy generators, or micro-hydro power..

The basic switching cells proposed in this paper are the practical implementation of the canonical switching cell found in [9], Although the switching cells

In this thesis, algorithms for near-end listening enhancement (NELE) have been presented which improve the intelligibility of the far-end speech signal perceived in near-end

Spine Surgery Challenges • Post op hematoma • CSF leak • Post op dysphagia • ICU stays • Pain control • PT/ ambulation • Urinary retention • OR time Patient