• Non ci sono risultati.

Fundamentals of Artificial Intelligence Chapter 14: Probabilistic Reasoning Roberto Sebastiani

N/A
N/A
Protected

Academic year: 2021

Condividi "Fundamentals of Artificial Intelligence Chapter 14: Probabilistic Reasoning Roberto Sebastiani"

Copied!
106
0
0

Testo completo

(1)

DISI, Università di Trento, Italy – roberto.sebastiani@unitn.it http://disi.unitn.it/rseba/DIDATTICA/fai_2020/

Teaching assistant: Mauro Dragoni – dragoni@fbk.eu http://www.maurodragoni.com/teaching/fai/

M.S. Course “Artificial Intelligence Systems”, academic year 2020-2021

Last update: Friday 18thDecember, 2020, 16:39

Copyright notice: Most examples and images displayed in the slides of this course are taken from [Russell & Norwig, “Artificial Intelligence, a Modern Approach”, 3rded., Pearson],

including explicitly figures from the above-mentioned book, so that their copyright is detained by the authors.

A few other material (text, figures, examples) is authored by (in alphabetical order):Pieter Abbeel,Bonnie J. Dorr,Anca Dragan,Dan Klein,Nikita Kitaev,Tom Lenaerts,Michela Milano,Dana Nau,Maria Simi, who detain its copyright.

These slides cannot can be displayed in public without the permission of the author.

1 / 35

(2)

1

Bayesian Networks

2

Constructing Bayesian Networks

3

Exact Inference with Bayesian Networks

2 / 35

(3)

1

Bayesian Networks

2

Constructing Bayesian Networks

3

Exact Inference with Bayesian Networks

3 / 35

(4)

Bayesian Networks

Bayesian Networks (aka Belief Networks):

allow for compact specification of full joint distributions represent explicit conditional dependencies among variables:

an arc from X to Y means that X has a direct influence on Y Syntax: a directed acyclic graph (DAG):

each node represents a random variable (discrete or continuous) directed arcs connect pairs of nodes: X → Y (X is a parent of Y) a conditional distribution P(X

i

|Parents(X

i

)) for each node X

i

Conditional distribution represented as a conditional probability table (CPT)

distribution over X

i

for each combination of parent values Topology encodes conditional independence assertions:

Toothache and Catch conditionally independent given Cavity

Tootchache, Catch depend on Cavity

Weather independent from others No arc ⇐⇒ independence

4 / 35

(5)

Bayesian Networks

Bayesian Networks (aka Belief Networks):

allow for compact specification of full joint distributions represent explicit conditional dependencies among variables:

an arc from X to Y means that X has a direct influence on Y Syntax: a directed acyclic graph (DAG):

each node represents a random variable (discrete or continuous) directed arcs connect pairs of nodes: X → Y (X is a parent of Y) a conditional distribution P(X

i

|Parents(X

i

)) for each node X

i

Conditional distribution represented as a conditional probability table (CPT)

distribution over X

i

for each combination of parent values Topology encodes conditional independence assertions:

Toothache and Catch conditionally independent given Cavity

Tootchache, Catch depend on Cavity

Weather independent from others No arc ⇐⇒ independence

4 / 35

(6)

Bayesian Networks

Bayesian Networks (aka Belief Networks):

allow for compact specification of full joint distributions represent explicit conditional dependencies among variables:

an arc from X to Y means that X has a direct influence on Y Syntax: a directed acyclic graph (DAG):

each node represents a random variable (discrete or continuous) directed arcs connect pairs of nodes: X → Y (X is a parent of Y) a conditional distribution P(X

i

|Parents(X

i

)) for each node X

i

Conditional distribution represented as a conditional probability table (CPT)

distribution over X

i

for each combination of parent values Topology encodes conditional independence assertions:

Toothache and Catch conditionally independent given Cavity

Tootchache, Catch depend on Cavity

Weather independent from others No arc ⇐⇒ independence

4 / 35

(7)

Syntax: a directed acyclic graph (DAG):

each node represents a random variable (discrete or continuous) directed arcs connect pairs of nodes: X → Y (X is a parent of Y) a conditional distribution P(X

i

|Parents(X

i

)) for each node X

i

Conditional distribution represented as a conditional probability table (CPT)

distribution over X

i

for each combination of parent values Topology encodes conditional independence assertions:

Toothache and Catch conditionally independent given Cavity

Tootchache, Catch depend on Cavity

Weather independent from others

No arc ⇐⇒ independence

( c S. Russell & P. Norwig, AIMA) 4 / 35

(8)

Syntax: a directed acyclic graph (DAG):

each node represents a random variable (discrete or continuous) directed arcs connect pairs of nodes: X → Y (X is a parent of Y) a conditional distribution P(X

i

|Parents(X

i

)) for each node X

i

Conditional distribution represented as a conditional probability table (CPT)

distribution over X

i

for each combination of parent values Topology encodes conditional independence assertions:

Toothache and Catch conditionally independent given Cavity

Tootchache, Catch depend on Cavity

Weather independent from others

No arc ⇐⇒ independence

( c S. Russell & P. Norwig, AIMA) 4 / 35

(9)

Example (from Judea Pearl, UCLA)

“The burglary alarm goes off very likely on burglary and occasionally on earthquakes. John and Mary are neighbors who agreed to call when the alarm goes off. Their reliability is different ...”

Variables: Burglary, Earthquake, Alarm, JohnCalls, MaryCalls Network topology reflects “causal” knowledge:

A burglar can set the alarm off An earthquake can set the alarm off The alarm can cause Mary to call The alarm can cause John to call CPTs:

alarm setoff if bunglar in 94% of cases alarm setoff if hearthq.

in 29% of cases false alarm setoff in 0.1% of cases

5 / 35

(10)

Network topology reflects “causal” knowledge:

A burglar can set the alarm off An earthquake can set the alarm off The alarm can cause Mary to call The alarm can cause John to call CPTs:

alarm setoff if bunglar in 94% of cases alarm setoff if hearthq.

in 29% of cases false alarm setoff in 0.1% of cases

( c S. Russell & P. Norwig, AIMA)

5 / 35

(11)

Network topology reflects “causal” knowledge:

A burglar can set the alarm off An earthquake can set the alarm off The alarm can cause Mary to call The alarm can cause John to call CPTs:

alarm setoff if bunglar in 94% of cases alarm setoff if hearthq.

in 29% of cases false alarm setoff in 0.1% of cases

( c S. Russell & P. Norwig, AIMA)

5 / 35

(12)

Network topology reflects “causal” knowledge:

A burglar can set the alarm off An earthquake can set the alarm off The alarm can cause Mary to call The alarm can cause John to call CPTs:

alarm setoff if bunglar in 94% of cases alarm setoff if hearthq.

in 29% of cases false alarm setoff in 0.1% of cases

( c S. Russell & P. Norwig, AIMA)

5 / 35

(13)

A CPT for Boolean X

i

with k Boolean parents has 2

k

rows for the combinations of parent values each row requires one number p for P(X

i

= true) (P(X

i

= false) = 1 − P(X

i

= true))

=⇒ If each variable has no more than k parents, the complete network requires O(n · 2

k

) numbers

a full joint distribution requires 2

n

− 1 numbers linear vs. exponential!

Ex: for burglary example:

1 + 1 + 4 + 2 + 2 = 10 numbers vs. 2

5

− 1 = 31

6 / 35

(14)

A CPT for Boolean X

i

with k Boolean parents has 2

k

rows for the combinations of parent values each row requires one number p for P(X

i

= true) (P(X

i

= false) = 1 − P(X

i

= true))

=⇒ If each variable has no more than k parents, the complete network requires O(n · 2

k

) numbers

a full joint distribution requires 2

n

− 1 numbers linear vs. exponential!

Ex: for burglary example:

1 + 1 + 4 + 2 + 2 = 10 numbers vs. 2

5

− 1 = 31

6 / 35

(15)

A CPT for Boolean X

i

with k Boolean parents has 2

k

rows for the combinations of parent values each row requires one number p for P(X

i

= true) (P(X

i

= false) = 1 − P(X

i

= true))

=⇒ If each variable has no more than k parents, the complete network requires O(n · 2

k

) numbers

a full joint distribution requires 2

n

− 1 numbers linear vs. exponential!

Ex: for burglary example:

1 + 1 + 4 + 2 + 2 = 10 numbers vs. 2

5

− 1 = 31

6 / 35

(16)

A CPT for Boolean X

i

with k Boolean parents has 2

k

rows for the combinations of parent values each row requires one number p for P(X

i

= true) (P(X

i

= false) = 1 − P(X

i

= true))

=⇒ If each variable has no more than k parents, the complete network requires O(n · 2

k

) numbers

a full joint distribution requires 2

n

− 1 numbers linear vs. exponential!

Ex: for burglary example:

1 + 1 + 4 + 2 + 2 = 10 numbers vs. 2

5

− 1 = 31

6 / 35

(17)

of the local conditional distributions:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

if X

i

has no parent, then prior probability P(X

i

)

Intuition: order X

1

, ..., X

n

s.t. parents(X

i

) ≺ X

i

for each i:

P(X

1

, ..., X

n

) = Q

n

i=1

P(X

i

|X

1

, ..., X

i−1

)) // chain rule

= Q

i=1

P(X

I

|parents(X

i

)) // conditional independence

=⇒ A Bayesian network is a distributed representation of the full joint distribution

7 / 35

(18)

of the local conditional distributions:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

if X

i

has no parent, then prior probability P(X

i

)

Intuition: order X

1

, ..., X

n

s.t. parents(X

i

) ≺ X

i

for each i:

P(X

1

, ..., X

n

) = Q

n

i=1

P(X

i

|X

1

, ..., X

i−1

)) // chain rule

= Q

i=1

P(X

I

|parents(X

i

)) // conditional independence

=⇒ A Bayesian network is a distributed representation of the full joint distribution

7 / 35

(19)

of the local conditional distributions:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

if X

i

has no parent, then prior probability P(X

i

)

Intuition: order X

1

, ..., X

n

s.t. parents(X

i

) ≺ X

i

for each i:

P(X

1

, ..., X

n

) = Q

n

i=1

P(X

i

|X

1

, ..., X

i−1

)) // chain rule

= Q

i=1

P(X

I

|parents(X

i

)) // conditional independence

=⇒ A Bayesian network is a distributed representation of the full joint distribution

7 / 35

(20)

of the local conditional distributions:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

if X

i

has no parent, then prior probability P(X

i

)

Intuition: order X

1

, ..., X

n

s.t. parents(X

i

) ≺ X

i

for each i:

P(X

1

, ..., X

n

) = Q

n

i=1

P(X

i

|X

1

, ..., X

i−1

)) // chain rule

= Q

i=1

P(X

I

|parents(X

i

)) // conditional independence

=⇒ A Bayesian network is a distributed representation of the full joint distribution

7 / 35

(21)

of the local conditional distributions:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

if X

i

has no parent, then prior probability P(X

i

)

Intuition: order X

1

, ..., X

n

s.t. parents(X

i

) ≺ X

i

for each i:

P(X

1

, ..., X

n

) = Q

n

i=1

P(X

i

|X

1

, ..., X

i−1

)) // chain rule

= Q

i=1

P(X

I

|parents(X

i

)) // conditional independence

=⇒ A Bayesian network is a distributed representation of the full joint distribution

7 / 35

(22)

Global Semantics: Example

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

Ex: “Prob. that both John and Mary call, the alarm sets off but no burglary nor earthquake”

P(j ∧ m ∧ a ∧ ¬b ∧ ¬e) =

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

8 / 35

(23)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(24)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(25)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(26)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(27)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(28)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(29)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(30)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(31)

P(j|m∧a∧¬b ∧ ¬e)P(m|a∧¬b ∧ ¬e)P(a|¬b∧ ¬e)P(¬b|¬e)P(¬e) = P(j|a) P(m|a) P(a|¬b ∧ ¬e) P(¬b) P(¬e) =

0.9 · 0.7 · 0.001 · 0.999 · 0.998

≈ 0.00063

( c S. Russell & P. Norwig, AIMA) 8 / 35

(32)

Compute:

The probability that John calls and Mary does not, the alarm is not set off with a burglar entering during an earthquake

The probability that John calls and Mary does not, given a burglar entering the house

The probability of an earthquake given the fact that John has called

...

9 / 35

(33)

Theorem: Local semantics holds iff global semantics holds:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

( c S. Russell & P. Norwig, AIMA)

10 / 35

(34)

Theorem: Local semantics holds iff global semantics holds:

P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

( c S. Russell & P. Norwig, AIMA)

10 / 35

(35)

( c S. Russell & P. Norwig, AIMA)

11 / 35

(36)

P(X |U

1

, .., U

m

, Y

1

, .., Y

n

, Z

1j

, ..., Z

nj

), for each X

( c S. Russell & P. Norwig, AIMA) 12 / 35

(37)

( c S. Russell & P. Norwig, AIMA)

13 / 35

(38)

Verify numerically the two previous examples:

Local Semantics Markov Blanket

14 / 35

(39)

1

Bayesian Networks

2

Constructing Bayesian Networks

3

Exact Inference with Bayesian Networks

15 / 35

(40)

Given a set of random variables 1. Choose an ordering {X

1

, ..., X

n

}

in principle, any ordering will work (but some may cause blowups) general rule: follow causality, X ≺ Y if X ∈ causes(Y )

2. For i=1 to n do

1. add X

i

to the network

2. as Parents(X

i

), choose a subset of {X

1

, ..., X

i−1

} s.t.

P(X

i

|Parents(X

i

)) = P(X

i

|X

1

, ..., X

i−1

)

=⇒ Guarantees the global semantics by construction P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

16 / 35

(41)

Given a set of random variables 1. Choose an ordering {X

1

, ..., X

n

}

in principle, any ordering will work (but some may cause blowups) general rule: follow causality, X ≺ Y if X ∈ causes(Y )

2. For i=1 to n do

1. add X

i

to the network

2. as Parents(X

i

), choose a subset of {X

1

, ..., X

i−1

} s.t.

P(X

i

|Parents(X

i

)) = P(X

i

|X

1

, ..., X

i−1

)

=⇒ Guarantees the global semantics by construction P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

16 / 35

(42)

Given a set of random variables 1. Choose an ordering {X

1

, ..., X

n

}

in principle, any ordering will work (but some may cause blowups) general rule: follow causality, X ≺ Y if X ∈ causes(Y )

2. For i=1 to n do

1. add X

i

to the network

2. as Parents(X

i

), choose a subset of {X

1

, ..., X

i−1

} s.t.

P(X

i

|Parents(X

i

)) = P(X

i

|X

1

, ..., X

i−1

)

=⇒ Guarantees the global semantics by construction P(X

1

, ..., X

N

) = Q

i=1

P(X

i

|parents(X

i

))

16 / 35

(43)

( c S. Russell & P. Norwig, AIMA)

17 / 35

(44)

( c S. Russell & P. Norwig, AIMA)

17 / 35

(45)

( c S. Russell & P. Norwig, AIMA)

17 / 35

(46)

( c S. Russell & P. Norwig, AIMA)

17 / 35

(47)

( c S. Russell & P. Norwig, AIMA)

17 / 35

(48)

Ex: 1+2+4+2+4 = 13 numbers needed (rather than 10) Can be much worse

ex: try {M, J, E, B, A} (see AIMA) Much better with causal orderings

ex: try either {B, E, A, J, M}

{E, B, A, J, M}

{B, E, A, M, J}

{E, B, A, M, J}

i.e. {B, E} ≺ A ≺ {J, M}

(both B and E cause A, A causes both M and J)

( c S. Russell & P. Norwig, AIMA) 18 / 35

(49)

Ex: 1+2+4+2+4 = 13 numbers needed (rather than 10) Can be much worse

ex: try {M, J, E, B, A} (see AIMA) Much better with causal orderings

ex: try either {B, E, A, J, M}

{E, B, A, J, M}

{B, E, A, M, J}

{E, B, A, M, J}

i.e. {B, E} ≺ A ≺ {J, M}

(both B and E cause A, A causes both M and J)

( c S. Russell & P. Norwig, AIMA) 18 / 35

(50)

Ex: 1+2+4+2+4 = 13 numbers needed (rather than 10) Can be much worse

ex: try {M, J, E, B, A} (see AIMA) Much better with causal orderings

ex: try either {B, E, A, J, M}

{E, B, A, J, M}

{B, E, A, M, J}

{E, B, A, M, J}

i.e. {B, E} ≺ A ≺ {J, M}

(both B and E cause A, A causes both M and J)

( c S. Russell & P. Norwig, AIMA) 18 / 35

(51)

Ex: 1+2+4+2+4 = 13 numbers needed (rather than 10) Can be much worse

ex: try {M, J, E, B, A} (see AIMA) Much better with causal orderings

ex: try either {B, E, A, J, M}

{E, B, A, J, M}

{B, E, A, M, J}

{E, B, A, M, J}

i.e. {B, E} ≺ A ≺ {J, M}

(both B and E cause A, A causes both M and J)

( c S. Russell & P. Norwig, AIMA) 18 / 35

(52)

add Independent failure probability q

i

for each cause U

i

=⇒ P(¬X |U

1

...U

j

, ¬U

j+1

...¬U

k

) = Q

j i=1

q

i

number of parameters linear in number of parents!

Ex: q

Cold

= 0.6, q

Flu

= 0.2, q

Malaria

= 0.1:

( c S. Russell & P. Norwig, AIMA)

19 / 35

(53)

add Independent failure probability q

i

for each cause U

i

=⇒ P(¬X |U

1

...U

j

, ¬U

j+1

...¬U

k

) = Q

j i=1

q

i

number of parameters linear in number of parents!

Ex: q

Cold

= 0.6, q

Flu

= 0.2, q

Malaria

= 0.1:

( c S. Russell & P. Norwig, AIMA)

19 / 35

(54)

add Independent failure probability q

i

for each cause U

i

=⇒ P(¬X |U

1

...U

j

, ¬U

j+1

...¬U

k

) = Q

j i=1

q

i

number of parameters linear in number of parents!

Ex: q

Cold

= 0.6, q

Flu

= 0.2, q

Malaria

= 0.1:

( c S. Russell & P. Norwig, AIMA)

19 / 35

(55)

1. Consider the probabilistic Wumpus World of previous chapter (a) Describe it as a Bayesian network

20 / 35

(56)

1

Bayesian Networks

2

Constructing Bayesian Networks

3

Exact Inference with Bayesian Networks

21 / 35

(57)

E/e: the set of evidence variables {E

1

, ..., E

m

} and of evidence values {e

1

, ..., e

m

}

Y/y: the set of unknown variables (aka hidden variables) {Y

1

, ..., Y

l

} and unknown values {y

1

, ..., y

l

}

=⇒ X = X ∪ E ∪ Y

A typical query asks for the posterior probability distribution:

P( X | E=e) (also written P( X | e))

Ex: P(Burglar |JohnCalls = true, MaryCalls = true) query: Burglar

evidence variables: E = {JohnCalls, MaryCalls}

hidden variables: Y = {Earthquake, Alarm}

22 / 35

(58)

E/e: the set of evidence variables {E

1

, ..., E

m

} and of evidence values {e

1

, ..., e

m

}

Y/y: the set of unknown variables (aka hidden variables) {Y

1

, ..., Y

l

} and unknown values {y

1

, ..., y

l

}

=⇒ X = X ∪ E ∪ Y

A typical query asks for the posterior probability distribution:

P( X | E=e) (also written P( X | e))

Ex: P(Burglar |JohnCalls = true, MaryCalls = true) query: Burglar

evidence variables: E = {JohnCalls, MaryCalls}

hidden variables: Y = {Earthquake, Alarm}

22 / 35

(59)

Inference by Enumeration

We defined a procedure for the task as:

P(X |e) = αP(X , e) = α P

y

P(X , e, y)

=⇒ P(X , e, y) can be rewritten as product of prior and conditional probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

23 / 35

(60)

Inference by Enumeration

We defined a procedure for the task as:

P(X |e) = αP(X , e) = α P

y

P(X , e, y)

=⇒ P(X , e, y) can be rewritten as product of prior and conditional probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

23 / 35

(61)

probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

( c S. Russell & P. Norwig, AIMA)

23 / 35

(62)

probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

( c S. Russell & P. Norwig, AIMA)

23 / 35

(63)

probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

( c S. Russell & P. Norwig, AIMA)

23 / 35

(64)

probabilities according to the Bayesian Network

then apply factorization and simplify algebraically when possible Ex:

P(B|j, m) = α P

e

P

a

P(B, e, a, j, m) = α P

e

P

a

P(B)P(e)P(a|B, e)P(j|a)P(m|a) = αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a)P(m|a)

=⇒ P(b|j, m) = αP(b) P

e

P(e) P

a

P(a|b, e)P(j|a)P(m|a) Recursive depth-first enumeration:

O(n) space, O(2

n

) time with n propositional variables Enumeration is inefficient: repeated computation

( c S. Russell & P. Norwig, AIMA)

23 / 35

(65)

( c S. Russell & P. Norwig, AIMA)

24 / 35

(66)

( c S. Russell & P. Norwig, AIMA)

Repeated computation: P(j|a)P(m|a) & P(j|¬a)P(m|¬a) for each value of e

25 / 35

(67)

( c S. Russell & P. Norwig, AIMA)

Repeated computation: P(j|a)P(m|a) & P(j|¬a)P(m|¬a) for each value of e

25 / 35

(68)

( c S. Russell & P. Norwig, AIMA)

Repeated computation: P(j|a)P(m|a) & P(j|¬a)P(m|¬a) for each value of e

25 / 35

(69)

( c S. Russell & P. Norwig, AIMA)

Repeated computation: P(j|a)P(m|a) & P(j|¬a)P(m|¬a) for each value of e

25 / 35

(70)

1. Consider the probabilistic Wumpus World of previous chapter (a) Describe it as a Bayesian network

(b) Compute the query P(P

1,3

|b

, p

) via enumeration (c) Compare the result with that of the example in Ch. 13

26 / 35

(71)

Inference by Variable Elimination

Variable elimination:

carry out summations right-to-left (i.e., bottom-up in the tree) store intermediate results (factors) to avoid recomputation Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

27 / 35

(72)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(73)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(74)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(75)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(76)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(77)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(78)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(79)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(80)

Ex: P(B|j, m)

= α

B

z }| { P(B) P

e E

z }| { P(e) P

a A

z }| { P(a|B, e)

J

z }| { P(j|a)

M

z }| { P(m|a)

= αP(B) P

e

P(e) P

a

P(a|B, e)P(j|a) × f

M

(A)

= αP(B) P

e

P(e) P

a

P(a|B, e) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) P

a

f

A

(A, B, E ) × f

J

(A) × f

M

(A)

= αP(B) P

e

P(e) × f

AJM

(B, E ) (sum out A)

= αP(B) P

e

f

E

(E ) × f

AJM

(B, E ) (sum out A)

= αP(B) × f

E AJM

(B) (sum out E )

= α × f

B

(B) × f

E AJM

(B)

“×” is the pointwise product (see later) f

M

(A)

def

=

 P(m| a) P(m|¬a)



, f

J

(A)

def

=

 P(j| a) P(j|¬a)

 , ...

f

A...

(.): summation over the values of A...

( c S. Russell & P. Norwig, AIMA) 27 / 35

(81)

a

n1

a

n1

... b

n1

b

n1

... a

n1

+ b

n1

a

n1

+ b

n1

...

must have the same argument variables

Pointwise product: Multiply the array elements for the same variable values

Ex:

f

J

(A) × f

M

(A) =  P(j| a) P(j|¬a)



×  P(m| a) P(m|¬a)



=  P(j| a)P(m| a) P(j|¬a)P(m|¬a)



General case:

f

3

(X

1

, ..., X

j

, Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) =

f

1

(X

1

, ..., X

j

, Y

1

, ..., Y

k

) × f

2

(Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) union of arguments

values: f

3

(x, y, z) = f

1

(x, y) · f

2

(y, z) matrix size: f

1

: 2

j+k

, f

1

: 2

k +l

, f

3

: 2

j+k +l

28 / 35

(82)

a

n1

a

n1

... b

n1

b

n1

... a

n1

+ b

n1

a

n1

+ b

n1

...

must have the same argument variables

Pointwise product: Multiply the array elements for the same variable values

Ex:

f

J

(A) × f

M

(A) =  P(j| a) P(j|¬a)



×  P(m| a) P(m|¬a)



=  P(j| a)P(m| a) P(j|¬a)P(m|¬a)



General case:

f

3

(X

1

, ..., X

j

, Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) =

f

1

(X

1

, ..., X

j

, Y

1

, ..., Y

k

) × f

2

(Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) union of arguments

values: f

3

(x, y, z) = f

1

(x, y) · f

2

(y, z) matrix size: f

1

: 2

j+k

, f

1

: 2

k +l

, f

3

: 2

j+k +l

28 / 35

(83)

a

n1

a

n1

... b

n1

b

n1

... a

n1

+ b

n1

a

n1

+ b

n1

...

must have the same argument variables

Pointwise product: Multiply the array elements for the same variable values

Ex:

f

J

(A) × f

M

(A) =  P(j| a) P(j|¬a)



×  P(m| a) P(m|¬a)



=  P(j| a)P(m| a) P(j|¬a)P(m|¬a)



General case:

f

3

(X

1

, ..., X

j

, Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) =

f

1

(X

1

, ..., X

j

, Y

1

, ..., Y

k

) × f

2

(Y

1

, ..., Y

k

, Z

1

, ..., Z

l

) union of arguments

values: f

3

(x, y, z) = f

1

(x, y) · f

2

(y, z) matrix size: f

1

: 2

j+k

, f

1

: 2

k +l

, f

3

: 2

j+k +l

28 / 35

(84)

f (B, C) =

a

f

3

(A, B, C) = f

3

(a, B, C) + f

3

(¬a, B, C) =

 0.06 0.24 0.42 0.28

 +

 0.18 0.72 0.06 0.04



=

 0.24 0.96 0.48 0.32



( c S. Russell & P. Norwig, AIMA)

29 / 35

(85)

f (B, C) =

a

f

3

(A, B, C) = f

3

(a, B, C) + f

3

(¬a, B, C) =

 0.06 0.24 0.42 0.28

 +

 0.18 0.72 0.06 0.04



=

 0.24 0.96 0.48 0.32



( c S. Russell & P. Norwig, AIMA)

29 / 35

(86)

( c S. Russell & P. Norwig, AIMA)

Efficiency depends on variable ordering O RDER (...) Efficiency improvements:

factor out of summations factors not depending on sum variable remove irrelevant variables

30 / 35

(87)

( c S. Russell & P. Norwig, AIMA)

Efficiency depends on variable ordering O RDER (...) Efficiency improvements:

factor out of summations factors not depending on sum variable remove irrelevant variables

30 / 35

(88)

( c S. Russell & P. Norwig, AIMA)

Efficiency depends on variable ordering O RDER (...) Efficiency improvements:

factor out of summations factors not depending on sum variable remove irrelevant variables

30 / 35

(89)

Factor Out Constant Factors

If f

1

, ..., f

i

do not depend on X, then move them out of a P

x

(...):

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

31 / 35

(90)

Factor Out Constant Factors

If f

1

, ..., f

i

do not depend on X, then move them out of a P

x

(...):

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

31 / 35

(91)

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

( c S. Russell & P. Norwig, AIMA)

31 / 35

(92)

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

( c S. Russell & P. Norwig, AIMA)

31 / 35

(93)

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

( c S. Russell & P. Norwig, AIMA)

31 / 35

(94)

P

x

f

1

× · · · × f

k

= f

1

× · · · × f

i

P

x

(f

i+1

× · · · × f

k

) = f

1

× · · · × f

i

× f

X

Ex: P

a

f

1

(A, B) × f

2

(B, C)

= f

2

(B, C) × P

a

F

1

(A, B)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = α P

e

P

a

P

m

P(J, m, b, e, a) = α P

e

P

a

P

m

P(b)P(e)P(a|b, e)P(J|a)P(m|a) = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) P

m

P(m|a)

( c S. Russell & P. Norwig, AIMA)

31 / 35

(95)

Remove Irrelevant Variables

Sometimes we fave summations like P

y

P(y |...) P

y

P(y |...) = 1 =⇒ can be dropped Ex: P(JohnCalls|Burglary = true):

P(J|b) = ... = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a)

1

z }| {

P

m

P(m|a) αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) Theorem: For query X and evidence E, Y is irrelevant unless Y ∈ Ancestors(X ∪ E) Ex: X = JohnCalls, E = {Burglary }, and Ancestors({X } ∪ E) = {Alarm, Earthquake}

=⇒ MaryCalls is irrelevant

Related to backward-chaining with Horn clauses

32 / 35

(96)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = ... = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a)

1

z }| {

P

m

P(m|a) αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) Theorem: For query X and evidence E, Y is irrelevant unless Y ∈ Ancestors(X ∪ E) Ex: X = JohnCalls, E = {Burglary }, and Ancestors({X } ∪ E) = {Alarm, Earthquake}

=⇒ MaryCalls is irrelevant

Related to backward-chaining with Horn clauses

( c S. Russell & P. Norwig, AIMA)

32 / 35

(97)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = ... = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a)

1

z }| {

P

m

P(m|a) αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) Theorem: For query X and evidence E, Y is irrelevant unless Y ∈ Ancestors(X ∪ E) Ex: X = JohnCalls, E = {Burglary }, and Ancestors({X } ∪ E) = {Alarm, Earthquake}

=⇒ MaryCalls is irrelevant

Related to backward-chaining with Horn clauses

( c S. Russell & P. Norwig, AIMA)

32 / 35

(98)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = ... = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a)

1

z }| {

P

m

P(m|a) αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) Theorem: For query X and evidence E, Y is irrelevant unless Y ∈ Ancestors(X ∪ E) Ex: X = JohnCalls, E = {Burglary }, and Ancestors({X } ∪ E) = {Alarm, Earthquake}

=⇒ MaryCalls is irrelevant

Related to backward-chaining with Horn clauses

( c S. Russell & P. Norwig, AIMA)

32 / 35

(99)

Ex: P(JohnCalls|Burglary = true):

P(J|b) = ... = αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a)

1

z }| {

P

m

P(m|a) αP(b) P

e

P(e) P

a

P(a|b, e)P(J|a) Theorem: For query X and evidence E, Y is irrelevant unless Y ∈ Ancestors(X ∪ E) Ex: X = JohnCalls, E = {Burglary }, and Ancestors({X } ∪ E) = {Alarm, Earthquake}

=⇒ MaryCalls is irrelevant

Related to backward-chaining with Horn clauses

( c S. Russell & P. Norwig, AIMA)

32 / 35

Riferimenti

Documenti correlati

PDDL problem: a planning domain, an initial state and a goal the initial state is a conjunction of ground atoms (positive literals). closed-world assumption: any not-mentioned atoms

planners deal with factored representations rather than atomic physical transition model is a collection of action schemata the belief state represented by a logical formula instead

agent infers the presence of certain objects from perceptual input infers category from the perceived properties of the objects, uses category information to make predictions about

Partial solution (see previous chapters): maintain belief states represent the set of all possible world states the agent might be in generating a contingency plan handling

he/she may be asked to show his/her green pass together with an ID to access DISI only if personally autorized (via the UNITN app) to follow the access rules:. to

For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept

Search techniques: systematic exploration of search space solution to problem: the path to the goal state..

use the constraints to reduce the set of legal values for a variable Constraint propagation can either:!. be interleaved