You are on page 1of 47

Definitions and issues

Particle filtering algorithms


Real applications

Introduction to particle filters:


a trajectory tracking example
Alexis Huet

23 May 2014

1/31

Alexis Huet

2/31

Definitions and issues


Particle filtering algorithms
Real applications

Outline

Definitions and issues


Markov chains
Hidden Markov models
Issues

Particle filtering algorithms


Sequential Importance Sampling algorithm
Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Real applications

Alexis Huet

3/31

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Outline

Definitions and issues


Markov chains
Hidden Markov models
Issues

Particle filtering algorithms


Sequential Importance Sampling algorithm
Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Real applications

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Markov chains
We consider the following state space : (Rn , L(Rn )).
Definition
A sequence of random variables (Xk )kN taking values in Rn is a
Markov chain if for all k 1, x0 , . . . xk1 Rn and A L(Rn ) :
P(Xk A|Xk1 = xk1 , . . . , X0 = x0 ) = P(Xk A|Xk1 = xk1 ).
Hypothesis
In the sequel, the Markov chain is homogeneous and admits a
family of density functions (p(.|x))xRn such that :
Z
P(Xk A|Xk1 = xk1 ) =
p(xk |xk1 )dxk .
A

4/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example
The state space is here R2 . For all x R2 , let B(x, 1) be the unit
ball centered in x.
Definition
For all x R2 , the distribution Unif (B(x, 1)) is defined by its
density :
1
1(. B(x, 1)).

For the initial condition, we take :


X0

Unif (B(0, 1)).

And for transition distributions :


Xk |(Xk1 = xk1 )
5/31

Alexis Huet

Unif (B(xk1 , 1)).

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

0
2

ord

Example

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

0
2

ord

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

0
2

ord

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

ord

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

ord

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

ord

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

03

ord

6
1

abs

6/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Hidden Markov models

Definition
(Xk , Yk )k0:m1 is a hidden Markov model if : (Xk )k0:m1 is a
Markov chain, (Yk )k0:m1 are independent conditionally to
(Xk )k0:m1 and for all k, Yk depends only on Xk .
Schematically, we have :

7/31

X0

X1

X2

. . . Xm1

y
y .

Y0

Y1

Y2

...

Alexis Huet

Ym1

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example

We choose (Yk ) taking values in ] , ]. Conditionally to


Xk = xk , we define :
Yk = Arg (xk ) +
where

N (0, 2 ).

Related density : yk 7 p(yk |xk ).

8/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example ( = 0.1)

03

03

2 4

ord

5 1

6
8

abs

9/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Example ( = 0.1)

03

ord

6
9

abs

10/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Markov chains
Hidden Markov models
Issues

Issues

Now, the hidden chain (xk ) is unknown and we only have the
observations (yk ).
Aim : reconstitute x0:m1 := (x0 , . . . , xm1 ) conditionally to the
observations.
Specifically, to generate a sample according to the following
density :
p(x0:m1 |y0:m1 )dx0:m1 .

11/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Outline

12/31

Definitions and issues


Markov chains
Hidden Markov models
Issues

Particle filtering algorithms


Sequential Importance Sampling algorithm
Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Real applications

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Sequential Importance Sampling (SIS) algorithm

We try to simulate a sample from the density p(x0 |y0 )dx0 .


p(x0 |y0 ) =

1
p(x0 , y0 )
=
p(y0 |x0 )p(x0 ).
p(y0 )
p(y0 )

We can generate a sample from p(x0 )dx0 .


We can compute x0 7 p(y0 |x0 ).

13/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

p(x0 |y0 )dx0 =

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

1
p(y0 |x0 )p(x0 )dx0 .
p(y0 )

SIS algorithm (first step) :


Generate a sample of length N from p(x0 )dx0 :
(1)

(N)

x0 , . . . , x0 .
Compute for each particle j :
(j)

w0 =

1
(j)
p(y0 |x0 ).
p(y0 )

(j)

The sample (
x0 )j1:N which approximates p(x0 |y0 )dx0 is :
N
X
j=1
14/31

(j)

w0
PN

(j)

(j 0 ) x0
j 0 =1 w0

Alexis Huet

(dx0 ).

Definitions and issues


Particle filtering algorithms
Real applications

p(x0 |y0 )dx0 =

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

1
p(y0 |x0 )p(x0 )dx0 .
p(y0 )

SIS algorithm (first step) :


Generate a sample of length N from p(x0 )dx0 :
(1)

(N)

x0 , . . . , x0 .
Compute for each particle j :
(j)

(j)

w0 = p(y0 |x0 ).
(j)

The sample (
x0 )j1:N which approximates p(x0 |y0 )dx0 is :
N
X
j=1
15/31

(j)

w0

(j)

(j 0 ) x0
j 0 =1 w0

PN

Alexis Huet

(dx0 ).

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SIS) N = 20

0.070.93

0.00

0.00
0.00

0.00

ord

0.00

0.00

0.00
0.00

0.00
0.00
0.00

0.000.00

0.00
0.00

0.00

0.00
0.00

1.0

0.5

0.0

0.5

1.0

1.5

abs

16/31

Alexis Huet

2.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

p(x0:i |y0:i )dx0:i =


1
p(y0 |x0 ) . . . p(yi |xi )p(x0 )p(x1 |x0 ) . . . p(xi |xi1 )dx0:i .
p(y0:i )
SIS algorithm (step i). For all particle j 1 : N :
(j)
Conditionally to xi1 , generate a sample according to
p(xi |xi1 )dxi :
(1)
(N)
xi , . . . , xi .
Compute for each particle j :
(j)

wi

(j)

(j)

= wi1 p(yi |xi ).

(j)

The sample (
x1:i )j1:N which approximates p(x1:i |yi )dx1:i is :
N
X
j=1
17/31

(j)

wi
PN

(j)

(j 0 ) x1:i
j 0 =1 wi

Alexis Huet

(dx1:i ).

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SIS) N = 20

0.070.93

0.00

0.00
0.00

0.00

ord

0.00

0.00

0.00
0.00

0.00
0.00
0.00

0.000.00

0.00
0.00

0.00

0.00
0.00

1.0

0.5

0.0

0.5

1.0

1.5

abs

18/31

Alexis Huet

2.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SIS) N = 20

0.00
0.00

0.00

0.00

0.00

ord

0.00

0.00
0.00

0.00

0.00

0.00

1.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

1.0

0.5

0.0

0.5

1.0

1.5

abs

18/31

Alexis Huet

2.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SIS) N = 20
1.00

0.00

0.00

0.00

ord

0.00

0.00

0.00

0.00

0.00

0.00

0.00
0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

1.0

0.5

0.0

0.5

1.0

1.5

abs

18/31

Alexis Huet

2.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Convergence and degeneracy problem (SIS)

Convergence :
for m the length of the chain fixed, central limit theorem
when the number of particles N +.
Degeneracy problem :
many particles have a relative weight close to 0%,
for N fixed, from a certain number of sites, only one particle
has an important relative weight.
Resampling of the particles.

19/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

p(x0 |y0 )dx0 =

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

1
p(y0 |x0 )p(x0 )dx0 .
p(y0 )

SISR algorithm (first step)


Generate a sample of length N according to p(x0 )dx0 :
(1)

(N)

x0 , . . . , x0 .
Compute for each particle j :
(j)

(j)

w0 = p(y0 |x0 ).
(j)

Generate (
x0 )j1:N from :
N
X
j=1

(j)

w0

(j)

and let (w
0 )j1:N 1.
20/31

(j)

(j 0 ) x0
j 0 =1 w0

PN

Alexis Huet

(dx0 )

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

SISR algorithm (step i). For all particle j 1 : N :


(j)

Conditionally to xi1 , generate a sample according to


p(xi |
xi1 )dxi :
(1)
(N)
xi , . . . , xi .
Compute for each particle j :
(j)

wi

(j)

(j)

(j)

=w
i1 p(yi |xi ) = p(yi |xi ).

(j)

Generate (
xi )j1:N from :
N
X
j=1

(j)

wi

(j)

and let (w
i )j1:N 1.
21/31

(j)

(j 0 ) xi
j 0 =1 wi

PN

Alexis Huet

(dxi )

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SISR)

1.0

0.00

0.00
0.00

0.00
0.00

0.00

0.72
0.00 0.28

0.00

0.00

0.00

0.0

ord

0.5

0.00

0.00
0.00

0.00

0.5

0.00

0.00
0.00

0.00
1.0

1.0

0.5

0.0

0.5

abs

22/31

Alexis Huet

1.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

1.0

Example (SISR)

0.0

1.0

0.5

ord

0.5

0.05
0.05

1.0

0.5

0.0

0.5

abs

22/31

Alexis Huet

1.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example (SISR)
0.00
1.0

0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.00

0.5

0.00

0.00
0.04
0.03

0.22

0.36
0.35

0.0

ord

0.00

0.00

0.00

1.0

0.5

1.0

0.5

0.0

0.5

abs

22/31

Alexis Huet

1.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

1.0

Example (SISR)

0.5

0.0

1.0

0.5

ord

0.05

0.05

0.05
0.05

1.0

0.5

0.0

0.5

abs

22/31

Alexis Huet

1.0

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Convergence (SISR)

Elimination of the weights degeneracy problem.


Convergence :
for m the length of the chain fixed, central limit theorem
when the number of particles N +.

23/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Example
Comparison with m = 100 sites and N = 10000 particles.
84 85
4

90

80

97
86
82
96
9883
81

87
99

95
94

88

92
93
89

91

79

78

77

74

75
73

76

72

03
4
71

5 1

67

ord

270
68

69

66

61

65

10

6
7

12 63

11
1713
18 62
8

19
60 9
14

64


59 36 38
20
2829 33
22
16
15

32

35
23
58 34
24

37

39

48

47
21
40
26 3027 49 31

25
43
57

56
46

44
55

45
50

54

53

51

52

abs

24/31

Alexis Huet

41
42

Definitions and issues


Particle filtering algorithms
Real applications

Example (SIS)

24/31

Alexis Huet

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Definitions and issues


Particle filtering algorithms
Real applications

Example (SISR)

24/31

Alexis Huet

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Definitions and issues


Particle filtering algorithms
Real applications

Example (SIS)

25/31

Alexis Huet

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Definitions and issues


Particle filtering algorithms
Real applications

Example (SISR)

25/31

Alexis Huet

Sequential Importance Sampling algorithm


Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Definitions and issues


Particle filtering algorithms
Real applications

Outline

26/31

Definitions and issues


Markov chains
Hidden Markov models
Issues

Particle filtering algorithms


Sequential Importance Sampling algorithm
Sequential Importance Sampling Resampling algorithm
Comparison of algorithms

Real applications

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Path tracking

Observations : noisy position.


Hidden states : real position.
Parameters : behavior of the moving body.

27/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Voice recognition system

Observations : a word is pronounced, cut every 15ms.


Hidden states : phonemes that led to this pronounced word.
Parameters : the set of all dictionary words.

28/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Phylogenetic analysis

Observations : DNA sequences of several species at the leafs


of a tree graph.
Hidden states : all DNA sequences from the common ancestry
sequence to the present time.
Parameters : mutation parameters, lengths of the tree
branches.

29/31

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Phylogenetic analysis

30/31

t = 1

ACGAGGTGA
ACAAGGTGA
ACAGGGTGA
ACAGGGCGA
ACAGGGCAA

t=0

ACAGGGCAA

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Phylogenetic analysis

30/31

i
t = 1

1
A
A
A
A
A

2
C
C
C
C
C

3
G
A
A
A
A

4
A
A
G
G
G

5
G
G
G
G
G

6
G
G
G
G
G

7
T
T
T
C
C

8
G
G
G
G
A

9
A
A
A
A
A

t=0

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Phylogenetic analysis

30/31

i
t = 1

1
?
?
?
?
?

2
?
?
?
?
?

3
?
?
?
?
?

4
?
?
?
?
?

5
?
?
?
?
?

6
?
?
?
?
?

7
?
?
?
?
?

8
?
?
?
?
?

9
?
?
?
?
?

t=0

Alexis Huet

Definitions and issues


Particle filtering algorithms
Real applications

Olivier Cappe, Eric Moulines, and Tobias Ryden. Inference in


hidden Markov models. Springer, 2005.
Neil Gordon, David Salmond, and Adrian Smith. Novel
approach to nonlinear/non-Gaussian Bayesian state
estimation. IEEE Proceedings F (Radar and Signal
Processing), 1993.
Lawrence Rabiner. A tutorial on hidden Markov models and
selected applications in speech recognition. Proceedings of the
IEEE, 1989.

31/31

Alexis Huet

You might also like