the Kalman filter
/ KAHL-mun /
Your phone tracks your position from GPS, but GPS is jittery and drops out in tunnels. Yet the blue dot glides smoothly along the road. The trick that makes this work — the same one that guided Apollo to the Moon — is the Kalman filter: a recipe for tracking the hidden state of a moving system by repeatedly blending what the model predicts with what the sensors measure, each weighted by how much you trust it.
It runs as an endless two-step rhythm. PREDICT: use the system's model (the car keeps moving at its last velocity) to forecast the next state and, crucially, to inflate your uncertainty about it, since the model is imperfect. UPDATE: when a measurement arrives, compute the difference between it and the prediction (the 'innovation'), and correct the prediction by a fraction of that difference. That fraction is the Kalman gain, and it is computed to be optimal: it leans toward the measurement when the sensor is precise relative to the prediction, and toward the prediction when the sensor is noisy. The filter also tracks a covariance matrix that quantifies its own uncertainty, shrinking it after a good measurement and growing it during prediction. For a linear system with Gaussian noise, this is provably the best possible estimate in the least-squares sense — it is the mean-squared-error-minimizing estimator, no heuristic.
The Kalman filter is everywhere motion or signals must be tracked through noise: navigation, robotics, spacecraft, finance, and as the conceptual heart of data assimilation. Two honest caveats. The plain filter assumes a LINEAR model and Gaussian noise; real systems are often nonlinear, which is why variants — the extended and unscented Kalman filters, and particle filters — exist, each with its own approximations and failure modes. And the filter's accuracy depends entirely on honestly stated noise levels: lie to it about how good your sensor is and it will confidently track the wrong thing.
A drone fuses a noisy GPS reading once per second with an accelerometer sampled 200 times per second. The Kalman filter predicts position from the accelerometer between GPS fixes, then snaps gently toward each GPS reading when it arrives — the gain trusting GPS for absolute position and the accelerometer for smooth short-term motion, giving a track far better than either sensor alone.
Predict from the model, correct with the sensor, weighted by the optimal Kalman gain — repeated forever.
The basic Kalman filter is optimal only for a linear model with Gaussian noise. Real systems are often nonlinear (hence the extended, unscented, and particle variants), and feeding the filter dishonest noise levels makes it confidently wrong.