Kalman filtering & smoothing - Sharif

25
Kalman filtering & smoothing 40-957 Special Topics in Artificial Intelligence: Probabilistic Graphical Models Sharif University of Technology Soleymani Spring 2014

Transcript of Kalman filtering & smoothing - Sharif

Page 1: Kalman filtering & smoothing - Sharif

Kalman filtering & smoothing

40-957 Special Topics in Artificial Intelligence:

Probabilistic Graphical Models

Sharif University of Technology

Soleymani

Spring 2014

Page 2: Kalman filtering & smoothing - Sharif

From latent variable models to dynamic

models

2

Two categories of latent variable models that we have seen in

previous lectures:

Discrete latent variable

Mixture models

Continuous latent variable

Factor analysis

Dynamical models

Mixture models -> HMM

HMM as dynamical generalization of mixture models

latent variables are discrete but with arbitrary emission probability distributions.

Factor Analysis -> Kalman Filter

Kalman filter as dynamical generalization of factor analysis

Page 3: Kalman filtering & smoothing - Sharif

State-Space Model (SSM)

3

The latent variables ๐’›1, โ€ฆ , ๐’›๐‘‡ are form a chain.

Independence relationships (the same as HMM):

Given the state at one moment in the time, the states in the future are conditionally independent of those in the past.

The observation of the observation nodes fails to separate any of the state nodes.

๐’›1 ๐’›2 ๐’›๐‘‡

๐’™1 ๐’™2 ๐’™๐‘‡

โ€ฆ ๐’›๐‘‡โˆ’1

๐’™๐‘‡โˆ’1

Page 4: Kalman filtering & smoothing - Sharif

Linear Dynamical System (LDS)

4

๐’›1 = ๐’– ๐’–๐‘ก~๐’ฉ(๐ŸŽ, ๐šบ0)

๐’›๐‘ก+1 = ๐‘จ๐’›๐‘ก + ๐‘ฎ๐’˜๐‘ก+1 ๐’˜๐‘ก~๐’ฉ(๐ŸŽ, ๐‘ธ)

๐’™๐‘ก = ๐‘ช๐’›๐‘ก + ๐’—๐‘ก ๐’—๐‘ก~๐’ฉ(๐ŸŽ, ๐‘น)

๐‘ƒ ๐’›1 = ๐’ฉ(๐’›1|๐ŸŽ, ๐šบ0) ๐‘ƒ ๐’›๐‘ก+1|๐’›๐‘ก = ๐’ฉ ๐’›๐‘ก+1|๐‘จ๐’›๐‘ก , ๐‘ฎ๐‘ธ๐‘ฎ๐‘‡

๐‘ƒ ๐’™๐‘ก|๐’›๐‘ก = ๐’ฉ ๐’™๐‘ก|๐‘ช๐’›๐‘ก, ๐‘น

Linear Gaussian model

๐’›1 ๐’›2 ๐’›๐‘‡

๐’™1 ๐’™2 ๐’™๐‘‡

โ€ฆ ๐’›๐‘‡โˆ’1

๐’™๐‘‡โˆ’1

๐’›๐‘ก+1 = ๐’‡(๐’›๐‘ก) + ๐‘ฎ๐’˜๐‘ก+1 ๐’˜๐‘ก~๐’ฉ(๐ŸŽ, ๐‘ธ)

๐’™๐‘ก = ๐’ˆ(๐’›๐‘ก) + ๐’—๐‘ก ๐’—๐‘ก~๐’ฉ(๐ŸŽ, ๐‘น)

General state space model:

Page 5: Kalman filtering & smoothing - Sharif

Kalman filter applications

5

The Kalman filter has been widely used in many real-time

tracking applications.

Many other applications such as:

Navigation and guidance system (Simultaneous Localization

And Mapping)

Control systems

Time-series processing

Page 6: Kalman filtering & smoothing - Sharif

Inference in LDS

6

Calculation of the posterior probability of the states given

an observation sequence

We will see two types of inference problems on LDS:

Filtering

๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก

Smoothing

๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘‡

Online inference

Offline inference

Page 7: Kalman filtering & smoothing - Sharif

Inference in LDS

7

The graphical model of LDS is tree-structured and inference

can be solved efficiently using the sum-product algorithm:

Filtering: The forward recursions, analogous to ๐›ผ messages of HMM, are

known as Kalman filter equations

Smoothing: The backward recursions, analogous to ๐›ฝ messages, are

known as the Kalman smoother equations

Inference algorithms on SSM are similar to the inference

algorithms on HMM

Page 8: Kalman filtering & smoothing - Sharif

Message passing

8

Joint distribution (on a linear-Gaussian network) is multi-

variate Gaussian

Thus, marginal and conditional distributions will also be

Gaussian.

We can use message-passing in Gaussian networks to

solve inference problems of LDS

We will focus on only mean and variance computations

Page 9: Kalman filtering & smoothing - Sharif

Kalman filter: messages

9

Filtering is similar to (but not the same as) forward algorithm in

HMM:

๐›ผ ๐‘ก ๐’›๐‘ก = ๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก =๐‘ƒ ๐’›๐‘ก , ๐’™1, โ€ฆ , ๐’™๐‘ก

๐‘ƒ ๐’™1, โ€ฆ , ๐’™๐‘ก=

๐›ผ๐‘ก ๐’›๐‘ก

๐‘ƒ ๐’™1, โ€ฆ , ๐’™๐‘ก

The distribution ๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก is ๐’ฉ ๐’›๐‘ก|๐๐’›๐‘ก|๐’™1:๐‘ก, ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

Assume that we have calculated ๐›ผ ๐‘ก ๐’›๐‘ก we need to calculate

๐›ผ ๐‘ก+1 ๐’›๐‘ก+1 = ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก+1

๐’›1 ๐’›2 ๐’›๐‘‡

๐’™1 ๐’™2 ๐’™๐‘‡

โ€ฆ ๐’›๐‘‡โˆ’1

๐’™๐‘‡โˆ’1

๐›ผ 1(. ) ๐›ผ 2(. ) ๐›ผ ๐‘‡โˆ’1(. ) ๐›ผ ๐‘‡(. )

Page 10: Kalman filtering & smoothing - Sharif

Kalman filter

10

To find ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก+1 , we use two recursive

updates:

Predict step (time update): best guess before seeing

measurement

Compute ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก from ๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก

Measurement update step: after measurement, we find the

new posterior in which ๐’™๐‘ก+1 is also given as evidence

Compute ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก+1 from ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก

Page 11: Kalman filtering & smoothing - Sharif

Kalman filter: prediction step

11

In thus step, we have ๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก|๐๐‘ก|๐‘ก, ๐œฎ๐‘ก|๐‘ก and we

find ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก and ๐‘ƒ ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก :

๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก|๐๐‘ก+1|๐‘ก , ๐œฎ๐‘ก+1|๐‘ก

๐๐‘ก+1|๐‘ก โ‰ก ๐๐’›๐‘ก+1|๐’™1:๐‘ก

= ๐ธ๐’›๐‘ก+1|๐’™1:๐‘ก๐’›๐‘ก+1 = ๐ธ ๐ด๐’›๐‘ก + ๐’˜๐‘ก+1|๐’™1:๐‘ก

= ๐‘จ๐๐’›๐‘ก|๐’™1:๐‘ก

๐œฎ๐‘ก+1|๐‘ก โ‰ก ๐šบ๐’›๐‘ก+1|๐’™1:๐‘ก= ๐ธ๐’›๐‘ก+1|๐’™1:๐‘ก

๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก ๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก๐‘‡

= ๐ธ ๐ด๐’›๐‘ก + ๐‘ฎ๐’˜๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก ๐ด๐’›๐‘ก + ๐‘ฎ๐’˜๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก๐‘‡|๐’™1:๐‘ก

= ๐‘จ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡ + ๐‘ฎ๐‘ธ๐‘ฎ๐‘‡

๐œฎ๐‘ก|๐‘ก โ‰ก ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

๐๐‘ก|๐‘ก โ‰ก ๐๐’›๐‘ก|๐’™1:๐‘ก

Page 12: Kalman filtering & smoothing - Sharif

Kalman filter: prediction step

12

๐‘ƒ ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’™๐‘ก+1|๐๐’™๐‘ก+1|๐’™1:๐‘ก, ๐œฎ๐’™๐‘ก+1|๐’™1:๐‘ก

๐๐’™๐‘ก+1|๐’™1:๐‘ก

= ๐ธ๐’™๐‘ก+1|๐’™1:๐‘ก๐’™๐‘ก+1 = ๐ธ ๐‘ช๐’›๐‘ก+1 + ๐’—๐‘ก+1|๐’™1:๐‘ก = ๐‘ช๐๐‘ก+1|๐‘ก

๐œฎ๐’™๐‘ก+1|๐’™1:๐‘ก= ๐ธ๐’™๐‘ก+1|๐’™1:๐‘ก

๐’™๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก๐’™๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก

๐‘‡

= ๐ธ ๐‘ช๐’›๐‘ก+1 + ๐’—๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก๐‘ช๐’›๐‘ก+1 + ๐’—๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก

๐‘‡|๐’™1:๐‘ก

= ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ + ๐‘น

๐œฎ๐‘ก|๐‘ก โ‰ก ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

๐๐‘ก|๐‘ก โ‰ก ๐๐’›๐‘ก|๐’™1:๐‘ก

Page 13: Kalman filtering & smoothing - Sharif

Kalman filter: measurement update

13

We want to find ๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก , ๐’™๐‘ก+1 and for this purpose we

first find the joint distribution ๐‘ƒ ๐’›๐‘ก+1, ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก :

๐œฎ๐’™๐‘ก+1,๐’›๐‘ก+1|๐’™1:๐‘ก= ๐ธ๐’™๐‘ก+1,๐’›๐‘ก+1|๐’™1:๐‘ก

๐’™๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก๐’›๐‘ก+1 โˆ’ ๐๐’›๐‘ก+1|๐’™1:๐‘ก

๐‘‡

= ๐ธ ๐‘ช๐’›๐‘ก+1 + ๐’—๐‘ก+1 โˆ’ ๐๐’™๐‘ก+1|๐’™1:๐‘ก๐’›๐‘ก+1 โˆ’ ๐๐’›๐‘ก+1|๐’™1:๐‘ก

๐‘‡|๐’™1:๐‘ก = ๐‘ช๐œฎ๐‘ก+1|๐‘ก

๐‘ƒ ๐’›๐‘ก+1, ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก

= ๐’ฉ ๐’™๐‘ก+1, ๐’›๐‘ก+1

๐๐‘ก+1|๐‘ก

๐‘ช๐๐‘ก+1|๐‘ก,

๐œฎ๐‘ก+1|๐‘ก ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡

๐‘ช๐œฎ๐‘ก+1|๐‘ก ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ + ๐‘น

๐œฎ๐‘ก|๐‘ก โ‰ก ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

๐๐‘ก|๐‘ก โ‰ก ๐๐’›๐‘ก|๐’™1:๐‘ก

Page 14: Kalman filtering & smoothing - Sharif

Kalman filter: measurement update

14

๐‘ƒ ๐’›๐‘ก+1, ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก

= ๐’ฉ ๐’™๐‘ก+1, ๐’›๐‘ก+1

๐๐‘ก+1|๐‘ก

๐ถ๐๐‘ก+1|๐‘ก,

๐œฎ๐‘ก+1|๐‘ก ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡

๐‘ช๐œฎ๐‘ก+1|๐‘ก ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ + ๐‘น

Conditional distribution from the above joint distribution: ๐๐‘ก+1|๐‘ก+1 โ‰ก ๐๐’›๐‘ก+1|๐’™1:๐‘ก+1

= ๐๐‘ก+1|๐‘ก + ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช

๐‘‡ + ๐‘นโˆ’1

๐’™๐‘ก+1 โˆ’ ๐‘ช๐๐‘ก+1|๐‘ก

๐œฎ๐‘ก+1|๐‘ก+1 โ‰ก ๐œฎ๐’›๐‘ก+1|๐’™1:๐‘ก+1

= ๐œฎ๐‘ก+1|๐‘ก โˆ’ ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช

๐‘‡ + ๐‘นโˆ’1

๐‘ช๐œฎ๐‘ก+1|๐‘ก

๐œฎ๐‘ก|๐‘ก โ‰ก ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

๐๐‘ก|๐‘ก โ‰ก ๐๐’›๐‘ก|๐’™1:๐‘ก

๐‘ƒ ๐’™1, ๐’™2 = ๐’ฉ๐’™1

๐’™2

๐1

๐2,

๐œฎ11 ๐œฎ12

๐œฎ๐Ÿ1 ๐œฎ22

โ‡’ ๐‘ƒ ๐’™1|๐’™2 = ๐’ฉ ๐’™1|๐1|2, ๐œฎ1|2

๐1|2 = ๐1 + ๐œฎ12๐œฎ22โˆ’1 ๐’™2 โˆ’ ๐2

๐œฎ1|2 = ๐œฎ11 โˆ’ ๐œฎ12๐œฎ22โˆ’1๐œฎ21

Page 15: Kalman filtering & smoothing - Sharif

Kalman filter: measurement update

15

๐‘ƒ ๐’›๐‘ก+1, ๐’™๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก

= ๐’ฉ ๐’™๐‘ก+1, ๐’›๐‘ก+1

๐๐‘ก+1|๐‘ก

๐ถ๐๐‘ก+1|๐‘ก,

๐œฎ๐‘ก+1|๐‘ก ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡

๐‘ช๐œฎ๐‘ก+1|๐‘ก ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ + ๐‘น

Conditional distribution from the above joint distribution: ๐๐‘ก+1|๐‘ก+1 โ‰ก ๐๐’›๐‘ก+1|๐’™1:๐‘ก+1

= ๐๐‘ก+1|๐‘ก + ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช

๐‘‡ + ๐‘นโˆ’1

๐’™๐‘ก+1 โˆ’ ๐‘ช๐๐‘ก+1|๐‘ก

๐œฎ๐‘ก+1|๐‘ก+1 โ‰ก ๐œฎ๐’›๐‘ก+1|๐’™1:๐‘ก+1

= ๐œฎ๐‘ก+1|๐‘ก โˆ’ ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช

๐‘‡ + ๐‘นโˆ’1

๐‘ช๐œฎ๐‘ก+1|๐‘ก

We also have found in the time update:

๐๐‘ก+1|๐‘ก = ๐‘จ๐๐‘ก|๐‘ก

๐œฎ๐‘ก+1|๐‘ก = ๐‘จ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡ + ๐‘ฎ๐‘ธ๐‘ฎ๐‘‡

๐œฎ๐‘ก|๐‘ก โ‰ก ๐œฎ๐’›๐‘ก|๐’™1:๐‘ก

๐๐‘ก|๐‘ก โ‰ก ๐๐’›๐‘ก|๐’™1:๐‘ก

๐1|0 = ๐0

๐œฎ1|0 = ๐œฎ0

Page 16: Kalman filtering & smoothing - Sharif

Kalman filter: measurement update

16

Updates based on Kalman gain matrix:

๐๐‘ก+1|๐‘ก+1 = ๐๐‘ก+1|๐‘ก + ๐‘ฒ๐‘ก+1 ๐’™๐‘ก+1 โˆ’ ๐‘ช๐๐‘ก+1|๐‘ก

๐œฎ๐‘ก+1|๐‘ก+1 = ๐œฎ๐‘ก+1|๐‘ก โˆ’ ๐‘ฒ๐‘ก+1๐‘ช๐œฎ๐‘ก+1|๐‘ก = ๐‘ฐ โˆ’ ๐‘ฒ๐‘ก+1๐‘ช ๐œฎ๐‘ก+1|๐‘ก

Update takes linear combination of predicted mean ๐‘ช๐๐‘ก+1|๐‘ก and

observation ๐’™๐‘ก+1, weighted by predicted covariance

Kalman filter as a process of making successive predictions ๐‘ช๐๐‘ก+1|๐‘ก and then

correcting these predictions in the light of the new observations ๐’™๐‘ก+1.

Covariance update is independent of observed measurements

Only depends on LDS parameters and can be computed offline

Kalman gain matrix

๐‘ฒ๐‘ก+1 โ‰ก ๐œฎ๐‘ก+1|๐‘ก๐‘ช๐‘‡ ๐‘ช๐œฎ๐‘ก+1|๐‘ก๐‘ช

๐‘‡ + ๐‘นโˆ’1

Page 17: Kalman filtering & smoothing - Sharif

Kalman filter: update equations

17

๐๐‘ก+1|๐‘ก+1 = ๐๐‘ก+1|๐‘ก + ๐‘ฒ๐‘ก+1 ๐’™๐‘ก+1 โˆ’ ๐‘ช๐๐‘ก+1|๐‘ก

๐œฎ๐‘ก+1|๐‘ก+1 = ๐œฎ๐‘ก+1|๐‘ก โˆ’ ๐‘ฒ๐‘ก+1๐‘ช๐œฎ๐‘ก+1|๐‘ก = ๐‘ฐ โˆ’ ๐‘ฒ๐‘ก+1๐‘ช ๐œฎ๐‘ก+1|๐‘ก

๐๐‘ก+1|๐‘ก = ๐‘จ๐๐‘ก|๐‘ก

๐œฎ๐‘ก+1|๐‘ก = ๐‘จ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡ + ๐‘ฎ๐‘ธ๐‘ฎ๐‘‡

๐๐‘ก+1|๐‘ก+1 = ๐‘จ๐๐‘ก|๐‘ก + ๐‘ฒ๐‘ก+1 ๐’™๐‘ก+1 โˆ’ ๐‘ช๐‘จ๐๐‘ก|๐‘ก

๐œฎ๐‘ก+1|๐‘ก+1 = ๐‘ฐ โˆ’ ๐‘ฒ๐‘ก+1๐‘ช ๐‘จ๐œฎ๐‘ก|๐‘ก๐‘จ

๐‘‡ + ๐‘ฎ๐‘ธ๐‘ฎ๐‘‡

Page 18: Kalman filtering & smoothing - Sharif

Smoothing

18

Off-line inference in an LDS

Combine forward recursion with a backward recursion

It is the Gaussian analog of the forwards-backwards (alpha-

gamma) algorithm on an HMM

Page 19: Kalman filtering & smoothing - Sharif

Rauch-Tung-Striebel (RTS) smoother

19

Messages in the backward pass are ๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก and

first we find ๐‘ƒ ๐’›๐‘ก, ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก to compute the messages as

conditional of this joint distribution:

๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก|๐๐‘ก|๐‘ก , ๐œฎ๐‘ก|๐‘ก

๐‘ƒ ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก+1|๐๐‘ก+1|๐‘ก, ๐œฎ๐‘ก+1|๐‘ก

๐šบ๐’›๐‘ก,๐’›๐‘ก+1|๐’™1:๐‘ก= ๐ธ๐’›๐‘ก,๐’›๐‘ก+1|๐’™1:๐‘ก

๐’›๐‘ก โˆ’ ๐๐‘ก|๐‘ก ๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก๐‘‡

= ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡

๐‘ƒ ๐’›๐‘ก, ๐’›๐‘ก+1|๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ๐๐‘ก|๐‘ก

๐๐‘ก+1|๐‘ก

๐œฎ๐‘ก|๐‘ก ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡

๐‘จ๐œฎ๐‘ก|๐‘ก ๐œฎ๐‘ก+1|๐‘ก

All of the above quantities are available after a forward pass (Kalman filter)

Page 20: Kalman filtering & smoothing - Sharif

Rauch-Tung-Striebel (RTS) smoother

20

We find the conditional distribution ๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก from

the joint distribution introduced in the previous slide:

๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก|๐๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก

, ๐šบ๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก

๐๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก= ๐๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก

๐šบ๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก= ๐œฎ๐‘ก|๐‘ก โˆ’ ๐‘ณ๐‘ก๐œฎ๐‘ก+1|๐‘ก๐‘ณ๐‘ก

๐‘‡

๐‘ณ๐‘ก โ‰ก ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡๐œฎ๐‘ก+1|๐‘ก

โˆ’1

๐‘ƒ ๐’™1|๐’™2 = ๐’ฉ ๐’™1|๐1|2, ๐œฎ1|2

๐1|2 = ๐1 + ๐œฎ12๐œฎ22โˆ’1 ๐’™2 โˆ’ ๐2

๐œฎ1|2 = ๐œฎ11 โˆ’ ๐œฎ12๐œฎ22โˆ’1๐œฎ21

Page 21: Kalman filtering & smoothing - Sharif

Rauch-Tung-Striebel (RTS) smoother

21

We find the conditional distribution ๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก from

the joint:

๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก = ๐’ฉ ๐’›๐‘ก|๐๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก, ๐šบ๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก

๐๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก= ๐๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก

๐šบ๐’›๐‘ก|๐’›๐‘ก+1,๐’™1:๐‘ก= ๐œฎ๐‘ก|๐‘ก โˆ’ ๐‘ณ๐‘ก๐œฎ๐‘ก+1|๐‘ก๐‘ณ๐‘ก

๐‘‡

Also, according to the structure of the model:

๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘ก = ๐‘ƒ ๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1, โ€ฆ , ๐’™๐‘‡

๐‘ณ๐‘ก โ‰ก ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡๐œฎ๐‘ก+1|๐‘ก

โˆ’1

Page 22: Kalman filtering & smoothing - Sharif

RTS smoother: update equations

22

๐‘ƒ ๐’›๐‘ก|๐’™1, โ€ฆ , ๐’™๐‘‡ = ๐’ฉ ๐๐‘ก|๐‘‡ , ๐šบ๐‘ก|๐‘‡

๐๐‘ก|๐‘‡ = ๐๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐๐‘ก+1|๐‘‡ โˆ’ ๐๐‘ก+1|๐‘ก

๐šบ๐‘ก|๐‘‡ = ๐šบ๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐šบ๐‘ก+1|๐‘‡ โˆ’ ๐šบ๐‘ก+1|๐‘ก ๐‘ณ๐‘ก๐‘‡

Derivation for mean: ๐๐‘ก|๐‘‡ = ๐ธ ๐’›๐‘ก ๐’™1:๐‘‡ = ๐ธ ๐ธ[๐’›๐‘ก|๐’›๐‘ก+1, ๐’™1:๐‘ก]|๐’™1:๐‘‡

= ๐ธ ๐๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐’›๐‘ก+1 โˆ’ ๐๐‘ก+1|๐‘ก |๐’™1:๐‘‡

= ๐๐‘ก|๐‘ก + ๐‘ณ๐‘ก ๐๐‘ก+1|๐‘‡ โˆ’ ๐๐‘ก+1|๐‘ก

๐šบ๐‘ก|๐‘‡ can be found similarly

๐ธ ๐‘‹ ๐‘ = ๐ธ ๐ธ[๐‘‹|๐‘Œ, ๐‘]|๐‘

๐‘‰๐‘Ž๐‘Ÿ ๐‘‹ ๐‘ = ๐‘‰๐‘Ž๐‘Ÿ ๐ธ[๐‘‹|๐‘Œ, ๐‘]|๐‘ + ๐ธ[๐‘‰๐‘Ž๐‘Ÿ[๐‘‹|๐‘Œ, ๐‘]|๐‘]

๐๐‘‡|๐‘‡ and ๐šบ๐‘‡|๐‘‡ are initialized from the filtering pass

๐‘ณ๐‘ก โ‰ก ๐œฎ๐‘ก|๐‘ก๐‘จ๐‘‡๐œฎ๐‘ก+1|๐‘ก

โˆ’1

Page 23: Kalman filtering & smoothing - Sharif

Example

23

In LDS, the sequence of individually most probable values of latent variables is the same as the most probable latent sequence.

No need to use the analogue of the Viterbi algorithm for the LDS.

Thus, red crosses show the most probable sequences obtained using filtering (b) and smoothing (c) algorithms

[Murphy]

Page 24: Kalman filtering & smoothing - Sharif

Learning of LDS

24

Learning โ€“ EM algorithm

E-step: expected sufficient statistics are found

๐ธ[๐’›๐‘ก]

๐ธ[๐’›๐‘ก๐’›๐‘ก๐‘‡]

๐ธ[๐’›๐‘ก๐’›๐‘กโˆ’1๐‘‡ ]

M-step:

update of ๐‘ช and ๐‘น is similar to the M-step of factor analysis

Page 25: Kalman filtering & smoothing - Sharif

LDS: summary

25

SSMs are dynamical models that allows continuous states

(latent variables)

LDS is a linear-Gaussian SSM

Inference problems in LDS can be solved using message

passing:

Kalman filter can be used to solve the filtering problem

RTS smoother can be used to solve the smoothing problem