function FIXED-LAG-SMOOTHING(et, hmm, d) returns a distribution over Xt−d
inputs: et, the current evidence for time step t
hmm, a hidden Markov model with S × S transition matrix T
d, the length of the lag for smoothing
persistent: t, the current time, initially 1
f, the forward message P(Xt | e1:t), initially hmm.PRIOR
B, the d-step backward transformation matrix, initially the identity matrix
et−d:t, double-ended list of evidence from t − d to t, initially empty
local variables: Ot−d, Ot, diagonal matrices containing the sensor model information
add et to the end of et−d:t
Ot ← diagonal matrix containing P(et | Xt)
if t > d then
f ← FORWARD(f, et)
remove et−d−1 from the beginning of et−d:t
Ot−d ← diagonal matrix containing P(et−d | Xt−d)
B ← Ot−d−1T−1 BTOt
else B ← BTOt
t ← t + 1
if t > d then return NORMALIZE(f × B1) else return null
Figure ?? An algorithm for smoothing with a fixed time lag of d steps, implemented as an oline algorithm that outputs the new smoothed estimate given the observation for a new time step. Notice that the final output NORMALIZE(f × B1) is just α f × b, by Equation (??).