An introduction to particle filters€¦ · Anintroductiontoparticlefilters AndreasSvensson...

Preview:

Citation preview

An introduction to particle filters

Andreas Svensson

Department of Information Technology

Uppsala University

June 10, 2014

June 10, 2014, 1 / 16 Andreas Svensson - An introduction to particle filters

OutlineMotivation and ideas

Algorithm

High-level

Matlab code

Practical aspects

Resampling

Computational complexity

Software

Terminology

Advanced topics

Convergence

Extensions

References

June 10, 2014, 2 / 16 Andreas Svensson - An introduction to particle filters

State Space Models

I Linear Gaussian state space model

xt+1 = Axt + But + wt

yt = Cxt + Dut + et

with wt and et Gaussian and E[wtwT

t]= Q, E

[eteT

t]= R.

I A more general state space model in different notation

xt+1 ∼ f (xt+1|xt , ut)

yt ∼ g(yt |xt , ut)

June 10, 2014, 3 / 16 Andreas Svensson - An introduction to particle filters

State Space Models

I Linear Gaussian state space model

xt+1 = Axt + But + wt

yt = Cxt + Dut + et

with wt and et Gaussian and E[wtwT

t]= Q, E

[eteT

t]= R.

I A more general state space model in different notation

xt+1 ∼ f (xt+1|xt , ut)

yt ∼ g(yt |xt , ut)

June 10, 2014, 3 / 16 Andreas Svensson - An introduction to particle filters

State Space Models

I Linear Gaussian state space model

xt+1 = Axt + But + wt

yt = Cxt + Dut + et

with wt and et Gaussian and E[wtwT

t]= Q, E

[eteT

t]= R.

I A more general state space model in different notation

xt+1 ∼ f (xt+1|xt , ut)

yt ∼ g(yt |xt , ut)

June 10, 2014, 3 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter! ''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter ''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter! ''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter ''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter!

''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter ''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter!

''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter ''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter!

''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, …

''Exact solution to the wrong problem''

I Particle filter

''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter! ''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, …

''Exact solution to the wrong problem''

I Particle filter

''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter! ''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter

''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Filtering - Find p(xt|y1:t)

Linear Gaussian problems:

I Kalman filter! ''Exact solution to the right problem''

Nonlinear problems:

I EKF, UKF, … ''Exact solution to the wrong problem''I Particle filter ''Approximate solution to the right problem''

June 10, 2014, 4 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

A linear system - Find p(xt|y1:t) (true xt shown)!

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

Kalman filter mean

Kalman filter mean

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

Kalman filter mean

Kalman filter covariance

Kalman filter mean and covariance

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

Kalman filter mean

Kalman filter covariance

Kalman filter mean and covariance defines a Gaussian distribution at each t

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

A numerical approximation can be used to describe the distribution - Particle Filter

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Time

Sta

te

True state tracejctory

The Particle Filter can easily handle, e.g., non-gaussian multimodal hypotheses

June 10, 2014, 5 / 16 Andreas Svensson - An introduction to particle filters

Idea

Generate a lot of hypotheses about xt , keep the most likely ones andpropagate them further to xt+1. Keep the likely hypotheses about

xt+1, propagate them again to xt+2, etc.

June 10, 2014, 6 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

xit+1 from f (·|xi

t , ut)for i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

0 x(:,1) = random(i_dist,N,1);w(:,1) = ones(N,1)/N;

for t = 1:T

1 w(:,t) =pdf(m_dist,y(t)-g(x(:,t)));w(:,t) =w(:,t)/sum(w(:,t));

2 Resample x(:,t)3 x(:,t+1) = f(x(:,t),u(t))

+ random(t_dist,N,1);

end

June 10, 2014, 7 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

xit+1 from f (·|xi

t , ut)for i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

0 x(:,1) = random(i_dist,N,1);w(:,1) = ones(N,1)/N;

for t = 1:T

1 w(:,t) =pdf(m_dist,y(t)-g(x(:,t)));w(:,t) =w(:,t)/sum(w(:,t));

2 Resample x(:,t)3 x(:,t+1) = f(x(:,t),u(t))

+ random(t_dist,N,1);

end

June 10, 2014, 7 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

→0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

→1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

→2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

→3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

→1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

→2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

→3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

→1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

→2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

→3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

→1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

→2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

→3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

→1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

→2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

→3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Algorithm

0 Initialize xi1 ∼ p(x1) and

wi =1N for i = 1, . . . ,N

for t = 1 to T

1 Evaluate wit = g(yt|xi

t , ut)for i = 1, . . . ,N

2 Resample {xit}N

i=1 from

{xit ,wi

t}Ni=1

3 Propagate xit by sampling

from f (·|xit−1, ut−1) for

i = 1, . . . ,N

end

N Number of particles,

xit Particles,

wit Particle weights

5 10 15 20−30

−25

−20

−15

−10

−5

0

5

10

15

Time

Sta

te x

June 10, 2014, 8 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) …

with the N red dots (of equal sizes)

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) …

with the N red dots (of equal sizes)

state

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) … with the N red dots (of equal sizes)

state

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) … with the N red dots (of equal sizes)

state

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) … with the N red dots (of equal sizes)

state

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling

I Represent the information contained in the N black dots (of

different sizes) … with the N red dots (of equal sizes)

state

I Can be seen as sampling from a cathegorical distribution

I To avoid particle depletion (''a lot of 0-weights particles'')

I Some Matlab code:

v = rand(N,1); wc = cumsum(w(:,t)); [ ,ind1] = sort([v;wc]);ind=find(ind1<=N)-(0:N-1)'; x(:,t)=x(ind,t);w(:,t)=ones(N,1)./N;

June 10, 2014, 9 / 16 Andreas Svensson - An introduction to particle filters

Resampling cont'd

I Crucial step in the development in the 90's for making particle

filters useful in practice

I Many different techniques exists with different properties and

effiency (the Matlab code shown was only one way of doing it)

I Computationally heavy. Not necessary to do in every iteration -

a ''depletion measure'' can be introduced, and the resampling

only performed when it reaches a certain threshold.

I It is sometimes preferred to use the logarithms of the weights

for numerical reasons.

June 10, 2014, 10 / 16 Andreas Svensson - An introduction to particle filters

Resampling cont'd

I Crucial step in the development in the 90's for making particle

filters useful in practice

I Many different techniques exists with different properties and

effiency (the Matlab code shown was only one way of doing it)

I Computationally heavy. Not necessary to do in every iteration -

a ''depletion measure'' can be introduced, and the resampling

only performed when it reaches a certain threshold.

I It is sometimes preferred to use the logarithms of the weights

for numerical reasons.

June 10, 2014, 10 / 16 Andreas Svensson - An introduction to particle filters

Resampling cont'd

I Crucial step in the development in the 90's for making particle

filters useful in practice

I Many different techniques exists with different properties and

effiency (the Matlab code shown was only one way of doing it)

I Computationally heavy. Not necessary to do in every iteration -

a ''depletion measure'' can be introduced, and the resampling

only performed when it reaches a certain threshold.

I It is sometimes preferred to use the logarithms of the weights

for numerical reasons.

June 10, 2014, 10 / 16 Andreas Svensson - An introduction to particle filters

Resampling cont'd

I Crucial step in the development in the 90's for making particle

filters useful in practice

I Many different techniques exists with different properties and

effiency (the Matlab code shown was only one way of doing it)

I Computationally heavy. Not necessary to do in every iteration -

a ''depletion measure'' can be introduced, and the resampling

only performed when it reaches a certain threshold.

I It is sometimes preferred to use the logarithms of the weights

for numerical reasons.

June 10, 2014, 10 / 16 Andreas Svensson - An introduction to particle filters

Resampling cont'd

I Crucial step in the development in the 90's for making particle

filters useful in practice

I Many different techniques exists with different properties and

effiency (the Matlab code shown was only one way of doing it)

I Computationally heavy. Not necessary to do in every iteration -

a ''depletion measure'' can be introduced, and the resampling

only performed when it reaches a certain threshold.

I It is sometimes preferred to use the logarithms of the weights

for numerical reasons.

June 10, 2014, 10 / 16 Andreas Svensson - An introduction to particle filters

Computational complexity

In theory O(NTn2x) (nx is the number of states)

(Kalman filter is approx. of order O(Tn3x))

Possible bottlenecks:

I Resampling stepI Likelihood evaluation (for the weight evaluation)I Sampling from f for the propagation (trick: use proposaldistributions!)

June 10, 2014, 11 / 16 Andreas Svensson - An introduction to particle filters

Computational complexity

In theory O(NTn2x) (nx is the number of states)

(Kalman filter is approx. of order O(Tn3x))

Possible bottlenecks:

I Resampling stepI Likelihood evaluation (for the weight evaluation)I Sampling from f for the propagation (trick: use proposaldistributions!)

June 10, 2014, 11 / 16 Andreas Svensson - An introduction to particle filters

Computational complexity

In theory O(NTn2x) (nx is the number of states)

(Kalman filter is approx. of order O(Tn3x))

Possible bottlenecks:

I Resampling stepI Likelihood evaluation (for the weight evaluation)I Sampling from f for the propagation (trick: use proposaldistributions!)

June 10, 2014, 11 / 16 Andreas Svensson - An introduction to particle filters

Computational complexity

In theory O(NTn2x) (nx is the number of states)

(Kalman filter is approx. of order O(Tn3x))

Possible bottlenecks:

I Resampling stepI Likelihood evaluation (for the weight evaluation)I Sampling from f for the propagation (trick: use proposaldistributions!)

June 10, 2014, 11 / 16 Andreas Svensson - An introduction to particle filters

Software

Lot of software packages exists. However, to my knowledge, no

package that ''everybody'' uses. (In our research, we write our own

code.)

A few relevant existing packages:

I Python: pyParticleEst

I Matlab: PFToolbox, PFLib

I C++: Particle++

Disclaimer: I have not used any of these packages myself

June 10, 2014, 12 / 16 Andreas Svensson - An introduction to particle filters

Software

Lot of software packages exists. However, to my knowledge, no

package that ''everybody'' uses. (In our research, we write our own

code.)

A few relevant existing packages:

I Python: pyParticleEst

I Matlab: PFToolbox, PFLib

I C++: Particle++

Disclaimer: I have not used any of these packages myself

June 10, 2014, 12 / 16 Andreas Svensson - An introduction to particle filters

Software

Lot of software packages exists. However, to my knowledge, no

package that ''everybody'' uses. (In our research, we write our own

code.)

A few relevant existing packages:

I Python: pyParticleEst

I Matlab: PFToolbox, PFLib

I C++: Particle++

Disclaimer: I have not used any of these packages myself

June 10, 2014, 12 / 16 Andreas Svensson - An introduction to particle filters

Terminology

Bootstrap particle filter ≈ ''Standard'' particle filter

Sequential Monte Carlo (SMC) ≈ Particle filter

June 10, 2014, 13 / 16 Andreas Svensson - An introduction to particle filters

Terminology

Bootstrap particle filter ≈ ''Standard'' particle filter

Sequential Monte Carlo (SMC) ≈ Particle filter

June 10, 2014, 13 / 16 Andreas Svensson - An introduction to particle filters

Terminology

Bootstrap particle filter ≈ ''Standard'' particle filter

Sequential Monte Carlo (SMC) ≈ Particle filter

June 10, 2014, 13 / 16 Andreas Svensson - An introduction to particle filters

Convergence

The particle filter is ''exact for N = ∞''

Consider a function g(xt) of interest. How well can it be

approximated as g(xt) when xt is estimated in a particle filter?

E [g(xt)− E [g(xt)]]2 ≤ pt‖g(xt)‖sup

NIf the system ''forgets exponentially fast'' (e.g. linear systems),

and some additional weak assumptions, pt = p < ∞, i.e.,

E [g(xt)− E [g(xt)]]2 ≤ C

N

June 10, 2014, 14 / 16 Andreas Svensson - An introduction to particle filters

Convergence

The particle filter is ''exact for N = ∞''

Consider a function g(xt) of interest. How well can it be

approximated as g(xt) when xt is estimated in a particle filter?

E [g(xt)− E [g(xt)]]2 ≤ pt‖g(xt)‖sup

NIf the system ''forgets exponentially fast'' (e.g. linear systems),

and some additional weak assumptions, pt = p < ∞, i.e.,

E [g(xt)− E [g(xt)]]2 ≤ C

N

June 10, 2014, 14 / 16 Andreas Svensson - An introduction to particle filters

Convergence

The particle filter is ''exact for N = ∞''

Consider a function g(xt) of interest. How well can it be

approximated as g(xt) when xt is estimated in a particle filter?

E [g(xt)− E [g(xt)]]2 ≤ pt‖g(xt)‖sup

NIf the system ''forgets exponentially fast'' (e.g. linear systems),

and some additional weak assumptions, pt = p < ∞, i.e.,

E [g(xt)− E [g(xt)]]2 ≤ C

N

June 10, 2014, 14 / 16 Andreas Svensson - An introduction to particle filters

Convergence

The particle filter is ''exact for N = ∞''

Consider a function g(xt) of interest. How well can it be

approximated as g(xt) when xt is estimated in a particle filter?

E [g(xt)− E [g(xt)]]2 ≤ pt‖g(xt)‖sup

N

If the system ''forgets exponentially fast'' (e.g. linear systems),

and some additional weak assumptions, pt = p < ∞, i.e.,

E [g(xt)− E [g(xt)]]2 ≤ C

N

June 10, 2014, 14 / 16 Andreas Svensson - An introduction to particle filters

Convergence

The particle filter is ''exact for N = ∞''

Consider a function g(xt) of interest. How well can it be

approximated as g(xt) when xt is estimated in a particle filter?

E [g(xt)− E [g(xt)]]2 ≤ pt‖g(xt)‖sup

NIf the system ''forgets exponentially fast'' (e.g. linear systems),

and some additional weak assumptions, pt = p < ∞, i.e.,

E [g(xt)− E [g(xt)]]2 ≤ C

N

June 10, 2014, 14 / 16 Andreas Svensson - An introduction to particle filters

Extensions

I Smoothing: Finding p(xt |y1:T ) (marginal smoothing) orp(x1:t |y1:T ) (joint smoothing) instead of p(xt |y1:t) (filtering).Offline (y1:T has to be available). Increased computational load.

I If f (xt+1|xt , ut) is not suitable to sample from, proposaldistributions can be used. In fact, an optimal proposal (w.r.t.

reduced variance) exists.

I Rao-Blackwellization for mixed linear/nonlinear models.

I System identification: PMCMC, SMC2.

June 10, 2014, 15 / 16 Andreas Svensson - An introduction to particle filters

Extensions

I Smoothing: Finding p(xt |y1:T ) (marginal smoothing) orp(x1:t |y1:T ) (joint smoothing) instead of p(xt |y1:t) (filtering).Offline (y1:T has to be available). Increased computational load.

I If f (xt+1|xt , ut) is not suitable to sample from, proposaldistributions can be used. In fact, an optimal proposal (w.r.t.

reduced variance) exists.

I Rao-Blackwellization for mixed linear/nonlinear models.

I System identification: PMCMC, SMC2.

June 10, 2014, 15 / 16 Andreas Svensson - An introduction to particle filters

Extensions

I Smoothing: Finding p(xt |y1:T ) (marginal smoothing) orp(x1:t |y1:T ) (joint smoothing) instead of p(xt |y1:t) (filtering).Offline (y1:T has to be available). Increased computational load.

I If f (xt+1|xt , ut) is not suitable to sample from, proposaldistributions can be used. In fact, an optimal proposal (w.r.t.

reduced variance) exists.

I Rao-Blackwellization for mixed linear/nonlinear models.

I System identification: PMCMC, SMC2.

June 10, 2014, 15 / 16 Andreas Svensson - An introduction to particle filters

Extensions

I Smoothing: Finding p(xt |y1:T ) (marginal smoothing) orp(x1:t |y1:T ) (joint smoothing) instead of p(xt |y1:t) (filtering).Offline (y1:T has to be available). Increased computational load.

I If f (xt+1|xt , ut) is not suitable to sample from, proposaldistributions can be used. In fact, an optimal proposal (w.r.t.

reduced variance) exists.

I Rao-Blackwellization for mixed linear/nonlinear models.

I System identification: PMCMC, SMC2.

June 10, 2014, 15 / 16 Andreas Svensson - An introduction to particle filters

Extensions

I Smoothing: Finding p(xt |y1:T ) (marginal smoothing) orp(x1:t |y1:T ) (joint smoothing) instead of p(xt |y1:t) (filtering).Offline (y1:T has to be available). Increased computational load.

I If f (xt+1|xt , ut) is not suitable to sample from, proposaldistributions can be used. In fact, an optimal proposal (w.r.t.

reduced variance) exists.

I Rao-Blackwellization for mixed linear/nonlinear models.

I System identification: PMCMC, SMC2.

June 10, 2014, 15 / 16 Andreas Svensson - An introduction to particle filters

References

I Gustafsson, F. (2010). Particle filter theory and practice with

positioning applications. Aerospace and Electronic Systems Magazine, IEEE,

25(7), 53-82.

I Schön, T.B., & Lindsten, F. Learning of dynamical systems - Particle

Filters and Markov chain methods. Draft available.

I Doucet, A., & Johansen, A. M. (2009). A tutorial on particle filtering and

smoothing: Fifteen years later. Handbook of Nonlinear Filtering, 12,

656-704.

Homework: Implement your own Particle Filter for any (simple) problem of your

choice!

June 10, 2014, 16 / 16 Andreas Svensson - An introduction to particle filters

Recommended