• No results found

The equations for Kalman filtering/ smoothing can be derived in an analogous manner to the equations for HMMs, except the algebra is somewhat heavier. Please see e.g., [BSL93, Min99, Jor02] for derivations. Here we just state the final results without proof.

YC 1 Y2C Y3C C1 C2 C3 R B1 B2 B3 YB 1 Y2B Y3B

Figure 3.17: Conditioned on the static root, the interface is fully factored.

Forwards pass

Let us denote the mean and covariance of the belief stateP(Xt|y1:t)by(xt|t, Vt|t). The forward operator,

(xt|t, Vt|t, Lt) =Fwd(xt1|t−1, Vt−1|t−1, yt;At, Ct, Qt, Rt) is defined as follows.9First, we compute the predicted mean and variance.

xt|t−1 = Axt−1|t−1

Vt|t−1 = AVt−1|t−1A0+Q

Then we compute the error in our prediction (the innovation), the variance of the error, the Kalman gain matrix, and the conditional log-likelihood of this observation.

et = yt−Cxt|t−1

St = CVt|t−1C0+R

Kt = Vt|t−1C0S−t1 Lt = logN(et; 0, St)

Finally, we update our estimates of the mean and variance.

xt|t = xt|t−1+Ktet

Vt|t = (I−KtC)Vt|t−1=Vt|t−1−KtStKt0

These equations are more intuitive than they may seem. For example, our expected belief aboutxtis equal to our prediction,xt|t−1, plus a weighted error term,Ktet, where the weightKt=Vt|t−1C0St−1, depends

on the ratio of our prior uncertainty,Vt|t−1, to the uncertainty in our error measurement,St.

Backwards pass

The backwards operator

(xt|T, Vt|T, Vt−1,t|T) =Back(xt+1|T, Vt+1|T, xt|t, Vt|t;At+1, Qt+1)

9Normally random variables are upper case letters, and their values are lower case; however, in this and other sections, we follow the

is defined as follows (this is the analog of theγrecursion in Section 3.2.3). First we compute the following predicted quantities (or we could pass them in from the filtering stage):

xt+1|t = At+1xt|t

Vt+1|t = At+1Vt|tA0t+1+Qt+1 Then we compute the smoother gain matrix.

Jt=Vt|tA0t+1Vt−+11|t

Finally, we compute our estimates of the mean, variance, and cross varianceVt,t1|T =Cov[Xt−1, Xt|y1:T].10 xt|T = xt|t+Jt xt+1|T−xt+1|t Vt|T = Vt|t+Jt Vt+1|T −Vt+1|t J0 t Vt1,t|T = Jt−1Vt|T

These equations are known as the Rauch-Tung-Striebel (RTS) equations. It is also possible to derive a two- filter approach to smoothing, as for HMMs (see [Jor02, ch13] and [FP69]). In this case, the analog ofΠtis

Σt, which can be computed from the following Lyapunov equation:

Σt=E[XtX0

t] =E[(AXt−1+Wt)(AXt−1+Wt)0] =AE[Xt−1Xt0−1]A0+E[WtWt0] =AΣt−1A0+Q The limit of this,limt→∞Σt, is known as the Riccati matrix.

Time and space complexity of Kalman filtering/smoothing

IfXtIRNx, andYt

∈IRNy, thenKtis aNx

×Nymatrix,Stis aNy×Nymatrix, andAtis aNx×Nx

matrix. The cost per update isO(min(N2

x, Ny3)); theNx2 term arises from theAxt−1|t−1computation; the

N3

y term arises from invertingSt. (For sparse matrices, it is possible to reduce the computational complexity

considerably, especially if we use the information filter.) If we want to trackN objects, each of sizeNx, inference takes O((NxN)2); hence KFMs do not suffer from the exponential growth in complexity that HMMs do. However, they are rather restrictive in their assumptions: see Section 1.3.4.

3.6.2

Inference in general linear-Gaussian DBNs

Any DBN in which all CPDs are linear-Gaussian can be converted to a KFM, just as any DBN in which all hidden variables are discrete can be converted to an HMM. If we haveDhidden continuous variables, each a vector of size K, the compound state-space will have size KD, and inference (using the Kalman filter/smoother) will takeO((KD)2)time per step. Hence the complexity only grows polynomially inD, unlike the discrete case, in which the complexity grows exponentially inD. Furthermore, the matrices of the compound KFM will be sparse, often block diagonal, reflecting the graph structure. Hence a standard Kalman filter/smoother will usually be as efficient as using the junction tree algorithm.

3.6.3

Switching KFMs

Consider the switching KFM in Figure 2.31. This is a conditionally Gaussian (CG) model (see Section B.5): if we knewS1:T, the distribution overX1:T, Y1:T would be jointly Gaussian. [LSK01] prove that inference in

CG networks is NP-hard, even if the structure is a (poly)tree, such as a switching KFM where the horizontal arcs between the switch nodes are absent. The proof is by reduction from subset sum, but the intuition is as follows: the priorP(X1)is a mixture ofKGaussians, depending onS1; when we marginalize outS1, we are still left with a mixture ofKGaussians; each one of these gets “passed through”K different matrices, depending on the value ofS2, resulting in a mixture of K2 Gaussians, etc; in general, the belief state at timetis a mixture ofKtGaussians. We discuss some approximate inference algorithms for this model in

Sections 4.3 and 5.3.1.

10The cross variance term is usually computed recursively, but this is unnecessary [Min99], c.f., in an HMM, we can computeξ

t−1,t directly rather than recursively, as shown in Section 3.2.4.

function smoother(y1:T) f1|1=Fwd1(y1) fort= 2 :T ft|t=Fwd(ft−1|t−1, yt) bT|T =BackT(fT|T) fort=T−1 : 1 bt|T=Back(bt+1|T, ft|t)

Figure 3.18: Pseudo-code for offline smoothing.

3.6.4

Non-linear/ non-Gaussian models

KFMs support exact inference because of two facts: a Gaussian pushed through a linear transformation, and subjected to additive Gaussian noise, still results in a Gaussian; and updating a Gaussian prior with a Gaussian likelihood, using Bayes’ rule, results in a Gaussian posterior. In other words, Gaussians are closed under Bayesian updating in KFMs. A few other distributions enjoy this property (see [WH97]), but in general, exact inference in DBNs with hidden continuous nodes which have CPDs other than linear-Gaussian is not possible.11 In particular, exact inference in systems which are non-linear and/or non-Gaussian is usually not

possible. We must therefore resort to approximations. There are essentially two classes of approximations, deterministic and stochastic: see Chapters 4 and 5 respectively.