clp(pfd(Y)) : Constraints for Probabilistic Reasoning in Logic - - PowerPoint PPT Presentation

clp pfd y constraints for probabilistic reasoning in
SMART_READER_LITE
LIVE PREVIEW

clp(pfd(Y)) : Constraints for Probabilistic Reasoning in Logic - - PowerPoint PPT Presentation

clp(pfd(Y)) : Constraints for Probabilistic Reasoning in Logic Programming Nicos Angelopoulos nicos@cs.york.ac.uk http://www.cs.york.ac.uk/nicos Department of Computer Science University of York Titech 2003, clp(pfd(Y)) p.1 talk


slide-1
SLIDE 1

clp(pfd(Y)) : Constraints for Probabilistic Reasoning in Logic Programming

Nicos Angelopoulos

nicos@cs.york.ac.uk http://www.cs.york.ac.uk/˜nicos

Department of Computer Science University of York

Titech 2003, clp(pfd(Y)) – p.1

slide-2
SLIDE 2

talk structure

Logic Programming (LP) Uncertainty and LP Constraint LP clp(pfd(Y)) clp(pfd(c)) Caesar’s coding experiments Monty Hall clp(pfd(bn)) -sketch

Titech 2003, clp(pfd(Y)) – p.2

slide-3
SLIDE 3

logic programming

Used in AI for crisp problem solving and for building executable models and intelligent systems. Programs are formed from logic based rules. member( H, [H|T] ). member( El, [H|T] ) :- member( El, T ).

Titech 2003, clp(pfd(Y)) – p.3

slide-4
SLIDE 4

execution tree

?− member( X, [a,b,c] ). X = a X = b X = c

member( H, [H|T] ). member( El, [H|T] ) :- member( El, T ).

Titech 2003, clp(pfd(Y)) – p.4

slide-5
SLIDE 5

uncertainty in logic programming

Most approaches use Probability Theory but there are fundamental questions unresolved. For example in SLP (stochastic logic programming), 0.5 : member( H, [H|T] ). 0.5 : member( El, [H|T] ) :- member( El, T ).

Titech 2003, clp(pfd(Y)) – p.5

slide-6
SLIDE 6

stochastic tree

?− member( X, [a,b,c] ). 1/4 : X = b 1/2 1/2 1/2 1/2 1/2 1/2 : X = a 1/8 : X = c

0.5 : member( H, [H|T] ). 0.5 : member( El, [H|T] ) :- member( El, T ).

Titech 2003, clp(pfd(Y)) – p.6

slide-7
SLIDE 7

Prism example

/* Declarations */ target( pmember, 2 ). values( m(List), List ). /* Model */ pmember( El, List ) :- msw( m(List), El ). /* Utility part */ prob_pmember( El, List, Prob ):- length( List, Length ), get_uniform_param( Length, Params ), set_sw( m(List), Params), prob(pmember(El, List),Prob).

Titech 2003, clp(pfd(Y)) – p.7

slide-8
SLIDE 8
  • verloading

In these and similar formalisms both logical and statistical inference are done by a single engine. As a result, either statistical reasoning is subordinate to logical reasoning or vice versa.

Titech 2003, clp(pfd(Y)) – p.8

slide-9
SLIDE 9

constraints in lp

Logic Programming : execution model is inflexible, and its relational nature discourages use of state information.

Titech 2003, clp(pfd(Y)) – p.9

slide-10
SLIDE 10

constraints in lp

Logic Programming : execution model is inflexible, and its relational nature discourages use of state information. Constraints add specialised algorithms

Titech 2003, clp(pfd(Y)) – p.9

slide-11
SLIDE 11

constraints in lp

Logic Programming : execution model is inflexible, and its relational nature discourages use of state information. Constraints add specialised algorithms state information

Titech 2003, clp(pfd(Y)) – p.9

slide-12
SLIDE 12

constraint store

X # Y Constraint store interaction Logic Programming engine ?− Q.

Titech 2003, clp(pfd(Y)) – p.10

slide-13
SLIDE 13

constraints inference

?− Q. X in {a,b} X = Y = b Y in {b,c} => + X = Y

Titech 2003, clp(pfd(Y)) – p.11

slide-14
SLIDE 14

finite domain distributions

For discrete probabilistic models clp(pfd(Y)) extends the idea of finite domains to admit distributions. from clp(fd) X in {a, b} (i.e. X = a

  • r

X = b) to clp(pfd(Y)) p(X = a) + p(X = b)

Titech 2003, clp(pfd(Y)) – p.12

slide-15
SLIDE 15

finite domain distributions

For discrete probabilistic models clp(pfd(Y)) extends the idea of finite domains to admit distributions. from clp(fd) X in {a, b} (i.e. X = a

  • r

X = b) to clp(pfd(Y)) [ p(X = a) + p(X = b) ] = 1

Titech 2003, clp(pfd(Y)) – p.12

slide-16
SLIDE 16

constraint based integration

Execution, assembles the probabilistic model in the store according to program and query. Dedicated algorithms can be used for probabilistic inference on the model present in the store.

Titech 2003, clp(pfd(Y)) – p.13

slide-17
SLIDE 17

clp(pfd(Y))

For finite domain variable V in {e1, . . . , en} and specific probabilistic inference algorithm Y , clp(pfd(Y)) assumes ψS(V ) = {(e1, π1), (e2, π2), . . . , (en, πn)} We let p(ei) = πi. Given a particular store and program: probability of a query or predicate containing probabilistic variables is equal to the sum of product of probabilities for elements that satisfy the query.

Titech 2003, clp(pfd(Y)) – p.14

slide-18
SLIDE 18

clp(pfd(Y)) example

For example, for program P1: lucky( iv, hd). lucky( v, hd). lucky( vi, hd). store S1 with variables D and C, with ψS1(D) = {(i, 1/6), (ii, 1/6), (iii, 1/6), (iv, 1/6), (v, 1/6), (vi, 1/6)} ψS1(C) = {(hd, 1/2), (tl, 1/2)}. The probability of a lucky combination is PS1(lucky(D, C)) = 1/4.

Titech 2003, clp(pfd(Y)) – p.15

slide-19
SLIDE 19

probability of predicates

S - a constraint store. e - vector of finite domain elements E/e - E with variables replaced by e. The probability of predicate E with respect to store S is PS(E) =

  • ∀e

S⊢E/e

PS(e) =

  • ∀e

S⊢E/e

  • i

p(ei)

Titech 2003, clp(pfd(Y)) – p.16

slide-20
SLIDE 20

labelling

In clp(fd) systems labelling instantiates a group of variables to elements from their domains. In clp(pfd(Y)) the probabilities can be used to guide

  • labelling. For instance we have implemented

label(V ars, mua, Prbs, Total) Selector mua approximates best-first algorithm which instantiates a group of variables to most likely combinations.

Titech 2003, clp(pfd(Y)) – p.17

slide-21
SLIDE 21

clp(pfd(c))

Probabilistic variables are declared with V ∼ φV (Fd, Args) e.g. Heat ∼ finite_geometric([l, m, h], [2]) finite geometric distribution with deterioration factor is 2. In the absence of other information ψ{Heat}(Heat) = {(l, 4/7)(m, 2/7), (h, 1/7)} Probability ascribing function φV and finite domain Fd are kept separately.

Titech 2003, clp(pfd(Y)) – p.18

slide-22
SLIDE 22

clp(pfd(c)) conditionals

Conditional C D1 : π1 ⊕ . . . ⊕ Dm : πm Q Each Di is a predicate and all should share a single probabilistic variable V . Q is a predicate not containing V , and 0 ≤ πi ≤ 1,

  • i

πi = 1 V ’s distribution is altered as a result of C being added to the store.

Titech 2003, clp(pfd(Y)) – p.19

slide-23
SLIDE 23

conditional different-than

Conditional different-than constraint Y

π Z

Equivelant to Y = T : π ⊕ Y = T : (1 − π) Z = T

Titech 2003, clp(pfd(Y)) – p.20

slide-24
SLIDE 24

conditional example

lucky( iv, hd). lucky( v, hd). lucky( vi, hd). Coin ∼ uniform([hd, tl]) Die ∼ uniform([i, ii, iii, iv, v, vi]) constrained( P ) :- Coin pin uniform( [hd,tl] ), Die pin uniform( [i,ii,iii,iv,v,vi] ), Die # v :: 1/3 ++ Die = v :: 2/3 \\ Coin = hd, P is p( lucky(Die,Coin) ). Querying this program ?- constrained(Prb) Prb = 2/5.

Titech 2003, clp(pfd(Y)) – p.21

slide-25
SLIDE 25

Caesar’s coding

Each letter is encrypted to a random letter. Words drawn from a dictionary are encrypted. Programs try to decode

  • them. We compared a clp(fd) solution to clp(pfd(c)) .

clp(fd) no probabilistic information, labelling in lexicographical order. clp(pfd(c)) distributions based on frequencies, labelling using mua.

Titech 2003, clp(pfd(Y)) – p.22

slide-26
SLIDE 26

proximity functions

Xi - variable for ith encoded letter Di - dictionary letter freq() - frequency of letter px(Xi, Dj) = 1/ | freq(Xi) − freq(Dj) |

  • k 1/ | freq(Xi) − freq(Dk) |

Titech 2003, clp(pfd(Y)) – p.23

slide-27
SLIDE 27

execution times

200 400 600 800 1000 1200 20 40 60 80 100 clp(FD) pfd

clp(pfd(c)) and clp(fd) on SICStus 3.8.6

Titech 2003, clp(pfd(Y)) – p.24

slide-28
SLIDE 28

Monty Hall

Three curtains hiding a car and two goats. Contestant chooses an initial curtain. A close curtain opens to reveal a goat. Contestant is asked for their final choice. What is the best strategy ? Stay or Switch ?

Titech 2003, clp(pfd(Y)) – p.25

slide-29
SLIDE 29

Monty Hall solution

If probability of switching is Swt, (Swt = 0 for strategy Stay and Swt = 1 for Switch) then probability of win is P(γ) = 1+Swt

3

.

Titech 2003, clp(pfd(Y)) – p.26

slide-30
SLIDE 30

Monty Hall in clp(pfd(c))

curtains( gamma, Swt, Prb ) :- Gift ∼ uniform([a, b, c]), First ∼ uniform([a, b, c]), Reveal ∼ uniform([a, b, c]), Second ∼ uniform([a, b, c]), Reveal = Gift , Reveal = First , Second = Reveal, Second

Swt First ,

Prb is p(Second=Gift).

Titech 2003, clp(pfd(Y)) – p.27

slide-31
SLIDE 31

Strategy γ Query

Querying this program ?- curtains(gamma, 1/2, Prb) Prb = 1/2.

Titech 2003, clp(pfd(Y)) – p.28

slide-32
SLIDE 32

Strategy γ Query

Querying this program ?- curtains(gamma, 1/2, Prb) Prb = 1/2. ?- curtains(gamma, 1, Prb) Prb = 2/3.

Titech 2003, clp(pfd(Y)) – p.28

slide-33
SLIDE 33

Strategy γ Query

Querying this program ?- curtains(gamma, 1/2, Prb) Prb = 1/2. ?- curtains(gamma, 1, Prb) Prb = 2/3. ?- curtains(gamma, 0, Prb) Prb = 1/3.

Titech 2003, clp(pfd(Y)) – p.28

slide-34
SLIDE 34

clp(pfd(bn))

Other discrete probabilistic inference engines can be

  • employed. For instance Bayesian Networks

representation and inference.

Titech 2003, clp(pfd(Y)) – p.29

slide-35
SLIDE 35

example BN

A C B

A = y A = n

B = y 0.80 0.10 B = n 0.20 0.90 A = y A = n C = y 0.60 0.90 C = n 0.40 0.10

Titech 2003, clp(pfd(Y)) – p.30

slide-36
SLIDE 36

clp(pfd(bn)) program

example_bn( A, B, C ) :- cpt(A,[],[y,n]), cpt(B,[A],[(y,y,0.8),(y,n,0.2), (n,y,0.1),(n,n,0.9)]), cpt(C,[A],[(y,y,0.6),(y,n,0.4), (n,y,0.9),(n,n,0.1)]).

Titech 2003, clp(pfd(Y)) – p.31

slide-37
SLIDE 37

program

example_bn( A, B, C ) :- cpt(A,[],[y,n]), cpt(B,[A],[(y,y,0.8),(y,n,0.2), (n,y,0.1),(n,n,0.9)]), cpt(C,[A],[(y,y,0.6),(y,n,0.4), (n,y,0.9),(n,n,0.1)]). ?- example_bn(X,Y,Z), evidence(X,[(y,0.8),(n,0.2)], Zy is p(Z = y).

Titech 2003, clp(pfd(Y)) – p.32

slide-38
SLIDE 38

program

example_bn( A, B, C ) :- cpt(A,[],[y,n]), cpt(B,[A],[(y,y,0.8),(y,n,0.2), (n,y,0.1),(n,n,0.9)]), cpt(C,[A],[(y,y,0.6),(y,n,0.4), (n,y,0.9),(n,n,0.1)]). ?- example_bn(X,Y,Z), evidence(X,[(y,0.8),(n,0.2)], Zy is p(Z = y). Zy = 0.66

Titech 2003, clp(pfd(Y)) – p.33

slide-39
SLIDE 39

current inference scheme

Logic engine CLP Constraints Store Probabilistic Inference & Learning

Titech 2003, clp(pfd(Y)) – p.34

slide-40
SLIDE 40

bottom line

Constraint LP based techniques can be used for frameworks that support probabilistic problem solving. clp(pfd(Y)) can be used to take advantage of probabilistic information at an abstract level.

Titech 2003, clp(pfd(Y)) – p.35

slide-41
SLIDE 41

bottom line

Logic engine CLP Inference Probabilistic Constraint Propagation &

Titech 2003, clp(pfd(Y)) – p.36