A Probability Primer for Robotics Students

A Probability Primer
for Robotics Students
Wolfram Burgard
University of Freiburg
Department of Computer Science
Germany
[email protected]
http://www.informatik.uni-freiburg.de/~burgard
Tutorial Goal
To familiarize you with
probabilistic paradigm in robotics
n
n
n
n
n
Axioms
Basic techniques
Bayes rule
Recursive Bayesian updating
Bayes filters
1
Robots are Inherently
Uncertain
n
Uncertainty arises from four major
factors:
Environment stochastic, unpredictable
n Robot stochastic
n Sensor limited, noisy
n Models inaccurate
n
Nature of Sensor Data
Odometry Data
Range Data
2
Advantages of Probabilistic
Paradigm
Can accommodate inaccurate models
n Can accommodate imperfect sensors
n Robust in real-world applications
n Best known approach to many hard
robotics problems
n
Pitfalls
Computationally demanding
n False assumptions
n Approximate
n
3
Axioms of Probability Theory
Pr(A) denotes probability that proposition A is true.
n
0 ≤ Pr( A) ≤ 1
n
Pr(True) = 1
n
Pr( A ∨ B) = Pr( A) + Pr( B) − Pr( A ∧ B)
Pr( False) = 0
A Closer Look at Axiom 3
Pr( A ∨ B) = Pr( A) + Pr( B) − Pr( A ∧ B)
True
A
A∧ B
B
B
4
Using the Axioms
Pr( A ∨ ¬A) = Pr( A) + Pr(¬A) − Pr( A ∧ ¬A)
Pr(True)
=
Pr( A) + Pr(¬A) − Pr( False)
1
Pr(¬A)
=
=
Pr( A) + Pr(¬A) − 0
1 − Pr( A)
Discrete Random Variables
n
X denotes a random variable.
n
X can take on a finite number of values in
{x1, x2, …, xn}.
n
P(X=xi), or P(xi), is the probability that the
random variable X takes on value xi.
n
P(.) is called probability mass function.
n
E.g.
P( Room) = 0.7,0.2,0.08,0.02
5
Continuous Random Variables
n
X takes on values in the continuum.
n
p(X=x), or p(x), is a probability density
function.
b
Pr( x ∈ [a , b]) = ∫ p ( x) dx
a
p(x)
n
E.g.
x
Joint and Conditional Probability
n
P(X=x and Y=y) = P(x,y)
n
If X and Y are independent then
P(x,y) = P(x) P(y)
n
P(x | y) is the probability of x given y
P(x | y) = P(x,y) / P(y)
P(x,y) = P(x | y) P(y)
n
If X and Y are independent then
P(x | y) = P(x)
6
Law of Total Probability, Marginals
Discrete case
Continuous case
∑ P ( x) = 1
∫ p( x) dx = 1
P ( x) = ∑ P( x, y )
p ( x) = ∫ p ( x, y ) dy
P ( x) = ∑ P( x | y ) P ( y)
p ( x) = ∫ p ( x | y) p ( y ) dy
x
y
y
Bayes Formula
P ( x, y ) = P ( x | y ) P ( y ) = P ( y | x ) P ( x )
⇒
P( x y) =
P( y | x) P( x) likelihood ⋅ prior
=
P( y )
evidence
7
Normalization
P ( y | x) P( x)
= η P ( y | x) P( x)
P( y)
1
η = P ( y ) −1 =
∑ P ( y | x )P ( x )
P(x y) =
x
Algorithm:
∀x : aux x| y = P( y | x) P( x)
η=
1
∑ aux x| y
x
∀x : P ( x | y ) = η aux x| y
Conditioning
n
Total probability:
P( x y ) = ∫ P ( x | y, z ) P ( z | y ) dz
n
Bayes rule and background knowledge:
P ( x | y, z ) =
P ( y | x, z ) P ( x | z )
P( y | z )
8
Simple Example of State Estimation
n
n
Suppose a robot obtains measurement z
What is P(open|z)?
Causal vs. Diagnostic Reasoning
P(open|z) is diagnostic.
n P(z|open) is causal.
n Often causal knowledge is easier to
obtain.
count frequencies!
n Bayes rule allows us to use causal
knowledge:
n
P(open | z ) =
P( z | open) P(open)
P( z )
9
Example
n
n
P(z|open) = 0.6
P(z|¬open) = 0.3
P(open) = P(¬open) = 0.5
P(open | z ) =
P( z | open) P(open )
P( z | open) p (open) + P( z | ¬open) p (¬open)
P(open | z ) =
0.6 ⋅ 0.5
2
= = 0.67
0.6 ⋅ 0.5 + 0.3 ⋅ 0.5 3
• z raises the probability that the door is open.
Combining Evidence
n
Suppose our robot obtains another
observation z2.
n
How can we integrate this new
information?
n
More generally, how can we estimate
P(x| z1...zn )?
10
Recursive Bayesian Updating
P( x | z1, K , zn) =
P( zn | x, z1, K, zn − 1) P ( x | z1, K, zn − 1)
P( zn | z1, K , zn − 1)
Markov assumption: zn is independent of z1,...,zn-1 if
we know x.
P ( x | z1, K, zn) =
P ( zn | x) P ( x | z1, K , zn − 1)
P ( zn | z1, K , zn − 1)
= η P ( zn | x ) P( x | z1, K , zn − 1)
= η1...n
∏ P ( z | x ) P( x)
i
i =1... n
Example: Second Measurement
n
P(z2|open) = 0.5
n
P(open|z1)=2/3
P(open | z 2 , z1 ) =
P(z2|¬open) = 0.6
P ( z 2 | open) P(open | z1 )
P( z 2 | open) P(open | z1 ) + P( z 2 | ¬open) P(¬open | z1 )
1 2
⋅
5
2 3
=
=
= 0.625
1 2 3 1
8
⋅ + ⋅
2 3 5 3
• z2 lowers the probability that the door is open.
11
A Typical Pitfall
Two possible locations x1 and x2
n P(x1)=0.99
n P(z|x2)=0.09 P(z|x1)=0.07
n
1
p(x2 | d)
p(x1 | d)
0.9
0.8
0.7
p( x | d)
0.6
0.5
0.4
0.3
0.2
0.1
0
5
10
15
20
25
30
Number of integrations
35
40
45
50
Actions
n
Often the world is dynamic since
actions carried out by the robot,
n actions carried out by other agents,
n or just the time passing by
n
change the world.
n
How can we incorporate such
actions?
12
Typical Actions
n
n
n
n
n
The robot turns its wheels to move
The robot uses its manipulator to grasp
an object
Plants grow over time…
Actions are never carried out with
absolute certainty.
In contrast to measurements, actions
generally increase the uncertainty.
Modeling Actions
n
To incorporate the outcome of an
action u into the current “belief”, we
use the conditional pdf
P(x|u,x’)
n
This term specifies the pdf that
executing u changes the state
from x’ to x.
13
Example: Closing the door
State Transitions
P(x|u,x’) for u = “close door”:
0.9
0.1
open
closed
1
0
If the door is open, the action “close
door” succeeds in 90% of all cases.
14
Integrating the Outcome of Actions
Continuous case:
P( x | u ) = ∫ P ( x | u, x' ) P ( x' )dx'
Discrete case:
P ( x | u ) = ∑ P ( x | u , x' ) P( x ' )
Example: The Resulting Belief
P(closed | u ) = ∑ P(closed | u, x' ) P( x' )
= P(closed | u, open) P(open)
+ P (closed | u, closed ) P(closed )
9 5 1 3 15
= ∗ + ∗ =
10 8 1 8 16
P(open | u ) = ∑ P(open | u, x' ) P( x' )
= P(open | u , open) P(open)
+ P (open | u, closed ) P(closed )
1 5 0 3 1
= ∗ + ∗ =
10 8 1 8 16
= 1 − P(closed | u )
15
Bayes Filters: Framework
n
Given:
n Stream of observations z and action data u:
d t = {u1 , z2 K, ut −1 , zt }
n
n
n
n
Sensor model P(z|x).
Action model P(x|u,x’).
Prior probability of the system state P(x).
Wanted:
n Estimate of the state X of a dynamical system.
n The posterior of the state is also called Belief:
Bel ( xt ) = P ( xt | u1 , z2 K, ut −1 , zt )
Markov Assumption
Zt-1
Xt-1
Zt+1
Zt
ut-1
Xt
ut
Xt+1
p(dt ,dt−1,...,d0 | xt ,dt+1,dt+2, ...) = p(dt , dt−1,...,d0 | xt )
p(dt ,dt+1,...| xt ,d1,d2,...,dt−1) = p(dt ,dt+1,...| xt )
p( xt | ut −1 , xt −1 , d t − 2 ,..., d 0 ) = p ( xt | ut −1 , xt −1 )
Underlying Assumptions
n Static world
n Independent noise
n Perfect model, no approximation errors
16
Bayes Filters
z = observation
u = action
x = state
Bel ( xt ) = P ( xt | u1 , z2 K, ut −1 , zt )
Bayes
= η P( zt | xt , u1 , z2 , K , ut −1 ) P( xt | u1 , z2 , K , ut −1 )
Markov
= η P( zt | xt ) P( xt | u1 , z 2 , K , ut −1 )
Total prob.
Markov
= η P( zt | xt ) ∫ P( xt | u1 , z2 , K , ut −1 , xt −1 )
P( xt −1 | u1 , z 2 , K, ut −1 ) dxt −1
= η P( zt | xt ) ∫ P( xt | ut −1 , xt −1 ) P( xt −1 | u1 , z2 , K , ut −1 ) dxt −1
= η P( zt | xt ) ∫ P( xt | ut −1 , xt −1 ) Bel ( xt −1 ) dxt −1
Bel ( xt ) = η Filter
P( zt | xt ) ∫ Algorithm
P( xt | ut −1 , xt −1 ) Bel ( xt −1 ) dxt −1
Bayes
1.
2.
Algorithm Bayes_filter( Bel(x),d ):
η=0
3.
4.
5.
6.
7.
8.
if d is a perceptual data item z then
For all x do
9.
else if d is an action data item u then
Bel ' ( x ) = P( z | x) Bel ( x )
η = η + Bel ' ( x)
For all x do
Bel ' ( x ) = η −1Bel ' ( x)
10.
11.
For all x do
12.
return Bel’(x)
Bel ' ( x ) = ∫ P( x | u , x' ) Bel ( x ' ) dx '
17
Bayes Filters are Familiar!
Bel ( xt ) = η P( zt | xt ) ∫ P( xt | ut −1 , xt −1 ) Bel ( xt −1 ) dxt −1
n
n
n
n
n
Kalman filters
Particle filters
Hidden Markov models
Dynamic Bayes networks
Partially Observable Markov Decision
Processes (POMDPs)
Application
n
n
n
n
n
Estimate the opening angle of a door
and the state of other dynamic objects
using a laser-range finder
from a moving mobile robot and
based on Bayes filters.
[Schulz et al., 01]
18
Result
[Schulz et al., 01]
Lessons Learned
n
Bayes rule allows us to compute
probabilities that are hard to assess
otherwise.
n
Under the Markov assumption,
recursive Bayesian updating can be
used to efficiently combine evidence.
n
Bayes filters are a probabilistic tool
for estimating the state of dynamic
systems.
19