27
Probability Theory Review

Probability Theory Review - GitHub Pages

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Probability Theory Review

Belief representation: how do we represent our belief (hypothesis) of where the robot is located?Continuous map with single hypothesis probability distribution

Continuous map with multiple hypotheses probability distribution

Discretized map with multiple hypotheses probability distribution

Discretized topological map with with multiple hypotheses probability distribution

Belief representation

β€’ Single-hypothesis belief: The robot’s belief about its position is expressed as a single point on a mapβ€’ Advantage: no ambiguity, simplifies planning and decision makingβ€’ Disadvantage: does not represent ambiguity/uncertainty

β€’ Multi-hypothesis belief: allows the robot to track (possibly infinitely) many possible positions.

In both of the above, the beliefs are represented as probabilities

Discrete Random Variables

β€’ X denotes a random variable.

β€’ X can take on a finite number of values in {x1, x2, …, xn}.

β€’ P(X=xi), or P(xi), is the probability that the random variable Xtakes on value xi.

β€’ P(xi) is called probability mass function.

β€’ E.g.2.0)( =RainingP

Continuous Random Variables

β€’ 𝑋 takes on values in the continuum.

β€’ 𝑝(𝑋 = π‘₯), or 𝑝(π‘₯), is a probability density function.

β€’ E.g.

ò=Îb

a

dxxpbaxP )()),((

x

p(x)

Probability Density Function

Since continuous probability functions are defined for an infinite number of points over a continuous interval, the probability at a single point is always 0.

x

p(x)Magnitude of curve could be greater than 1 in some areas. The total area under the curve must add up to 1.

Joint Probability

β€’ Notationβ€’ 𝑃(𝑋 = π‘₯ π‘Žπ‘›π‘‘ π‘Œ = 𝑦) = 𝑃(π‘₯, 𝑦)

β€’ If X and Y are independent then 𝑃(π‘₯, 𝑦) = 𝑃(π‘₯) 𝑃(𝑦)

Conditional Probability

β€’ 𝑃(π‘₯ | 𝑦) is the probability of x given y

𝑃(π‘₯ | 𝑦) = / 0,1/ 1

𝑃(π‘₯, 𝑦) = 𝑃(π‘₯ | 𝑦) 𝑃(𝑦)= 𝑃(𝑦 | π‘₯) 𝑃(π‘₯)

β€’ If X and Y are independent then𝑃(π‘₯ | 𝑦) = 𝑃(π‘₯)

An ExampleRoll two dice, observe π‘₯2and π‘₯3.We know that there are 36 possible outcomes, all of which are equally likely (assuming the dice are fair).It’s easy to compute probabilities by simply counting outcomes:β€’ Probability π‘₯2 = 6:

6,1 , 6,2 , 6,3 , 6,4 , 6,5 , (6,6) β†’ 𝑃 =636

=16

β€’ Probability π‘₯2 = 6 and π‘₯3 is even:6,2 , 6,4 , (6,6) β†’ 𝑃 =

336 =

112

β€’ Probability π‘₯2is even:

(2,1), (2,2), (2,3), (2,4), (2,5), (2,6)(4,1), (4,2), (4,3), (4,4), (4,5), (4,6)(6,1), (6,2), (6,3), (6,4), (6,5), (6,6)

β†’ 𝑃 =1836

=12

Let’s apply rules of conditional and joint probabilities:Define events: 𝐴: x2 is even; 𝐡: x2 = 6; 𝐢: x3is even; 𝐷: x3 = 5From the previous page, we easily compute the following:

𝑃 𝐴 =12 , 𝑃 𝐡 =

16 , 𝑃 𝐢 =

12 , 𝑃 𝐷 =

16 .

Let’s look at some combinations of events:

β€’ 𝑃 𝐴, 𝐡 = 2C β‰  𝑃 𝐴 𝑃 𝐡 = 2

CΓ—23 =

223 β†’ NOT independent

β€’ 𝑃 𝐴, 𝐢 = FGC = 𝑃 𝐴 𝑃 𝐢 = 2

3Γ—23 β†’ independent

β€’ 𝑃 𝐡|𝐴 = /(H,I)/(H) =

JKJL= 2

G

This agrees with our intuition, since x2 = 6 in one third of the cases of x2being even:(2,1), (2,2), (2,3), (2,4), (2,5), (2,6)(4,1), (4,2), (4,3), (4,4), (4,5), (4,6)(6,1), (6,2), (6,3), (6,4), (6,5), (6,6)

Law of Total Probability

Γ₯=y

yxPxP ),()(

Γ₯=y

yPyxPxP )()|()(

Γ₯ =x

xP 1)(

Discrete case

Γ² =1)( dxxp

Continuous case

Γ²= dyypyxpxp )()|()(

Γ²= dyyxpxp ),()(

Bayes TheoremWe know that conjunction is commutative:

𝑃 𝐴, 𝐡 = 𝑃 𝐡, 𝐴

Using the definition of conditional probability:

𝑃 𝐡 𝐴 𝑃 𝐴 = 𝑃 𝐡, 𝐴 = 𝑃 𝐴, 𝐡 = 𝑃 𝐴 𝐡 𝑃 𝐡

𝑃 𝐡 𝐴 𝑃 𝐴 = 𝑃 𝐴 𝐡 𝑃(𝐡)

𝑃 𝐡 𝐴 =𝑃 𝐴 𝐡 𝑃(𝐡)

𝑃(𝐴)

Bayes TheoremWe know that conjunction is commutative:

𝑃 𝐴, 𝐡 = 𝑃 𝐡, 𝐴

Using the definition of conditional probability:

𝑃 𝐡 𝐴 𝑃 𝐴 = 𝑃 𝐡, 𝐴 = 𝑃 𝐴, 𝐡 = 𝑃 𝐴 𝐡 𝑃 𝐡

𝑃 𝐡 𝐴 𝑃 𝐴 = 𝑃 𝐴 𝐡 𝑃(𝐡)

𝑃 𝐡 𝐴 =𝑃 𝐴 𝐡 𝑃(𝐡)

𝑃(𝐴)

Example

We roll one die, and an observer tells us things about the outcome. We want to know if 𝑋 = 4.

β€’ Before we know anything, we believe 𝑃 𝑋 = 4 = 2C. PRIOR

β€’ Now, suppose the observer tells us that 𝑋is even. EVIDENCE

𝑃 𝑋 = 4 𝑋 even) = /(PQR,P STSU)/(P STSU)

=JKJL= 2

GBAYES

β€’ We could also use Bayes to infer 𝑃 𝑋 = even 𝑋 = 4):

𝑃 𝑋 even 𝑋 = 4) =𝑃(𝑋 = 4, 𝑋 even)

𝑃(𝑋 = 4)=1616= 1

)( yxp

evidenceprior likelihood

)()()|()( Γ—==

yPxPxyPyxP

Posterior (conditional) probability distribution

)( xyp

)(xp Prior probability distribution

Likelihood, model of the characteristics of the event

)(yp

Γ 

Γ 

Γ 

Γ 

Evidence, does not depend on x

Bayes Rule

𝒙 is robot pose and π’š is sensor data

Bayes Rule

evidenceprior likelihood

)()()|()( Γ—==

yPxPxyPyxPÞ

Γ₯=

xxPxyPxPxyPyxP)()|()()|()(Þ

About likelihoods…

Why do we call the conditional probability 𝑝(𝑦|π‘₯) a likelihood, but we call 𝑝(π‘₯|𝑦) the posterior??

We define the likelihood β„’(π‘₯) to be a function of π‘₯, not a function of 𝑦 :

β„’ π‘₯ = 𝑝 𝑦 π‘₯

Note: β„’ π‘₯ is not a probability. In particular,

Y0

β„’ π‘₯ β‰  1

Normalization Coefficient

𝑃 π‘₯ 𝑧 =𝑃 𝑧 π‘₯ 𝑃(π‘₯)

𝑃(𝑧)

Note that the denominator is independent of π‘₯, and as a result will typically be the same for any value of π‘₯in the posterior 𝑃 π‘₯ 𝑧 .

Therefore, we typically represent the normalization term by the coefficient πœ‚ = [𝑃 𝑧 ]^2 and Bayes equation is written as

𝑃 π‘₯ 𝑧 = πœ‚π‘ƒ 𝑧 π‘₯ 𝑃(π‘₯)

Simple Example of State Estimation

β€’ Suppose a robot obtains measurement 𝑧 (e.g., distance sensor reports an obstacle 40cm in front of the robot)β€’ What is 𝑃(π‘œπ‘π‘’π‘›|𝑧)?

Causal vs. Diagnostic Reasoning

β€’ 𝑃(π‘œπ‘π‘’π‘›|𝑧) is diagnostic.β€’ 𝑃(𝑧|π‘œπ‘π‘’π‘›) is causal.β€’ Often causal knowledge is easier to obtain.β€’ Bayes rule allows us to use causal knowledge:

)()()|()|( zP

openPopenzPzopenP =

Comes from sensor model.

Use law of total probability: 𝑃 𝑧 = βˆ‘1𝑃 𝑧 𝑦 𝑃(𝑦)

Example

} P(z|open) = 0.6 P(z|Β¬open) = 0.3} P(open) = P(Β¬open) = 0.5

67.032

5.03.05.06.05.06.0)|(

)()|()()|()()|()|(

==Γ—+Γ—

Γ—=

¬¬+=

zopenP

openpopenzPopenpopenzPopenPopenzPzopenP

𝑧 raises the probability that the door is open.

)()()|()|( zP

openPopenzPzopenP =

Lets try the measurement again…

𝑃 π‘₯ 𝑧 = πœ‚ 𝑃 𝑧 π‘₯ 𝑃(π‘₯)

𝑃 π‘œπ‘π‘’π‘› 𝑧2 = πœ‚ 𝑃 𝑧2 π‘œπ‘π‘’π‘› 𝑃(π‘œπ‘π‘’π‘›)

𝑃 π‘œπ‘π‘’π‘› 𝑧2 = πœ‚ 0.6 βˆ— 0.5 = πœ‚ 0.3Given information:𝑃(𝑧2|π‘œπ‘π‘’π‘›) = 0.6𝑃(𝑧2|π‘π‘™π‘œπ‘ π‘’π‘‘) = 0.3𝑃(π‘œπ‘π‘’π‘›) = 0.5𝑃(π‘π‘™π‘œπ‘ π‘’π‘‘) = 0.5

Unlike before, we don’t yet have the answer because we still have the unknown term πœ‚ that indicates that we need to normalize to get the true probability.

𝑃 π‘π‘™π‘œπ‘ π‘’π‘‘ 𝑧2 = πœ‚ 𝑃 𝑧2 π‘π‘™π‘œπ‘ π‘’π‘‘ 𝑃(π‘π‘™π‘œπ‘ π‘’π‘‘)

𝑃 π‘π‘™π‘œπ‘ π‘’π‘‘ 𝑧2 = πœ‚ 0.3 βˆ— 0.5 = πœ‚ 0.15

πœ‚ = 0.3 + 0.15 ^2 = 2.22

𝑷 𝒐𝒑𝒆𝒏 π’›πŸ = 𝟎. πŸ”πŸ•

Combining Evidence

β€’ Suppose our robot obtains another observation z2. e.g. we made a second sensor reading with the same sensor, and it reports an obstacle 35cm away

β€’ How can we integrate this new information?

β€’ More generally, how can we estimateP(x| z1...zn )?

Generalizing the Conditionwith Bayes Theorem

𝑃 π‘₯ 𝑧, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘” =𝑃 𝑧 π‘₯, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)𝑃(π‘₯|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃(𝑧|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃 π‘₯ 𝑧 =𝑃 𝑧 π‘₯ 𝑃(π‘₯)

𝑃(𝑧)

In fact, we can add any arbitrary context variables on the right side of the conditioning bar, so long as we apply them in every term.

The usual version of Bayes is conditioned on a single event:

Multiple Measurements

𝑃 π‘₯ 𝑧, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘” =𝑃 𝑧 π‘₯, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)𝑃(π‘₯|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃(𝑧|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃 π‘₯ 𝑧3, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘” =𝑃 𝑧3 π‘₯, π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)𝑃(π‘₯|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃(𝑧3|π΄π‘›π‘¦π‘‘β„Žπ‘–π‘›π‘”)

𝑃 π‘₯ 𝑧3, 𝑧2 =𝑃 𝑧3 π‘₯, 𝑧2)𝑃(π‘₯|𝑧2)

𝑃(𝑧3|𝑧2)

At time 𝑑 = 2, everything earlier is merely context information.

Multiple Measurements (cont)

𝑃 π‘₯ 𝑧3, 𝑧2 =𝑃 𝑧3 π‘₯, 𝑧2)𝑃(π‘₯|𝑧2)

𝑃(𝑧3|𝑧2)

At time 𝑑 = 2β€’ 𝑃(π‘₯|𝑧2) is the prior… what we believe about the state π‘₯, based on

history of measurements before 𝑑 = 2β€’ 𝑃 π‘₯ 𝑧3, 𝑧2 is the posterior… what we believe about the state π‘₯,

based on history of measurements, including 𝑑 = 2β€’ 𝑃 𝑧3 π‘₯, 𝑧2) … If we really know the state π‘₯, then what we measured

at time 𝑑 = 1 won’t affect what we expect to measure at time 𝑑 = 2

Reference

β€’ Probabilistic Robotics by Thrun, Burgard and Fox.. Chapter 2 (available on Piazza)