















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















































1 Introduction
Chapter ?? introduced hidden Markov models (HMMs), and Chapter ?? introduced state space models (SSMs), both of which are popular, but somewhat inflexible, models of sequential data. In this chapter, we consider more complex models. The key generalization is to represent the hidden state in terms of a set of random variables, instead of a single random variable.^1 Similarly we can represent the observations in a factorized or distributed manner. We can then use graphical models to represent conditional indepencies between these variables, both within and across positions in the sequence. Sequential data comes in two main forms: temporal (time-series) data, which is generated sequentially by some causal process, and sequence data (e.g., bio-sequences or natural language), where we are more agnostic about the generating mechanism. For modelling time-series data, it is natural to use directed graphical models, which can capture the fact that time flows forward. Arcs within a time-slice can be directed or undirected, since they model “instantaneous” correlation. If all arcs are directed, both within and between slices, the model is called a dynamic Bayesian network (DBN). (The term “dynamic” means we are modelling a dynamic system, and does not mean the graph structure changes over time.) DBNs are quite popular because they are easy to interpret and learn: because the graph is directed, the conditional probability distribution (CPD) of each node can be estimated independently. In this chapter, we will focus on DBNs. For modelling atemporal sequence data, it is possible to use directed or undirected graphical models. Much of our discussion of offline inference in temporal models is also applicable to atemporal models. The online inference methods we discuss can be applied to temporal models, but can also be used for sequential learning of static models, which is useful if the data is non-stationary or too large for batch methods. We will not discuss learning (parameter estimation and model selection) in this chapter, since the techniques are just simple extensions of the methods for learning static models. Also, we defer discussion of sequential decision making (control/ reinforcement learning problems) to Chapter ??.
2 Representation
In an HMM, the hidden state is represented in terms of a single discrete random variable, which can take on M possible values, Qt ∈ { 1 ,... , M }. In an SSM, the hidden state is represented in terms of a single vector-valued random variable, Xt ∈ IRM^. In a DBN, the hidden state is represented in terms of a set of Nh random variables, Q( ti ), i ∈ { 1 ,... , Nh}, each of which can be discrete or continuous. Similarly, the observation can be represented in terms of No random varables, each of which can be discrete or continuous. In an HMM/SSM, we have to define the transition model, P (Qt|Qt− 1 ), the observation model, P (Yt|Qt), and the initial state distribution, P (Q 1 ). (These distributions may be conditioned on an input (control signal) Ut if present, e.g., the transition model would become P (Qt|Qt− 1 , Ut− 1 ).) In a DBN, Qt, Yt and Ut represent sets of variables, so ∗To appear in Probabilistic Graphical Models , M. Jordan (^1) It is always possible to combine continuous-valued variables into a single vector-valued variable, but this obscures any conditional indepen- dencies that may exist between the components, defeating the purpose of using a graphical model. See Section 2.9.
we define the corresponding conditional distributions using a two-slice temporal Bayes net (2TBN), which we shall denote by B→. The transition and observation models are then defined as a product of the CPDs in the 2TBN:
P (Zt|Zt− 1 ) =
i=
P (Z t( i)|Pa(Z t( i)))
where Z t( i)is the i’th node in slice t (which may be hidden or observed; hence N = Nh + No), and Pa(Z t( i)) are the
parents of Z( ti ), which may be in the same or previous time-slice (assuming we restrict ourselves to first-order Markov
models). We can represent the unconditional initial state distribution, P (Z 1 (1: N^ )), using a standard (one-slice) Bayes net, which we shall denote by B 1. Together, B 1 and B→ define the DBN. The joint distribution for a sequence of length T can be obtained by “unrolling” the network until we have T slices, and then multiplying together all of the CPDs:
P (Z(1:1:TN )) =
i=
PB 1 (Z 1 (i )|Pa(Z t( i))) ×
t=
i=
PB→ (Z t( i)|Pa(Z t( i)))
For example, Figure 1 shows a 2TBN for a standard HMM/SSM, and an unrolled version for a sequence of length T = 4. In this case, Z(1) t = Qt, Z(2) t = Yt, Pa(Qt) = Qt− 1 and Pa(Yt) = Qt, so the joint becomes
t=
P (Qt|Qt− 1 )P (Yt|Qt)
The parameters for slices t = 2, 3 ,... are assumed to be the same (tied across time), as shown in Figure 2. This allows us to model unbounded amounts of data with a finite number of parameters. In the following sections, we will present a series of more complex examples which should illustrate the large variety of models which we can define within this framework.
(a) (b)
Figure 1: (a) A 2TBN for an HMM/SSM. (b) The model unrolled for T = 4 slices.
π A
Figure 2: An HMM in which we explicitly represent the parameters (nodes with outgoing dotted arcs) and the fact that they are tied across time-slices. The parameters are P (Q 1 = i) = π(i), P (Qt = j|Qt− 1 = i) = A(i, j), and P (Yt = j|Qt = i) = B(i, j). If the CPD for Yt is a Gaussian, we would replace the B node with the mean and covariance parameters.
Figure 4: An auto-regressive HMM.
where Wi is the regression matrix given that Qt is in state i. This model has a variety of different names: correlation HMM, conditionally Gaussian HMM, switching regression model, switching Markov model, etc. See Exercise ?? for some extensions.
Figure 5: A trigram (second-order Markov) model, which defines P (Qt|Qt− 1 , Qt− 2 ).
One of the simplest approaches to modelling sequential data is to construct a Markov model of order k. These are often called n-gram models (where n = k + 1), e.g., standard first-order Markov models are bigram models (n = 2), second-order Markov models are trigram models (n = 3), etc. See Figure 5 for an example. When Qt is a discrete random variable with many possible values (e.g., if Qt represents words), then there might not be enough data to reliably estimate P (Qt = k|Qt− 1 = j, Qt− 2 = i). A common approach is to create a mixture of lower-order Markov models:
P (Qt|Qt− 1 , Qt− 2 ) = α 3 (Qt− 1 , Qt− 2 )f (Qt|Qt− 1 , Qt− 2 ) + α 2 (Qt− 1 , Qt− 2 )f (Qt|Qt− 1 ) + α 1 (Qt− 1 , Qt− 2 )f (Qt)
where the α coefficients may optionally depend on the history, and f (·) is an arbitrary (conditional) probability distri- bution. This is the basis of the method called deleted interpolation. We can explicitly model the latent mixture variable implicit in the above equation as shown in Figure 6. Here St = 1 means use a unigram, St = 2 means use bi- and unigrams, and St = 3 means use tri-, bi- and uni-grams. St is called a switching parent, since it determines which of the other parents links are active, i.e., the effective topology of the graph changes depending on the value of the switch. Since St is hidden, the net effect is to use a mixture of all of these. A very similar approach, called mixed-memory Markov models, is to always use mixtures of bigrams at different lags, e.g., if St = 1, we use P (Qt|Qt− 1 ), and if St = 2, we use P (Qt|Qt− 2 ). This can be achieved by simply changing the “guard condition” on the Qt− 1 to Qt link to be St = 1 instead of St ≥ 2 ; similarly, the guard on the Qt− 2 to Qt link becomes St = 2 instead of St ≥ 3. Hence St acts like the input to a multiplexer, choosing one of the parents to feed into Qt. Using the terminology of [BZ02], St is the switching parent, and the other parents are the conditional parents. The overall effect is to define the CPD as follows:
P (Qt|Qt− 1 ,... , Qt−n) =
∑^ n
i=
P (Qt|Qt−i)P (St = i)
Figure 7 shows a factorial HMM, which has a single output (observation) variable but has a distributed representation for the hidden state. Note that, although all the hidden chains are a priori independent, once we condition on the evidence, they all become correlated. Intuitively, this is because all the chains “compete” to explain each observation (the explaining away phenomenon); more formally, this can be seen by noticing that all the chains become connected in the moral graph, because they share a common observed child. This fact means exact inference in this model takes
St− 3 St− 2 St− 1 St
Qt− 3 Qt− 2 Qt− 1 Qt
St ≥ 3
St ≥ 2
Figure 6: A mixed-memory Markov model. The dashed arc from St to Qt means St is a switching parent: it is used to decide which of the other parents to use, either Qt− 1 or Qt− 2 or both. The conditions under which each arc is active are shown for the Qt node only, to reduce clutter. In deleted interpolation, the Qt− 1 → Qt arc is active for states St ∈ { 2 , 3 }, and the Qt− 2 → Qt arc is active for states St ∈ { 3 }. (If St = 1, then Qt⊥(Qt− 1 , Qt− 2 ).) In mixed memory models, the Qt− 1 → Qt arc is active iff St = 1, and the Qt− 2 → Qt arc is active iff St = 2. The dotted arcs from Qt− 1 and Qt− 2 to St are optional, and reflect the fact that the coefficients can depend on the identity of the words in the window. See text for details. Based on Figure 15 of [Bil01].
Figure 7: A factorial HMM with 3 hidden chains.
O(M Nh^ ) operations per time step. Unfortunately this is true for most DBNs, even ones which do not have densely connected nodes such as Yt, as we discuss in Section 4. A factorial HMM, like any discrete-state DBN, can be converted to a regular HMM by creating a single “mega” variable, Qt, whose state space is the Cartesian product of each of the discrete hidden variables. However, this is a bad idea: the resulting “flat” representation is hard to interpret, inference in the flat model will be exponentially slower (see Section 4.2), and learning will be harder because there will be exponentially many more parameters. This last statement needs some explanation. Although it is true that the entries of the transition matrix of the flat HMM have constraints between them (so the number of free parameters remains the same in both the flat and the factored representation), it is hard to exploit these constraints either in inference or learning. For example, if Nh = 2, the flat transition matrix can be computed as follows:
P (Q(1) t = j 1 , Q(2) t = j 2 |Q(1) t− 1 = i 1 , Q(2) t− 1 = i 2 ) = P (Q(1) t = j 1 |Q(1) t− 1 = i 1 ) × P (Q(2) t = j 2 |Q(2) t− 1 = i 2 )
Hence the free parameters, which are the pairwise transition matrices on the right hand side of this equation, get combined in a way which is hard to disentangle: see Figure 8. By contrast, If all CPDs are linear-Gaussian, so the resulting joint distribution is a multivariate Gaussian, sparse graphical structure corresponds to sparse matrices in the traditional sense of having many zeros: see Section 2.9.
Figure 10: A variable-duration HMM. Qt represents the state, and QDt represents how long we have been in that state (duration).
emission probabilities as the original state. For example, consider this model.
1 − p 1 − p 11 −− pp
p p p p
Obviously the smallest sequence this can generate is of length n = 4. Any path of length l through the model has probability pl−n(1 − p)n; the number of possible paths is
( (^) l− 1 n− 1
, so the total probability of a path of length l is
p(l) =
l − 1 n − 1
pl−n(1 − p)n
This is the negative binomial distribution. By adjusting n and p, we can model a wide range of waiting times. A more general approach is to explicitely model the duration of each state. This is called a semi-Markov model, because to predict the next state, it is not sufficient to condition on the past state: we also need to know how long we’ve been in that state. pi(d) can be represented as a table (a non-parametric approach) or as some kind of parametric function. If pi(d) is a geometric distribution, the model becomes equivalent to a standard HMM. A first attempt at modelling this as a DBN is shown in Figure 10. We explicitly add QDt , the remaining duration of state Qt, to the state-space. (Even though Qt is constant for a long period, we copy its value across every time slice, to ensure a regular structure.) When we first enter state i, QDt is set to a value from from qi(·); it then deterministically counts down to 0. When QDt = 0, the state is free to change, and QDt is set to the duration of the new state. We can encode this behavior by defining the CPDs as follows:
P (Qt = j|Qt− 1 = i, QDt− 1 = d) =
δ(i, j) if d > 0 (remain in same state) A(i, j) if d = 0 (transition)
P (QDt = d′|QDt− 1 = d, Qt = k) =
pk (d′) if d = 0 (reset) δ(d′, d − 1) if d > 0 (decrement)
Since we have expanded the state space, inference in a variable-duration HMM is slower than in a regular HMM. The naive approach to inference in this DBN takes O(T D^2 M 2 ) time, where D is the maximum number of steps we can spend in any state, and M is the number of HMM states. However, we can exploit the fact that the CPD for QD^ is deterministic to reduce this to O(T DM 2 ). To facilitate future generalizations, we introduce deterministic “finish” nodes, that “turn on” when the duration counter reaches 0. This is a signal that Qt can change state, and that a new duration should be chosen. See Figure 11. We define the CPDs as follows:
Figure 11: A variable-duration HMM with explicit finish nodes. Qt represents the state, and QDt represents how long we have been in that state (duration), and Ft is a binary indicator variable that turns to indicate that QDt has finished.
P (Qt = j|Qt− 1 = i, Ft− 1 = f ) =
δ(i, j) if f = 0 (remain in same state) A(i, j) if f = 1 (transition) P (QDt = d′|QDt− 1 = d, Qt = k, Ft− 1 = 1) = pk (d′)
P (QDt = d′|QDt− 1 = d, Qt = k, Ft− 1 = 0) =
δ(d′, d − 1) if d > 0 undefined if d = 0 P (Ft = 1|QDt = d) = δ(d, 0)
Note that P (QDt = d′|QDt− 1 = d, Qt = k, Ft− 1 = 0) is undefined if d = 0, since if QDt− 1 = 0, then Ft− 1 = 1, by construction.
q
y1 y2 y3 y4 y5 y6 y7 y
q2 q
Figure 12: A time-series is divided into 3 segments of different lengths.
The overall effect of using a variable duration HMM is illustrated in Figure 12: the sequence is divided into a series of segments of different lengths; the observations within each segment are assumed to be iid, conditioned on the state. (We will generalize this in Section 2.7.) The assignment of values to the nodes in Figure 11 corresponding to this example is as follows: Qt q 1 q 1 q 1 q 2 q 2 q 3 q 3 q 3 Dt 2 1 0 1 0 2 1 0 Ft 0 0 1 0 1 0 0 1 Yt y 1 y 2 y 3 y 4 y 5 y 6 y 7 y 8 We see that the places where F turns on represent segment boundaries.
The basic idea of a segment model is that each HMM state can generate a sequence of observations, as in Figure 12, instead of just a single observation, The difference from a variable-duration HMM is that we do not assume the observations within each segment are conditionally independent; instead we can use an arbitrary model for their joint
so that t 0 = 1 and t 1 = l. If we assume the observations are conditionally independent,
P (y1:l|Qt = k, l) =
∏^ l
t=
P (yt|Qt = k)
we recover the variable-duration HMM in Figure 11. (If p(l|q) is a geometric distribution, this becomes a regular HMM.) Note that the number of segments is equal to the number of transitions of the Qt nodes, or equivalently, the number of times Ft turns on. By considering all possible assignments to Qt and QDt (and hence to Ft), we consider all possible segmentations of the data. The next simplest segment model is to model each segment P (y1:l|Qt = k, l) using an HMM, i.e.,
P (y1:l|Qt = k, l) =
q1:l
πk (q 1 )P (y 1 |Qt = k, Q^21 = q 1 )
∏^ l
τ =
Ak (qτ − 1 , qτ )P (yt|Qt = k, Q^2 τ = qτ )
where Q^2 t represents the state of the HMM within this particular segment. We can model this as a DBN as shown in Figure 14. (Naturally we could allow arcs between the Yt arcs, as in Section 2.2). The CPDs for Qt, QDt and Ft are the same as in Figure 11. The CPD for Yt gets modified because it must condition on both Qt and the state within the segment-level HMM, Q^2 t. The CPD for Q^2 t is as follows:
P (Q^2 t = j|Q^2 t− 1 = i, Qt = k, Ft− 1 = f ) =
π k^2 (j) if f = 0 (reset) A^2 k (i, j) if f = 1 (transition)
It is straightforward to use other models to define the segment likelihood P (y1:l|Qt = k, l), e.g., a second-order Markov model, or a state-space model (Section 2.9).
Y Y 6 7
q
1 1
q
2 1
q 1
Y 1
q 2
2
q
2 2
q 1
Y 3
q^3 2
Y 4
q 3 3
Y 5
q
1 2
(^3 )
Y
q^2 q^2 3 4
Figure 15: A time-series is hierarchically divided into segments. The transition/observation distributions of the sub- HMMs may be conditioned on their immediate context, or their entire surrounding context. In a context free system, information is not allowed to flow across segment boundaries, but this restriction can be lifted.
The Hierarchical HMM (HHMM) is a generalization of the segment HMM. It allows segment HMMs to be com- posed of segment sub-HMMs in a hierarchical fashion. See Figure 15 for an illustration of the basic idea. In addition, instead of specifying the length of each segment with a random variable, the length is defined implicitly by the amount of time it takes the sub-HMM to enter one of its end states. (The transition to the end state could be triggered by some environmental condition.) Entering an end-state terminates that segment, and returns control to the calling state, which is then free to change. The calling context is memorized on a depth-limited stack. Hence an HHMM is less powerful than stochastic context-free grammars (SCFGs) and recursive transition networks (RTNs), both of which can handle recursion to
an unbounded depth. However, HHMMs are sufficiently expressive for many practical problems, which often only involve tail-recursion (i.e., self transitions to an abstract state). Furthermore, HHMMs can be made much more computationally efficient than SCFGs. In particular, the inference algorithm for SCFGs, which is called the inside- outside algorithm, takes O(T 3 ), whereas we can use any of the techniques we discuss in Section 3 to do inference in an HHMM in O(T ) time.
a b c d
x y
Figure 16: State transition diagram for a three-level HHMM representing the regular expression (a+|a+(xy)+b|c|c(xy)+d)
. Solid arcs represent horizontal transitions between states; dotted arcs represent vertical transitions, i.e., calling a sub-HMM. Double-ringed states are accepting (end) states. Dashed arcs are emissions from production (concrete) states. In this example, each production state emits a unique symbol, but in general, it can have a distribution over output symbols.
Figure 16 shows the state transition diagram of an example HHMM which models the regular expression ( a+^ | a+(xy)+b | c | c(xy)+d
The key difference from using a flat HMM to model this is that the model for the sub-expression (xy)+^ is re-used in both the a+(xy)+b and c(xy)+d subexpressions. In this small example, the benefits of re-use are minimal, but in general a hierarchical model with reuse needs substantially fewer parameters. The state of the HHMM can be defined by specifying the value of the state variables at each level of the hierarchy, call them Q(1) t ,... , Q( tD ), where D is the depth. States which emit single observations are called “production states”, and those that emit strings (by calling sub-HMMs) are termed “abstract states”. For example, consider the states in the middle row on the left of Figure 16: state (1, 1 , −) is concrete and emits a, state (1, 2 , −) is abstract, and state (1, 3 , −) is concrete and emits b. The “leaf” states are all concrete, by definition: state (1, 2 , 1) emits x and (1, 2 , 2) emits y. Note that states (1, 2 , 1) and (2, 2 , 1) are the same (we could denote them by (−, 2 , 1)), since the bottom-level HMM is reused in both top-level contexts. The DBN that corresponds to the above example is shown in Figure 17. Let us see how the assignment of values to the nodes in the DBN correspond to different parses (paths through the automaton). Consider the string aaxybc; there are two possible parses, (aaxyb)(c) or (a)(axyb)(c), corresponding to whether the two a’s belong together (i.e., both are generated from a+(xy)+b), or are separate (i.e., one is from a+^ and one is from a+(xy)+b). In addition, the c could be the beginning of the subexpression c(xy)+d, or a single c; we assume we know this is a complete string (rather than a substring), hence the c is terminal (so F (^) T^2 = 1). The assignments to the nodes in the DBN for the joint aa hypothesis are as follows (− represents a don’t care value):
(^2) This notation means the model must produce one or more a ’s, or one or more a ’s followed by one or more x ’s and y ’s followed by a single b , or a c , or a c followed by one or more x ’s and y ’s followed by a d. Having created one of these strings, it is free to create another one. An HHMM cannot make a horizontal transition before it makes a vertical one; hence it cannot produce the empty string. For example, in Figure 16, it is not possible to transition directly from state 1 to 2.
context is “popped off the stack” upon exiting. (In other words, the corridor models are not context free.) Instead, we condition the new starting state on some function of the old state. We leave the details as an exercise.
Figure 18: An HMM/SSM with input. The dotted arcs are optional, and reflect the fact that the input may affect the output directly.
The graph structure for an SSM looks identical to that for an HMM, since it makes the same conditional inde- pendence assumptions. Typically one also includes an input node, as in Figure 18. In an SSM, all the nodes are continuous, and all the CPDs are linear-Gaussian, i.e.,
P (Xt = xt|Xt− 1 = xt− 1 , Ut = u) = N (xt; Axt− 1 + Bu, Q) P (Yt = y|Xt = x, Ut = u) = N (y; Cx + Du, R)
We do not need to define P (Ut), since this is an exogoneous input variable that is always observed. In the case of SSMs, unlike for HMMs, there is a one-to-one correspondence between sparse graphical structure and sparse parametric structure. In particular, A(i, j) > 0 iff there is a directed arc from X (^) t(−i) 1 to X t( j), and similarly for the other regression matrices, B, C and D. For the covariance matrices, we make use of the fact that, in an undirected Gaussian graphical model, zeros in the precision (inverse covariance) matrix correspond to absent arcs.
Hence Q−^1 (i, j) > 0 iff there is an undirected arc from X ( t i)to X t( j)within the same time slice. For example, consider a factorial SSM, as in Figure 7, but where all the CPDs are linear-Gaussian, and there are two chains. The corresponding joint transition function is
P (X t^1 , X t^1 |X t^1 − 1 , X t^1 − 1 ) = N
X t^1 X t^2
X t^1 − 1 X t^2 − 1
Contrast this with the discrete case shown in Figure 8. For a more complex example, consider a vector auto-regressive process of order 2:
Xt = A 1 Xt− 1 + A 2 Xt− 2 + t
where t ∼ N (0, Σ). (We ignore the Ut and Yt variables for simplicity.) Suppose the parameters are as follows.
3 5 0
1 5 0 0 0 35 0 − 15 0 2 5
1 3
3 5 0 0 0 0 0 − (^1215) (^0 0 15 0 )
and
1 2 1 −^
1 1 3 0 0 3 −^
1 3 1 0 0 0 0 0 1 0 0 0 0 0 1
Then the resulting dynamic chain graph is illustrated in Figure 19.
Figure 19: A VAR(2) process represented as a dynamic chain graph. From [DE00].
α 0 α 1 α 2
y 1 y 2
x 1 x 2
Figure 20: A DBN for the recursive least squares problem.
The problem of online parameter estimation can be represented by adding the parameters to the state space. For example, suppose we want to recursively (i.e., sequentially) estimate the coefficients, α, in a linear regression model, where we assume the noise level, R, is known. This can be modelled as shown in Figure 20. The CPDs are as follows:
P (α 0 ) = N (α 0 ; 0, ∞I) P (yt|xt, αt) = N (yt; x′ tαt, R) P (αt|αt− 1 ) = N (αt; αt− 1 , 0)
(We do not need to specify the CPD for xt, since in linear regression, we assume the input is always known, so it suffices to use a conditional likelihood model.) The infinite variance for α 0 is an uninformative prior. The zero variance for αt reflects the fact that the parameter is constant. If we made the variance non-zero, we could allow slow changes in the parameters, and hence track non-stationarities. We can perform exact inference in this model using the Kalman filter, where αt is the hidden state, and we use a time-varying output matrix Ct = x′ t; we set the transition matrix to A = I, the transition noise to K = 0, and the observation noise to R. This is just the recursive least squares algorithm discussed in Section 2.10. Now consider a non-linear regression model:
yt =
∑^ k
j=
aj,tφ(||xt − μj,t||) + bt + β t′xt + t
where t ∼ N (0, σt) is a noise term and φ(||xt − μj,t||) is e.g., a radial basis function (RBF); if k = 0, this reduces to a linear regression model. We can write this in vector-matrix form as follows:
yt = D(μt, xt)αt + nt
P (Xt = xt|Xt− 1 = xt− 1 , St = i) = N (xt; Aixt− 1 , Qi) P (Yt = y|Xt = x) = N (y; Cx, R) P (St = j|St− 1 = i) = M (i, j)
Since this model has both discrete and continuous hidden variables, it is sometimes called a hybrid DBN. Exact inference in such model is very difficult, as we discuss in Section 5.2.4. Contrast this with an auto-regressive HMM (Section 2.2) in which all the hidden variables are discrete, making exact inference easy. In addition to switching Xt, it is possible to switch Yt. This can be used to represent P (Yt|Xt) as a mixture, which can approximate non-Gaussian observation densities. For example, in order to be robust to outliers, it is common to assume P (Yt|Xt) is a mixture of a Gaussian distribution and a uniform distribution (which can be approximated using a Gaussian with very large covariance). An application of switching SSM to fault diagnosis is discussed in Exercise ??. We will see some other applications of this below.
2.11.1 Data association
Figure 23: A DBN for the data association problem. The observation Yt comes from one of two independent sources, as determined by the multiplexer node St. Square nodes are discrete, round nodes are continuous.
Another important application of switching SSMs is for modelling the data association (correspondence) problem.
In this problem, we are interested in tracking the state of several “objects” X (1) t ,... , Xt( D. At each time step, we get an observation, Yt, but we do not which (if any) of the objects caused it. The data association problem is extremely common. For example, consider visually tracking a person as they move around a cluttered room. At each frame, we must decide which body part (if any) caused which pixel. Another example concerns tracking missiles using radar. At each scan, we must decide which missile (if any) caused which “blip” on the screen. A simple model for this is shown in Figure 23. St is a latent variable which specifies the identity of the source of the observation Yt. It is a switching parent, and is used to “select” which of the hidden chains to “pass through” to the output, i.e., the CPD for P (Yt|Xt1: D, St) is a (Gaussian) multiplexer:
P (Yt = y|St = i, X t(1) ,... , X t( D)) = N (y; Wi X t( i)+ μi, Ri)
Because of its military importance, a lot of effort has been expended on the problem of tracking multiple targets in clutter. See Section 5.5 for further discussion.
3 Inference
Having seen a large variety of different DBNs, we now discuss how to perform inference in such models. There are a variety of inference problems we might be interested in (see Figure 24 for a summary):
Filtering Computing P (Xt|y1:t), i.e., monitoring (tracking) the state over time.
Prediction Computing P (Xt+h|y1:t) for some horizon h > 0 into the future.
Fixed-lag smoothing Computing P (Xt−l|y1:t), i.e., estimating what happened l > 0 steps in the past given all the evidence up to the present (hindsight).
Fixed-interval smoothing (offline) Computing P (Xt|y1:T ). This is used as a subroutine for offline training.
Viterbi decoding Computing arg maxx1:t P (x1:t|y1:t), i.e., figuring out the most likely cause/ explanation of the observed data.
Classification Computing P (y1:t) =
x1:t P^ (x1:t, y1:t). This can be used to compute the likelihood of a sequence under different models.
t
t
t
t T
P(X(t) | y(1:t))
P(X(t) | y(1:T))
P(X(t-L) | y(1:t))
L
H
P(X(t+H) | y(1:t))
filtering
prediction
fixed-lag
smoothing (offline)
smoothing
fixed interval
Figure 24: The main kinds of inference for DBNs. The shaded region is the interval for which we have data. The arrow represents the time step at which we want to perform inference. t is the current time, and T is the sequence length. h is a prediction horizon and l is a time lag.
We will focus on online filtering and offline smoothing; the other problems can be solved by similar methods.^3 It will be helpful to distinguish models in which all the hidden nodes are discrete from models in which some (or all) hidden nodes are continuous, since they require different solution techniques (just as we saw that inference in an HMM required different techniques than inference in an SSM).
4 Exact inference in discrete-state models
In this section, we discuss exact filtering and smoothing algorithms for DBNs in which all the hidden variables are discrete. (Continuous nodes that are observed do not cause a problem, no matter what their distribution, since they only affect the inference by means of the conditional likelihood, c.f., the Ot(i, i) = P (yt|Xt = i) term for HMMs.)
The simplest inference method for a discrete-state DBN is to convert it to an HMM, and then to apply the forwards- backwards algorithm. If there are Nh hidden variables per slice, and each such variable can have up to M values, (^3) For example, the quantity needed to classify a sequence, P (y1:t), is computed as a by-product of filtering. Also, any filtering algorithm can be converted to a Viterbi algorithm by replacing the “sum” operator with the “max” operator. Finally, any offline smoothing algorithm can be made online by simply using a sliding window.
Figure 26: A coupled HMM with 4 chains. Even though chain 1 is not directly connected to chain 4, they become correlated once we unroll the DBN, as indicated by the dotted line. That inference in this model is intractable should not be surprising, since the graph is very similar to a 2D lattice MRF.
Figure 27: A DBN in which all the nodes in the last slice become connected when we eliminate nodes in a slice-by- slice order π, implying m(π) = 4 + 1 = 5, even though, using an unconstrained order that exploits the tree structure, m(π∗) = 2.
A natural ordering is to work left-to-right, i.e., we eliminate all nodes in slice t (in some optimal order) before any in slice t + 1. Unfortunately, such a constrained ordering is not always optimal. For example, Figure 27 shows a DBN where m(π∗) = 2 (since the graph is a set of trees). However, if we unroll the graph for T ≥ 4 slices, and eliminate all the nodes in slice t before eliminating any nodes in slice t + 1, we find m(π) = 5. This is a consequence of the following theorem:
Theorem (Constrained elimination ordering) [RTL76]. Let A 1 ,... , An be an elimination sequence triangulating the (moral) graph G, and let Ai, Ak be two non-neighbors in G, i < k. Then the elimination sequence introduces the fill-in Ai − Ak iff there is a path Ai − Aj −... − Ak such that all intermediate nodes Aj are eliminated before Ai.
To apply this theorem to the example in Figure 27, let Ai = X( t i)and Ak = X t( k). Suppose we first eliminate all
the X τ(i )for all τ < t; these become the Aj ’s. Since Ai is connected to Ak via some (undirected) path through the past Aj ’s (if t ≥ 4 ), we will add a fill-in between them. Hence all the nodes in slice t will become connected. To precisely characterize the consequences of using a slice-by-slice elimination ordering, let us first make the fol- lowing definition.
Definition. Let the set of temporal arcs between slices t − 1 and t be denoted by Etmp(t) = {(u, v) ∈ E|u ∈ Vt− 1 , v ∈ Vt}, where Vt are the nodes in slice t. The incoming interface I (^) t← is defined as all nodes v s.t. v, or one of
10 11
12
13
15
14
17
16
18
Fungi
Mildew
LAI
Precip
Micro
Temp
Photo
Solar
Dry
1
2
3
4
5
6
7
8
9
Fungi
Mildew
LAI
Precip
Micro
Temp
Photo
Solar
Dry
Figure 28: The Mildew DBN, designed for foreacasting the gross yield of wheat based on climatic data, observations of leaf area index (LAI) and extension of mildew, and knowledge of amount of fungicides used and time of usage [Kja95]. The nodes in the incoming interface are shown in bold outline. Note how the transient node photo is in the incoming interface, because it is the parent of the persistent node dry, which has an incoming temporal arc.
its children, has a parent in slice t − 1 , i.e., I (^) t← = {v ∈ Vt|(u, v) ∈ Etmp(t) or ∃w ∈ ch(v) : (u, w) ∈ Etmp(t), u ∈ Vt− 1 }. See Figure 28 for an example. (We call it the incoming interface to distinguish it from the outgoing interface, which we shall define shortly.)
Now we can put tight lower and upper bounds on the complexity of inference using a slice-by-slice elimination ordering.
Theorem. Let G be a DBN with N nodes per slice, unrolled for T > 1 slices, which forms a single connected component.^4 If π is any slice-by-slice elimination ordering for G, then |I ←| + 1 ≤ m(π) ≤ |I←| + N , and the bounds are tight. Proof. When we eliminate the nodes in slice t, the only variables that are involved are Vt∪I t←+1. Hence m(π) ≤ |Vt∪I t← | = N + |I←|. Figure 29 shows a DBN where I←^ = N and m(π∗) = 2N ; since m(π) ≤ m(π∗), we see that the upper bound is tight. To establish the lower bound, note that since the graph is a single connected compo- nent, at least one of the nodes in the incoming interface must have a parent in the previous slice; hence there must be some stage in the elimination process which contains this “old” node plus all the interface nodes, so |I ←| + 1 ≤ m(π). To see that the bound is tight, consider a Markov chain: this has |I ←| = 1, so a max clique size of 2 can be achieved.
Hence the constrained junction tree algorithm takes Ω(M |I
←|+ ) operations per time step (assuming all nodes in the incoming interface can have M possible values). Note that this may be exponentially faster than the time required
by the forwards-backwards algorithm, which performs O(M 2 Nh^ ) operations per time step; nevertheless, it is still exponential in |I←|.
4.2.2 Unconstrained elimination orderings
What happens if we use an unconstrained elimination ordering? In principle we can do better. However, in practice, this is rarely the case. Recall that finding the optimal elimination ordering is NP-hard. Hence most elimination orderings are computed using local search algorithms. Empirically it has been found by several researchers that (^4) Figure 30 shows a counter-example to the theorem when the DBN is not a single connected component.