=
k k
k k k k
k k
D y p
D x p x y p
D x p
) | ( ) | ( ) | ( ) , | ( ) | , (
1 1 1 1
= =
k k k k k k k k k k k k
D x p x y p D x p D x y p D x y p
Bayes Filters (second pass)
1
( , )
( , )
t t t t
t t t t
x f x w
z g x v
=
=
System state dynamics
Observation dynamics
1
( ) ( | , , )
t t t
Bel x p x z z =
We are interested in: Belief or posterior density
Estimating system state from noisy observations
1:( 1) 1 1
where , ,
t t
z z z
1:( 1) 1, 1:( 1) 1 1:( 1) 1
( | ) ( | ) ( | )
t t t t t t t t
p x z p x x z p x z dx
=
}
From above, constructing two steps of Bayes Filters
1:( 1)
1:( 1) 1:( 1)
1:( 1)
( | , )
( | , ) ( | )
( | )
t t t
t t t t t
t t
p z x z
p x z z p x z
p z z
=
Predict:
Update:
1:( 1) 1, 1:( 1) 1 1:( 1) 1
( | ) ( | ) ( | )
t t t t t t t t
p x z p x x z p x z dx
=
}
1:( 1)
replace ( | , ) with ( | )
t t t t t
p z x z p z x
Predict:
Update:
Assumptions: Markov Process
1 1: 1 1
replace ( | , ) with ( | )
t t t t t
p x x z p x x
1:( 1)
1:( 1) 1:( 1)
1:( 1)
( | , )
( | , ) ( | )
( | )
t t t
t t t t t
t t
p z x z
p x z z p x z
p z z
=
1:( 1) 1:( 1)
( | , ) ( | ) ( | )
t t t t t t t t
p x z z p z x p x z o
=
Bayes Filter
1:( 1) 1 1 1:( 1) 1
( | ) ( | ) ( | )
t t t t t t t
p x z p x x p x z dx
=
}
1
( | )
( | )
t t
t t
p x x
p z x
Step 0: initialization
0 0 0
0 0 0 0
( ) or ( | )
( | ) ( )
Bel x p x z
p z x p x o =
Step 1: updating
Example 1 (continue)
1 1 1
1 1 1 0 0
( ) or ( | )
( | ) ( | )
Bel x p x z
p z x p x z o =
Step 3: updating
1
2 2 1
2 1 1 1 1
( ) or ( | )
( | ) ( | )
Bel x p x z
p x x p x z dx
=
}
Step 4: predicting
1
1 1 0
1 0 0 0 0
( ) or ( | )
( | ) ( | )
Bel x p x z
p x x p x z dx
=
}
Step 2: predicting
1
Classical approximations
Analytical methods:
Extended Kalman filter,
Gaussian sums (Alspach et al. 1971)
Perform poorly in numerous cases of interest
Numerical methods:
point masses approximations,
splines. (Bucy 1971, de Figueiro 1974)
Very complex to implement, not flexible.
Perfect Monte Carlo simulation
Recall that
Random samples are drawn from the posterior distribution.
Represent posterior distribution using a set of samples or particles.
Easy to approximate expectations of the form:
by:
) , , (
0 : 0 k k
x x x =
}
=
k k k k k
dx D x p x g x g E
: 0 : 0 : 0 : 0
) | ( ) ( )) ( (
=
=
N
i
i
k k
x g
N
x g E
1
: 0 : 0
) (
1
)) ( (
i
k
x
: 0
=
=
N
i
i
k k k k
x x
N
D x p
1
: 0 : 0 : 0
) (
1
) | ( o
=
o
where
Bayesian Importance Sampling
By drawing samples from a known easy to sample proposal
distribution we obtain:
=
=
N
i
i
k k
i
k k k
x x w D x p
1
: 0 : 0 : 0
) ( ) | ( o
) | (
: 0 k k
D x q
i
k
x
: 0
) | (
) | (
: 0
: 0
k
i
k
k
i
k
i
k
D x q
D x p
w =
where
are normalized weights.
Sequential Importance Sampling (I)
Factorizing the proposal distribution:
and remembering that the state evolution is modeled as a Markov process
we obtain a recursive estimate of the importance weights:
Factorizing is obtained by recursively applying
[
=
=
k
j
j j j k k
D x x q x q D x q
1
1 : 0 0 : 0
) , | ( ) ( ) | (
) , | (
) | ( ) | (
1 : 0
1
1
k k k
k k k k
k k
D x x q
x x p x y p
w w
=
) | ( ) , | ( ) | (
1 1 : 0 1 : 0 : 0
=
k k k k k k k
D x q D x x q D x q
Sequential Importance Sampling (SIS) Particle Filter
SIS Particle Filter Algorithm
] , } , [{ ] } , [{
1 1 1 1 k
N
i
i
k
i
k
N
i
i
k
i
k
z w x SIS w x
= =
=
for i=1:N
Draw a particle
Assign a weight
end
) , | ( ~
1 k
i
k
i
k
i
k
z x x q x
) , | (
) | ( ) | (
1 : 0
1
1
k
i
k
i
k
i
k
i
k
i
k k
i
k
i
k
D x x q
x x p x z p
w w
=
(k is index over time and i is the particle index)
Derivation of SIS weights (I)
The main idea is Factorizing :
[
=
=
k
j
j j k
x x p x p x p
1
1 0 : 0
) | ( ) ( ) (
and
[
=
=
k
j
j j k k
x y p x D p
1
: 0
) | ( ) | (
) | (
) | (
: 0
: 0
k
i
k
k
i
k
i
k
D x q
D x p
w =
) | ( ) , | ( ) | (
1 1 : 0 1 : 0 : 0
=
k k k k k k k
D x q D x x q D x q
Our goal is to expand p and q in time t
Derivation of SIS weights (II)
) ( ) | (
) ( ) | ( ) | ( ) , | (
) (
) ( ) | (
) | (
1 1
1 : 0 1 : 0 : 0 1 : 0 1 : 0 : 0
: 0
= =
k k k
k k k k k k k k
k
k k k
k k
D p D z p
x p x x p x D p x D z p
D p
x p x D p
D x p
) | (
) | ( ) | ( ) , | (
1
1 1 : 0 1 : 0 : 0 1
=
k k
k k k k k k k
D z p
D x p x x p x D z p
) ( ) | (
) ( ) | ( ) | ( ) , | (
1 1
1 : 0 1 : 0 1 1 : 0 : 0 1
=
k k k
k k k k k k k k
D p D z p
x p x D p x x p x D z p
) | ( ) | ( ) , | (
1 1 : 0 1 : 0 : 0 1
k k k k k k k
D x p x x p x D z p
) | (
) | (
) , | (
) | ( ) , | (
) | (
) | (
1 1 : 0
1 1 : 0
1 : 0
1 : 0 : 0 1
: 0
: 0
= =
k
i
k
k
i
k
k
i
k
i
k
i
k
i
k
i
k k k
k
i
k
k
i
k
i
k
D x q
D x p
D x x q
x x p x D z p
D x q
D x p
w
Derivation of SIS weights (II)
) , | (
) | ( ) , | (
1 : 0
1 : 0 : 0 1
1
k
i
k
i
k
i
k
i
k
i
k k k
i
k
D x x q
x x p x D z p
w
=
) , | (
) | ( ) | (
1
1
1
k
i
k
i
k
i
k
i
k
i
k k
i
k
i
k
z x x q
x x p x z p
w w
=
and under Markov assumptions
SIS Particle Filter Foundation
At each time step k
Random samples are drawn from the proposal distribution for i=1, , N
They represent posterior distribution using a set of samples or particles
Since the weights are given by
and q factorizes as
=
=
N
i
i
k k
i
k k k
x x w D x p
1
) ( ) | ( o
i
k
x
) , | (
1 : 0 k k k
D x x q
) | (
) | (
: 0
: 0
k
i
k
k
i
k
i
k
D x q
D x p
w =
[
=
=
k
j
j j j k k
D x x q x q D x q
1
1 : 0 0 : 0
) , | ( ) ( ) | (
Sequential Importance Sampling (II)
Choice of the proposal distribution:
Choose proposal function to minimize variance of (Doucet et al. 1999):
Although common choice is the prior distribution:
We obtain then
) , | (
1 : 0 k k k
D x x q
k
w
) , | ( ) , | (
1 : 0 1 : 0 k k k k k k
D x x p D x x q
=
) | ( ) , | (
1 1 : 0
=
k k k k k
x x p D x x q
) | (
) , | (
) | ( ) | (
1
1 : 0
1
1
i
k k
i
k
k
i
k
i
k
i
k
i
k
i
k k
i
k
i
k
x z p w
D x x q
x x p x z p
w w
= =
Illustration of SIS:
Degeneracy problems:
variance of importance ratios
increases stochastically over time (Kong et al. 1994; Doucet
et al. 1999).
In most cases then after a few iterations, all but one particle
will have negligible weight
Sequential Importance Sampling (III)
w
Time 19
w
Time 10
w
Time 1
) | ( / ) | (
: 0 : 0 k k k k
D x q D x p
Sequential Importance Sampling (IV)
Illustration of degeneracy:
w
Time 19
w
Time 10
w
Time 1
SIS - why variance increase
Suppose we want to sample from the posterior
choose a proposal density to be very close to the posterior
density
Then
and
So we expect the variance to be close to 0 to obtain
reasonable estimates
thus a variance increase has a harmful effect on accuracy
1
) | (
) | (
: 0
: 0
=
|
|
.
|
\
|
k k
k k
q
D x q
D x p
E
0 1
) | (
) | (
) | (
) | (
var
2
: 0
: 0
: 0
: 0
=
|
|
.
|
\
|
|
|
.
|
\
|
=
|
|
.
|
\
|
k k
k k
q
k k
k k
q
D x q
D x p
E
D x q
D x p
Sampling-Importance Resampling
SIS suffers from degeneracy problems so we dont want to
do that!
Introduce a selection (resampling) step to eliminate
samples with low importance ratios and multiply samples
with high importance ratios.
Resampling maps the weighted random measure
on to the equally weighted random measure
by sampling uniformly with replacement from
with probabilities
Scheme generates children such that and
satisfies:
)} (
~
, {
: 0 : 0
i
k k
i
k
x w x
} {
1 -
: 0
N x
j
k
} , , 1 ; {
: 0
N i x
i
k
=
} , , 1 ;
~
{ N i w
i
k
=
N N
N
i
i
=
=1
i
N
i
k i
w N N E
~
) ( =
)
~
1 (
~
) var(
i
k
i
k i
w w N N =
Basic SIR Particle Filter - Schematic
Initialisation
Importance
sampling step
Resampling
step
0 = k
1 + k k
)} (
~
, {
: 0 : 0
i
k k
i
k
x w x
} , {
1
: 0
N x
i
k
measurement
k
y
Extract estimate,
k
x
: 0
=
=
N
j
j
k
i
k
i
k
w w w
1
/
~
N i , , 1 =
) | ( ~
~
1
i
k k
i
k
x x q x
) , (
~
1 : 0 : 0
i
k
i
k
i
k
x x x
= and set
N i , , 1 =
Basic SIR Particle Filter algorithm (II)
Resampling step
Resample with replacement particles:
from the set:
according to the normalised importance weights,
Set
proceed to the Importance Sampling step, as the next
measurement arrives.
N
) , , 1 ; (
: 0
N i x
i
k
=
) , , 1 ;
~
(
: 0
N i x
i
k
=
i
k
w
~
1 + k k
Resampling
M
m
m
k
M
x
1
) (
1
1
,
=
)
`
x
{ }
M
m
m
k
m
k
w x
1
) ( ) (
,
=
M
m
m
k
M
x
1
) (
~
1
,
=
)
`
M
m
m
k
M
x
1
) (
1
1
,
=
+
)
`
{ }
M
m
m
k
m
k
w x
1
) (
1
) (
1
,
= + +
M
m
m
k
M
x
1
) (
1
~
1
,
=
+
)
`
M
m
m
k
M
x
1
) (
2
1
,
=
+
)
`