The Kalman Filter ImPr Talk

Similar documents
Lecture 2: From Linear Regression to Kalman Filter and Beyond

Lecture 2: From Linear Regression to Kalman Filter and Beyond

Lecture 6: Bayesian Inference in SDE Models

Lecture 7: Optimal Smoothing

4 Derivations of the Discrete-Time Kalman Filter

9 Multi-Model State Estimation

Kalman filtering and friends: Inference in time series models. Herke van Hoof slides mostly by Michael Rubinstein

Smoothers: Types and Benchmarks

Sequential Monte Carlo Methods for Bayesian Computation

Lecture 6: Multiple Model Filtering, Particle Filtering and Other Approximations

Particle Filtering for Data-Driven Simulation and Optimization

Sensor Fusion: Particle Filter

Linear Dynamical Systems

Dual Estimation and the Unscented Transformation

Robotics. Mobile Robotics. Marc Toussaint U Stuttgart

Markov Chain Monte Carlo Methods for Stochastic Optimization

Organization. I MCMC discussion. I project talks. I Lecture.

State-Space Methods for Inferring Spike Trains from Calcium Imaging

Particle Filtering Approaches for Dynamic Stochastic Optimization

Using the Kalman Filter to Estimate the State of a Maneuvering Aircraft

Local Positioning with Parallelepiped Moving Grid

Lagrangian Data Assimilation and Manifold Detection for a Point-Vortex Model. David Darmon, AMSC Kayo Ide, AOSC, IPST, CSCAMM, ESSIC

L06. LINEAR KALMAN FILTERS. NA568 Mobile Robotics: Methods & Algorithms

An introduction to particle filters

Content.

Why do we care? Measurements. Handling uncertainty over time: predicting, estimating, recognizing, learning. Dealing with time

PATTERN RECOGNITION AND MACHINE LEARNING CHAPTER 13: SEQUENTIAL DATA

Nonlinear and/or Non-normal Filtering. Jesús Fernández-Villaverde University of Pennsylvania

An Brief Overview of Particle Filtering

2D Image Processing (Extended) Kalman and particle filter

Towards a Bayesian model for Cyber Security

Crib Sheet : Linear Kalman Smoothing

PROBABILISTIC REASONING OVER TIME

Why do we care? Examples. Bayes Rule. What room am I in? Handling uncertainty over time: predicting, estimating, recognizing, learning

Introduction to Machine Learning

Factor Analysis and Kalman Filtering (11/2/04)

Stochastic Models, Estimation and Control Peter S. Maybeck Volumes 1, 2 & 3 Tables of Contents

CIS 390 Fall 2016 Robotics: Planning and Perception Final Review Questions

Mini-Course 07 Kalman Particle Filters. Henrique Massard da Fonseca Cesar Cunha Pacheco Wellington Bettencurte Julio Dutra

TSRT14: Sensor Fusion Lecture 8

Machine Learning 4771

Rao-Blackwellized Particle Filter for Multiple Target Tracking

STA 4273H: Statistical Machine Learning

ROBOTICS 01PEEQW. Basilio Bona DAUIN Politecnico di Torino

Markov Chain Monte Carlo Methods for Stochastic

EM-algorithm for Training of State-space Models with Application to Time Series Prediction

Probabilistic Graphical Models

Human Pose Tracking I: Basics. David Fleet University of Toronto

Sequential Monte Carlo and Particle Filtering. Frank Wood Gatsby, November 2007

Advanced Computational Methods in Statistics: Lecture 5 Sequential Monte Carlo/Particle Filtering

Linear Dynamical Systems (Kalman filter)

SEQUENTIAL MONTE CARLO METHODS WITH APPLICATIONS TO COMMUNICATION CHANNELS. A Thesis SIRISH BODDIKURAPATI

Detection and Estimation Theory

Computer Intensive Methods in Mathematical Statistics

Miscellaneous. Regarding reading materials. Again, ask questions (if you have) and ask them earlier

Fast Sequential Monte Carlo PHD Smoothing

Short tutorial on data assimilation

Probing the covariance matrix

On a Data Assimilation Method coupling Kalman Filtering, MCRE Concept and PGD Model Reduction for Real-Time Updating of Structural Mechanics Model

Forecasting and data assimilation

Optimal State Estimation for Boolean Dynamical Systems using a Boolean Kalman Smoother

Particle Filters. Outline

Least Squares Estimation Namrata Vaswani,

Introduction to Probabilistic Graphical Models: Exercises

Gaussian Process Approximations of Stochastic Differential Equations

Machine Learning for OR & FE

A Time-Varying Threshold STAR Model of Unemployment

An introduction to Sequential Monte Carlo

The Ensemble Kalman Filter:

Probabilistic Graphical Models

ECE276A: Sensing & Estimation in Robotics Lecture 10: Gaussian Mixture and Particle Filtering

Graphical models for statistical inference and data assimilation

Least Squares and Kalman Filtering Questions: me,

Graphical Models for Statistical Inference and Data Assimilation

State Estimation Based on Nested Particle Filters

A Theoretical Overview on Kalman Filtering

Prediction of ESTSP Competition Time Series by Unscented Kalman Filter and RTS Smoother

X t = a t + r t, (7.1)

Condensed Table of Contents for Introduction to Stochastic Search and Optimization: Estimation, Simulation, and Control by J. C.

Time Series Prediction by Kalman Smoother with Cross-Validated Noise Density

Lessons in Estimation Theory for Signal Processing, Communications, and Control

Particle lter for mobile robot tracking and localisation

Kalman Filter. Man-Wai MAK

Part 1: Expectation Propagation

Imprecise Filtering for Spacecraft Navigation

Graphical Models for Statistical Inference and Data Assimilation

Markov chain Monte Carlo methods for visual tracking

Probabilistic Fundamentals in Robotics. DAUIN Politecnico di Torino July 2010

Volume 30, Issue 3. A note on Kalman filter approach to solution of rational expectations models

Gaussian Process Approximations of Stochastic Differential Equations

Temporal probability models. Chapter 15, Sections 1 5 1

CPSC 540: Machine Learning

A new unscented Kalman filter with higher order moment-matching

Bayesian tracking of multiple point targets using expectation maximization

A new Hierarchical Bayes approach to ensemble-variational data assimilation

MMSE-Based Filtering for Linear and Nonlinear Systems in the Presence of Non-Gaussian System and Measurement Noise

ENGR352 Problem Set 02

Expectation Propagation in Dynamical Systems

Statistics Homework #4

State Space Gaussian Processes with Non-Gaussian Likelihoods

Transcription:

The Kalman Filter ImPr Talk Ged Ridgway Centre for Medical Image Computing November, 2006

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

What is the Kalman Filter for? State estimation in Dynamical Systems

What is the Kalman Filter for? State estimation in Dynamical Systems In particular for discrete-time models with continuous, possibly hidden, state

What is the Kalman Filter for? State estimation in Dynamical Systems In particular for discrete-time models with continuous, possibly hidden, state It is optimal for Linear Gaussian systems

Why filter? The KF is a state-space filter

Why filter? The KF is a state-space filter Noisy measurements cleaned state estimate Estimates are updated online with each new measurement

Why filter? The KF is a state-space filter Noisy measurements cleaned state estimate Estimates are updated online with each new measurement Equivalent to an (optimally) adaptive low-pass (IIR) filter

Why Kalman? (!) R. E. Kalman A new approach to linear filtering and prediction problems. Journal of Basic Engineering, 82(1):35-45, 1960.

Why Kalman? (!) R. E. Kalman A new approach to linear filtering and prediction problems. Journal of Basic Engineering, 82(1):35-45, 1960. Rudolf Emil Kalman, born in Budapest, Hungary, May 19, 1930.

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration s k = s k 1 + ṡ k 1 T + 1 2 s k 1 ( T ) 2 ṡ k = ṡ k 1 + s k 1 T s k = s k 1

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration s k = s k 1 + ṡ k 1 T + 1 2 s k 1 ( T ) 2 + ɛ k ṡ k = ṡ k 1 + s k 1 T + ɛ k s k = s k 1 + ɛ k

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration s k = s k 1 + ṡ k 1 T + 1 2 s k 1 ( T ) 2 + ɛ k ṡ k = ṡ k 1 + s k 1 T + ɛ k s k = s k 1 + ɛ k s k 1 T ( T ) 2 /2 ṡ k = 0 1 T s k 0 0 1 s k 1 ṡ k 1 s k 1 + w k

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration s k = s k 1 + ṡ k 1 T + 1 2 s k 1 ( T ) 2 + ɛ k ṡ k = ṡ k 1 + s k 1 T + ɛ k s k = s k 1 + ɛ k s k 1 T ( T ) 2 /2 ṡ k = 0 1 T s k 0 0 1 s k 1 ṡ k 1 s k 1 + w k x k = Fx k 1 + w k

State space examples - dynamical system Motion of a particle (in 1D) constant (but noisy) acceleration s k = s k 1 + ṡ k 1 T + 1 2 s k 1 ( T ) 2 + ɛ k ṡ k = ṡ k 1 + s k 1 T + ɛ k s k = s k 1 + ɛ k s k 1 T ( T ) 2 /2 ṡ k = 0 1 T s k 0 0 1 s k 1 ṡ k 1 s k 1 + w k x k = Fx k 1 + w k w k N (w k 0, Q)

State space examples - time-series

State space examples - time-series Autoregressive AR(n) model s k s k 1 s k 2. s k (n 1) = a 1 a 2 a 3... a n 1 0 0... 0 0... 0 0. 1 0. 0... 0 1 0 s k 1 s k 2 s k 3. s k n + ɛ k 0 0. 0

State space examples - time-series Autoregressive AR(n) model s k a 1 a 2 a 3... a n s k 1 1 0 0... 0 s k 2 =. 0.. 0 0.. 1 0. s k (n 1) 0... 0 1 0 s k 1 s k 2 s k 3. s k n ɛ k 0 + 0. 0 σ 2 0... 0 0 0... 0 x k = Fx k 1 + w k Q k =.. 0 0... 0

The state space model x k R n z k R m u k R p vector of hidden state variables vector of observations vector of control inputs Linear x k = F k x k 1 + B k u k z k = H k x k (1)

The state space model x k R n z k R m u k R p vector of hidden state variables vector of observations vector of control inputs Linear Gaussian x k = F k x k 1 + B k u k + w k z k = H k x k + v k w k N (w k 0, Q k ) v k N (v k 0, R k ) (1)

The state space model

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

How does the KF work? Recursive (online) updating of current state estimate and precision (covariance)

How does the KF work? Recursive (online) updating of current state estimate and precision (covariance) 1. Using the system model

How does the KF work? Recursive (online) updating of current state estimate and precision (covariance) 1. Using the system model Predict the next state Estimate the new (reduced) precision

How does the KF work? Recursive (online) updating of current state estimate and precision (covariance) 1. Using the system model Predict the next state Estimate the new (reduced) precision 2. Using the new measurement

How does the KF work? Recursive (online) updating of current state estimate and precision (covariance) 1. Using the system model Predict the next state Estimate the new (reduced) precision 2. Using the new measurement Correct the state estimate Update the (increased) precision

How is it derived? Two equivalent alternatives

How is it derived? Two equivalent alternatives 1. Classical

How is it derived? Two equivalent alternatives 1. Classical Show form of Kalman gain update is unbiased Derive expressions for posterior covariance (MSE) Analytically find optimal Kalman gain

How is it derived? Two equivalent alternatives 1. Classical Show form of Kalman gain update is unbiased Derive expressions for posterior covariance (MSE) Analytically find optimal Kalman gain 2. Bayesian

How is it derived? Two equivalent alternatives 1. Classical Show form of Kalman gain update is unbiased Derive expressions for posterior covariance (MSE) Analytically find optimal Kalman gain 2. Bayesian Treat previous estimates as prior Measurement model gives likelihood Derive posterior distribution

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

Bayesian updating A simple example p(x) = N ( ) x ˆx, σw 2 prior z = x + v v N (0, σv) 2 ( ) p(z x) = N z x, σv 2 likelihood

Bayesian updating A simple example p(x) = N ( ) x ˆx, σw 2 prior z = x + v v N (0, σv) 2 ( ) p(z x) = N z x, σv 2 likelihood p(x z) p(z x) p(x) from Bayes

Bayesian updating p(z x) p(x) = N ( ) ( ) z x, σv 2 N x ˆx, σw 2

Bayesian updating p(z x) p(x) = N ( ) ( ) z x, σv 2 N x ˆx, σw 2 log (p(z x) p(x)) = (z x)2 σ 2 v + (x ˆx)2 σ 2 w +

Bayesian updating p(z x) p(x) = N log (p(z x) p(x)) = ( ) ( ) z x, σv 2 N x ˆx, σw 2 (z x)2 σ 2 v = x 2 ( 1 σ 2 v (x ˆx)2 + σw 2 + + 1 ) ( z σw 2 2x σv 2 + ˆx ) σw 2 +

Bayesian updating p(z x) p(x) = N log (p(z x) p(x)) = ( ) ( ) z x, σv 2 N x ˆx, σw 2 (z x)2 σ 2 v (x ˆx)2 + σw 2 + ( 1 = x 2 σv 2 + 1 ) ( z σw 2 2x σv 2 = x 2 /a 2bx + + ˆx ) σw 2 +

Bayesian updating p(z x) p(x) = N log (p(z x) p(x)) = ( ) ( ) z x, σv 2 N x ˆx, σw 2 (z x)2 σ 2 v (x ˆx)2 + σw 2 + ( 1 = x 2 σv 2 + 1 ) ( z σw 2 2x σv 2 = x 2 /a 2bx + = 1 a (x ab)2 + + ˆx ) σw 2 +

Bayesian updating (Information form) log (p(x z)) 1 a (x ab)2 +

Bayesian updating (Information form) log (p(x z)) 1 a (x ab)2 + p(x z) = N (x ab, a) where 1 a = 1 σv 2 + 1 σw 2 b = z σv 2 + ˆx σw 2

Bayesian updating (Information form) log (p(x z)) 1 a (x ab)2 + p(x z) = N (x ab, a) where 1 a = 1 σv 2 + 1 σw 2 b = z σv 2 + ˆx σw 2 Note prior and measurement information add the posterior mean is the information-weighted mean

Bayesian updating (Information form) Summary 1 a = 1 σv 2 posterior cov = a ( z posterior mean = a + 1 σ 2 w σ 2 v + ˆx ) σw 2 (2)

Bayesian updating (Kalman-gain form) Now rearrange, for reasons that might become clear later... ( 1 a = σ 2 v + 1 ) 1 σw 2

Bayesian updating (Kalman-gain form) Now rearrange, for reasons that might become clear later... ( 1 a = σ 2 v + 1 ) 1 σw 2 = σ2 wσ 2 v σ 2 w + σ 2 v = σ2 w(σ 2 w + σ 2 v) σ 4 w σ 2 w + σ 2 v = σ 2 w σ4 w σ 2 v + σ 2 w

Bayesian updating (Kalman-gain form) Now rearrange, for reasons that might become clear later... ( 1 a = σ 2 v + 1 ) 1 σw 2 = σ2 wσ 2 v σ 2 w + σ 2 v = σ2 w(σ 2 w + σ 2 v) σ 4 w σ 2 w + σ 2 v = σ 2 w σ4 w σ 2 v + σ 2 w = (1 k)σ 2 w σ2 w k = σv 2 + σw 2

Bayesian updating (Kalman-gain form) Bear with me... a = (1 k)σ 2 w σ2 w k = σw 2 + σv 2

Bayesian updating (Kalman-gain form) Bear with me... a = (1 k)σ 2 w k = (1 k) = σ2 w σ 2 w + σ 2 v σ 2 v σ 2 w + σ 2 v = k σ2 v σ 2 w

Bayesian updating (Kalman-gain form) Bear with me... a = (1 k)σ 2 w k = σ2 w σ 2 w + σ 2 v σ 2 v (1 k) = σw 2 + σv 2 = k σ2 v σw ( 2 z ab = (1 k)σw 2 σv 2 + ˆx ) σw 2 = (1 k)σw 2 z + (1 k)ˆx σ 2 v = kz + ˆx k ˆx = ˆx + k(z ˆx)

Bayesian updating (Kalman-gain form) Summary σ2 w k = σw 2 + σv 2 posterior cov = (1 k)σ 2 w posterior mean = ˆx + k(z ˆx) (3)

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

Derivation outline The prediction step is straight-forward. From the model x k = F k x k 1 + B k u k + w k

Derivation outline The prediction step is straight-forward. From the model x k = F k x k 1 + B k u k + w k ˆx k k 1 = F k ˆx k 1 k 1 + B k u k

Derivation outline The prediction step is straight-forward. From the model x k = F k x k 1 + B k u k + w k ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k

Derivation outline The prediction step is straight-forward. From the model x k = F k x k 1 + B k u k + w k ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k This gives us the time-k prior mean and covariance in terms of the time-(k 1) posteriors.

Derivation outline The correction step is algebraically tricky, but conceptually very similar to the simple example of Bayesian updating. (5)

Derivation outline The correction step is algebraically tricky, but conceptually very similar to the simple example of Bayesian updating. p(x k ˆx k k 1, z k ) p(z k x k, ˆx k k 1 ) p(x k ˆx k k 1 ) (5)

Derivation outline The correction step is algebraically tricky, but conceptually very similar to the simple example of Bayesian updating. p(x k ˆx k k 1, z k ) p(z k x k, ˆx k k 1 ) p(x k ˆx k k 1 ) p(z k x k ) p(x k ˆx k k 1 ) (5)

Derivation outline The correction step is algebraically tricky, but conceptually very similar to the simple example of Bayesian updating. p(x k ˆx k k 1, z k ) p(z k x k, ˆx k k 1 ) p(x k ˆx k k 1 ) p(z k x k ) p(x k ˆx k k 1 ) N (z k H k x k, R k ) N ( x k ˆx k k 1, P k k 1 ) (4) (5)

Derivation outline The correction step is algebraically tricky, but conceptually very similar to the simple example of Bayesian updating. p(x k ˆx k k 1, z k ) p(z k x k, ˆx k k 1 ) p(x k ˆx k k 1 ) p(z k x k ) p(x k ˆx k k 1 ) N (z k H k x k, R k ) N ( x k ˆx k k 1, P k k 1 ) p(x k ˆx k k 1, z k ) = N ( x k ˆx k k, P k k ) (4) (5)

Derivation outline The mean and covariance of the time-k posterior in (5) can be derived in information form by completing the square of the quadratic form in x that arises from (4).

Derivation outline Rearranging into Kalman-gain form then requires some fiddly algebra and the following two matrix inversion identities

Derivation outline Rearranging into Kalman-gain form then requires some fiddly algebra and the following two matrix inversion identities (A + BCD) 1 = A 1 A 1 B(C 1 + DA 1 B) 1 DA 1 (6) (A + BCD) 1 BC = A 1 B(C 1 + DA 1 B) 1 (7)

Results (information form) ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k

Results (information form) ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k P 1 k k = P 1 k k 1 + HT k R 1 k H k ˆx k k = P k k (P 1 k k 1ˆx k k 1 + H T k R 1 k z k ) (8) (Compare (2) from before)

Results (Kalman-gain form) ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k

Results (Kalman-gain form) ˆx k k 1 = F k ˆx k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q k K = P k k 1 H T k ( ) 1 R k + H k P k k 1 Hk T P k k = (I KH k )P k k 1 ˆx k k = ˆx k k 1 + K ( z k H k ˆx k k 1 ) (9) (Compare (3), and see kalman update.m)

Outline What is the Kalman Filter? State Space Models Kalman Filter Overview Bayesian Updating of Estimates Kalman Filter Equations Extensions

Prediction & Smoothing The model allows us to predict ahead of the measurements, at each iteration we maintain the optimal estimate of the future state given the data we have so far.

Prediction & Smoothing The model allows us to predict ahead of the measurements, at each iteration we maintain the optimal estimate of the future state given the data we have so far. We can also estimate the state at a point before the current measurement known as fixed lag smoothing.

Prediction & Smoothing The model allows us to predict ahead of the measurements, at each iteration we maintain the optimal estimate of the future state given the data we have so far. We can also estimate the state at a point before the current measurement known as fixed lag smoothing. If we first collect all the data and want to process it offline ( fixed interval smoothing ), then a closely related algorithm can be derived.

Prediction & Smoothing The model allows us to predict ahead of the measurements, at each iteration we maintain the optimal estimate of the future state given the data we have so far. We can also estimate the state at a point before the current measurement known as fixed lag smoothing. If we first collect all the data and want to process it offline ( fixed interval smoothing ), then a closely related algorithm can be derived. The Rauch Tung Striebel Smoother (or Kalman Smoother) uses a forward-backward algorithm to achieve optimal offline smoothing with two passes of a Kalman-like recursion. (see kalman smoother.m).

Nonlinearity For non-linear state space models x k = f k (x k 1, u k ) + w k z k = h k (x k ) + v k

Nonlinearity For non-linear state space models x k = f k (x k 1, u k ) + w k z k = h k (x k ) + v k Either, repeatedly linearise about the current point (EKF)

Nonlinearity For non-linear state space models x k = f k (x k 1, u k ) + w k z k = h k (x k ) + v k Either, repeatedly linearise about the current point (EKF) Or, non-linearly propagate (deterministic) samples and re-estimate the Gaussian mean and covariance (UKF)

Non-Gaussianity If the process or measurement noise isn t normally distributed, then for the correction step p(x k ˆx k k 1, z k ) p(z k x k ) p(x k ˆx k k 1 ) we can sample from the distribution using Markov Chain Monte Carlo methods.

Non-Gaussianity If the process or measurement noise isn t normally distributed, then for the correction step p(x k ˆx k k 1, z k ) p(z k x k ) p(x k ˆx k k 1 ) we can sample from the distribution using Markov Chain Monte Carlo methods. This is known as Sequential Monte Carlo (SMC) or Particle Filtering, and is a very powerful technique. See, for example, the Condensation algorithm in computer vision.