In my previous post, I explained the Kalman Filter prediction equations in a big-picture way. In this post I will explain the update equations.
The equations to focus on are the last two. (We use the results from the first three equations in the last two equations.)
Eqn 1: Updating the object state x:
- x’ is the predicted object state (obtained from prediction equations).
- x is our updated belief as to what the object state is.
- y is the difference between the actual measurement z and the predicted measurement Hx’.
- The predicted measurement is Hx’. The measurement matrix H translates our prediction x’ into the same space as the measurement z.
- Think of H as changing units of x’ so it matches z’s, e.g. from centimetres to metres.
Kalman Gain K
K is the Kalman Gain. It’s how much our measurement affects our beliefs. The smaller the magnitude of the Kalman gain, the less our belief is affected by a new measurement that is different from our prediction.
- If we could change this, it’d be like the learning rate in deep learning, or like how un-Bayesian we want to be.
- We don’t directly change this parameter though. It comes from the equation .
- To understand what that means, let’s look at the one-dimensional case where we combine two normal distributions (our predicted object state and the measurement) to get a new normal distribution (our new object state).
- Algebraic manipulation yields .
- For details on this and going from 1D to the matrix analog, see Bzarg’s article on Kalman filters.
- So the Kalman Gain depends on the covariances of our object and the measurement. It is increasing in our object covariance and decreasing in the measurement covariance.
- That is, the more uncertain we are about our prediction, the more we allow our measurement to change the prediction. And the more uncertain we are about our measurement, the less we allow the measurement to change our prediction. Makes sense.
Updating x in one sentence: We bring our predicted object state closer to our observed measurement,
- where the amount of influence the measurement has on our beliefs depends on how uncertain we are about our prediction and our measurement.
Eqn 2: Updating the object covariance P:
- P’ is the predicted object covariance.
- P is our updated belief as to what the object covariance matrix is.
- K is the Kalman gain (see above).
- H is the measurement matrix.
Key insight: Notice that the object covariance decreases after every update step.
Updating P in one sentence: We decrease the object covariance by an amount that depends on how certain we are about our measurement.
Feature image credits: Udacity. A picture with a KAR and a MAN with a FILTER from Photogramio! Get it? 🙂