T REE -S TRUCTURED R ECURRENT S WITCHING L INEAR D YNAMICAL S YSTEMS FOR M ULTI -S CALE M ODELING
Anonymous authors
Paper under double-blind review
A BSTRACT
Many real-world systems studied are governed by complex, nonlinear dynamics.
By modeling these dynamics, we can gain insight into how these systems work, make predictions about how they will behave, and develop strategies for controlling them.
While there are many methods for modeling nonlinear dynamical systems, existing techniques face a trade off between offering interpretable descriptions and making accurate predictions.
Here, we develop a class of models that aims to achieve both simultaneously, smoothly interpolating between simple descriptions and more complex, yet also more accurate models.
Our probabilistic model achieves this multi-scale property through a hierarchy of locally linear dynamics that jointly approximate global nonlinear dynamics.
We call it the tree-structured recurrent switching linear dynamical system.
To ﬁt this model, we present a fully-Bayesian sampling procedure using Pólya-Gamma data augmentation to allow for fast and conjugate Gibbs sampling.
Through a variety of synthetic and real examples, we show how these models outperform existing methods in both interpretability and predictive capability.
I NTRODUCTION
Complex systems can often be described at multiple levels of abstraction.
A computer program can be characterized by the list of functions it calls, the sequence of statements it executes, or the assembly instructions it sends to the microprocessor.
As we zoom in, we gain an increasingly nuanced view of the system and its dynamics.
The same is true of many natural systems.
For example, brain activity can be described in terms of high-level psychological states or via detailed ion channel activations; different tasks demand different levels of granularity.
One of our principal aims as scientists is to identify appropriate levels of abstraction for complex natural phenomena and to discover the dynamics that govern how these systems behave at each level of resolution.
Modern machine learning offers a powerful toolkit to aid in modeling the dynamics of complex systems.
Bayesian state space models and inference algorithms enable posterior inference of the latent states of a system and the parameters that govern their dynamics (Särkkä, 2013; Barber et al., 2011;
Doucet et al., 2001).
In recent years, this toolkit has been expanded to incorporate increasingly ﬂexible components like Gaussian processes (Frigola et al., 2014) and neural networks (Chung et al., 2015;
Johnson et al., 2016; Gao et al., 2016; Krishnan et al., 2017) into probabilistic time series models.
In neuroscience, sequential autoencoders offer highly accurate models of brain activity (Pandarinath et al., 2018).
However, while these methods offer state of the art predictive models, their dynamics are speciﬁed at only the most granular resolution, leaving the practitioner to tease out higher level structure post hoc.
Here we propose a probabilistic generative model that provides a multi-scale view of the dynamics through a hierarchical architecture.
We call it the tree-structured recurrent switching linear dynamical system , or TrSLDS.
The model builds on the recurrent SLDS (Linderman et al., 2017) to approximate latent nonlinear dynamics through a hierarchy of locally linear dynamics.
Once ﬁt, the TrSLDS can be queried at different levels of the hierarchy to obtain dynamical descriptions at multiple levels of resolution.
As we proceed down the tree, we obtain higher ﬁdelity, yet increasingly complex, descriptions.
Thus, depth offers a simple knob for trading off interpretability and ﬂexibility.
The key contributions are two-fold: ﬁrst, we introduce a new form of tree-structured stick breaking for multinomial models that strictly generalizes the sequential stick breaking of the original rSLDS, while still permitting Pólya-gamma data augmentation (Polson et al., 2013) for efﬁcient posterior inference; second, we develop a hierarchical prior that links dynamics parameters across levels of the tree, thereby providing descriptions that vary smoothly with depth.
The paper is organized as follows.
Section 2 provides background material on switching linear dynamical systems and their recurrent variants.
Section 3 presents our tree-structured model and
Section 4 derives an efﬁcient fully-Bayesian inference algorithm for the latent states and dynamics parameters.
Finally, in Section 5 we show how our model yields multi-scale dynamics descriptions for synthetic data from two standard nonlinear dynamical systems—the Lorenz attractor and the
FitzHugh-Nagumo model of nonlinear oscillation—as well as for a real dataset of neural responses to visual stimuli in a macaque monkey.
B ACKGROUND
Let x t ∈ R d x and y t ∈ R d y denote the latent state and the observation of the system at time t respectively.
The system can be described using a state-space model:
[Equation]
where Θ denotes the dynamics parameters, Ψ denotes the emission (observation) parameters, and w t and v t are the state and observation noises respectively.
For simplicity, we restrict ourselves to systems of the form:
[Equation]
If the state space model is completely speciﬁed then recursive Bayesian inference can be applied to obtain an estimate of the latent states using the posterior p ( x 0: T | y 1: T ) (Doucet et al., 2001).
However in many applications, the parametric form of the state space model is unknown.
While there exist methods that perform smoothing to obtain an estimate of x 0: T (Barber, 2006; Fox et al., 2009; Djuric & Bugallo, 2006), we are often interested in not only obtaining an estimate of the continuous latent states but also in learning the dynamics f ( · ; Θ) that govern the dynamics of the system.
In the simplest case, we can take a parametric approach to solving this joint state-parameter estimation problem.
When f ( · ; Θ) and g ( · ; Ψ) are assumed to be linear functions, the posterior distribution over latent states is available in closed-form and the parameters can be learned via expectationmaximization.
On the other hand, we have nonparametric methods that use Gaussian processes and neural networks to learn highly nonlinear dynamics and observations where the joint estimation is untractable and approximations are necessarily imployed (Zhao & Park, 2016; 2018;
Frigola et al., 2014; Sussillo et al., 2016).
Switching linear dynamical systems (SLDS) (Ackerson & Fu, 1970;
Chang & Athans, 1978; Hamilton, 1990; Ghahramani & Hinton, 1996; Murphy, 1998) balance between these two extremes, approximating the dynamics by stochastically transitioning between a small number of linear regimes.
2. S WITCHING L INEAR D YNAMICAL S YSTEMS
SLDS approximate nonlinear dynamics by switching between a discrete set of linear regimes.
An additional discrete latent state z t ∈ { 1 , . . .
, K } determines the linear dynamics at time t ,
[Equation]
where A k , Q k ∈ R d x × d x and b k ∈ R
d x for k = 1 , . .
, K .
Typically, z t is endowed with Markovian dynamics, Pr( z t | z t − 1 = k ) =
π k .
The conditionally linear dynamics allow for fast and efﬁcient learning of the model and can utilize the learning tools developed for linear systems (Haykin, 2001).
While SLDS can estimate the continuous latent states x 0: T , the assumption of Markovian dynamics for the discrete latent states severely limits their generative capacity.
2. R ECURRENT S WITCHING L INEAR D YNAMICAL S YSTEMS
Recurrent switching linear dynamical systems (rSLDS) (Linderman et al., 2017), also known as augmented SLDS (Barber, 2006), are an extension of SLDS where the transition density of the
[Figure]
discrete latent state depends on the previous location in the continuous latent space
[Equation]
where R ∈ R K − 1 × d x and r ∈ R K − 1 represents hyperplanes.
π SB :
R K − 1 → [0 , 1] K maps from the reals to the probability simplex via stick-breaking:
[Equation]
for k = 1 , . . .
, K − 1 and π ( K ) SB =
(cid:81) K − 1 k =1 σ ( − ν k ) where ν k is the k th component of of ν and σ ( ν ) = (1 + e − ν ) − 1 is the logistic function (Fig. 1).
By including this recurrence in the transition density of z t , the rSLDS partitions the latent space into K sections, where each section follows its own linear dynamics.
It is through this combination of locally linear dynamical systems that the rSLDS approximates eq. (3); the partitioning of the space allows for a more interpretable visualization of the underlying dynamics.
Recurrent SLDS can be learned efﬁciently and in a fully Bayesian manner, and experiments empirically show that they are adept in modeling the underlying generative process in many cases.
However, the stick breaking process used to partition the space poses problems for inference due to its dependence on the permutation of the discrete states { 1 , · · · , K } (Linderman et al., 2017).
T REE -S TRUCUTRED R ECURRENT S WITCHING L INEAR D YNAMICAL S YSTEMS
Building upon the rSLDS, we propose the tree-structured recurrent switching linear dynamical system (TrSLDS).
Rather than sequentially partitioning the latent space using stick breaking, we use a treestructured stick breaking procedure (Adams et al., 2010) to partition the space.
Let T denote a tree structure with a ﬁnite set of nodes { (cid:15), 1 , · · · , N } .
Each node n has a parent node denoted by par ( n ) with the exception of the root node, (cid:15) , which has no parent.
For simplicity, we initially restrict our scope to balanced binary trees where every internal node n is the parent of two children, left( n ) and right( n ) .
Let child( n ) = { left( n ) , right( n ) } denote the set of children for internal node n .
Let Z ⊆
T denote the set of leaf nodes, which have no children.
Let depth( n ) denote the depth of a node n in the tree, with depth( (cid:15) )
= 0 .
At time instant t , the discrete latent state z t is chosen by starting at the root node and traversing down the tree until one of the K leaf nodes are reached.
The traversal is done through a sequence of left/right choices by the internal nodes.
Unlike in standard regression trees where the choices are deterministic (Lakshminarayanan, 2016), we model the choices as random variables.
The traversal through the tree can be described as a stick breaking process.
We start at the root node with a unit-length stick π (cid:15) = 1 , which we divide between its two children.
The left child receives a fraction π left( (cid:15) )
=
σ ( ν (cid:15) ) and the right child receives the remainder
π right( (cid:15) )
= 1 − σ ( ν (cid:15) )
such that ν (cid:15) ∈ R speciﬁes the left/right balance.
This process is repeated recursively, subdividing π n into two pieces at each internal node until we reach the leaves of the tree (Fig. 1).
The stick assigned to each node is thus,
[Equation]
We incorporate this into the TrSLDS by allowing ν n to be a function of the continuous latent state
[Equation]
where the parameters R n and r n specify a linear hyperplane in the continuous latent state space.
As the continuous latent state x t − 1 evolves, the left/right choices become more or less probable.
This in turn changes the probability distribution π k ( x t − 1 , Γ , T ) over the K leaf nodes, where Γ = { R n , r n } n ∈T .
In the TrSLDS, these leaf nodes correspond to the discrete latent states of the model, such that for each leaf node k ,
[Equation]
In general, the tree-structured stick-breaking is not restricted to balanced binary trees. We can allow more than two children through an ordered sequential stick-breaking at each level.
In this sense, tree-structured stick-breaking is a strict generalization of stick-breaking.
We also note that similar to rSLDS, the model can be made more ﬂexible by introducing a dependence on the previous discrete latent in eq.
(9) but for the rest of the paper, we stick to eq.
3. A H IERARCHICAL D YNAMICS P RIOR THAT R ESPECTS THE T REE S TRUCTURE
Similar to standard rSLDS, the dynamics are conditionally linear given a leaf node z t .
A priori, it is natural to expect that locally linear dynamics of nearby regions in the latent space are similar.
Thus, in the context of tree-structured stick breaking, we impose that partitions that share a common parent should have similar dynamics.
We explicitly model this by enforcing a hierarchical prior on the dynamics that respects the tree structure.
Let { A n , b n } be the dynamics parameters associated with node n .
Although the locally linear dynamics of a discrete state are speciﬁed by the leaf nodes, we introduce dynamics at the internal nodes as well.
These internal dynamics serve as a link between the leaf node dynamics via a hierarchical prior,
[Equation]
where vec( · ) is the vectorization operator.
The prior on the root node is
[Equation]
We impose the following constraint on the covariance matrix of the prior
[Equation]
where λ ∈ (0 , 1) is a hyper parameter that dictates how "close" a parent and child are to one another.
The prior over the parameters can be written as, where the afﬁne term and the vec( · ) operator are dropped for compactness,
[Equation]
It is through this hierarchical tree-structured prior that TrSLDS obtains a multi-scale view of the system.
Parents are given the task of learning a higher level description of the dynamics over a larger region while children are tasked with learning the nuances of the dynamics.
The use of hierarchical priors also allows for neighboring sections of latent space to share common underlying dynamics inherited from their parent.
TrSLDS can be queried at different levels, where levels deeper in the tree provide more resolution.
TrSLDS shares some features with regression trees (Lakshminarayanan, 2016), even though regression trees are primarily used for standard, static regression problems.
The biggest differences are that our tree-structured model has stochastic choices and the internal nodes contribute to smoothing across partitions through the corresponding hierarchical prior. There are other hierarchical extensions of SLDS that have been proposed in the literature. In Stanculescu et al.
, they propose adding a layer to factorized SLDS where the top-level discrete latent variables determine the conditional distribution of z t , with no dependence on x t − 1 . While the tree-structured stick-breaking used in TrSLDS is also a hierarchy of discrete latent variables, the model proposed in Stanculescu et al. (2014) has no hierarchy of dynamics, preventing it from obtaining a multi-scale view of the dynamics. In Zoeter & Heskes (2003), the authors construct a tree of
SLDSs where an SLDS with K possible discrete states is ﬁrst ﬁt.
An SLDS with M discrete states is then ﬁt to each of the K clusters of points.
This process continues iteratively, building a hierarchical collection of SLDSs that allow for a multi-scale, low-dimensional representation of the observed data.
While similar in spirit to TrSLDS, there are key differences between the two models.
First, it is through the tree-structured prior that TrSLDS obtains a multi-scale view of the dynamics, thus we only need to ﬁt one instantiation of TrSLDS; in contrast, they ﬁt a separate SLDS for each node in the tree, which is computationally expensive.
There is also no explicit probabilistic connection between the dynamics of a parent and child in Zoeter & Heskes (2003).
We also note that TrSLDS aims to learn a multiscale view of the dynamics while Zoeter & Heskes (2003) focuses on smoothing, that is, they aim to learn a multi-scale view of the latent states corresponding to data but not suitable for forecasting.
In the next section we show an alternate view of TrSLDS which we will refer to as the residual model in which internal nodes do contribute to the dynamics.
Nevertheless, this residual model will turn out to be equivalent to the TrSLDS.
3. R ESIDUAL M ODEL
Let { ˜ A n , ˜ b n } be the linear dynamics of node n and let path( n ) =
( (cid:15), . .
. , n ) be the sequence of nodes visited to arrive at node n .
In contrast to TrSLDS, the dynamics for a leaf node are now determined by all the nodes in the tree:
[Equation]
We model the dynamics to be independent a priori, where once again the vec( · ) operator and the afﬁne term aren’t shown for compactness,
[Equation]
where ˜Σ n = ˜ λ depth( n ) ˜Σ (cid:15) and ˜ λ ∈ (0 , 1) .
The residual model offers a different perspective of TrSLDS.
The covariance matrix can be seen as representing how much of the dynamics a node is tasked with learning.
The root node is given the broadest prior because it is present in eq. (16) for all leaf nodes; thus it is given the task of learning the global dynamics.
The children then have to learn to explain the residuals of the root node. Nodes deeper in the tree become more associated with certain regions of the space, so they are tasked with learning more localized dynamics which is represented by the prior being more sharply centered on 0.
The model ultimately learns a multi-scale view of the dynamics where the root node captures a coarse estimate of the system while lower nodes learn a much ﬁner grained picture.
We show that TrSLDS and residual model yield the same joint distribution (See A for the proof).
Theorem 1.
TrSLDS and the residual model are equivalent if the following conditions are true:
[Equation]
∈ leaves( T ) , Σ (cid:15) =
˜Σ (cid:15) and λ = ˜ λ
B AYESIAN I NFERENCE
The linear dynamic matrices Θ , the hyperplanes Γ = { R n , r n } n ∈T \Z , the emission parameters Ψ , the continuous latent states x 0: T and the discrete latent states z 1: T must be inferred from the data.
Under the Bayesian framework, this implies computing the posterior,
[Equation]
We perform fully Bayesian inference via Gibbs sampling (Brooks et al., 2011) to obtain samples from the posterior distribution described in eq. To allow for fast and closed form conditional posteriors, we augment the model with Pólya-gamma auxiliary variables Polson et al. 4. P ÓLYA -G AMMA A UGMENTATION Consider a logistic regression from regressor x n ∈ R d x to categorical distribution z n ∈ { 0 , 1 } ; the likelihood is
[Equation]
If a Gaussian prior is placed on β then the model is non-conjugate and the posterior can’t be obtained in closed form.
To circumvent this problem Polson et al. (2013) introduced a Pólya-Gamma (PG) augmentation scheme. This augmentation scheme is based on the following integral identity
[Equation]
where κ = a − b/ 2 and ω ∼ PG( b, 0) .
Setting ψ = x T β , it is evident that the integrand is a kernel for a Gaussian.
Augmenting the model with PG axillary r.v.s { ω n } Nn =1 , eq.
(19) can be expressed as p ( z 1: N ) = [Equation] Conditioning on ω n , the posterior of β is [Equation]
{+where ψ n = x Tn β and κ n = z n − 
+}
It can be shown that the conditional posterior of ω n is also PG where ω n | β, x n , z n ∼ PG(1 , ψ n ) (Polson et al., 2013). 4. C ONDITIONAL P OSTERIORS The structure of the model allows for closed form conditional posterior distributions that are easy to sample from. For clarity, the conditional posterior distributions for the TrSLDS are given below:
The linear dynamic parameters ( A k , b k ) and state variance Q k of a leaf node k are conjugate with a Matrix Normal Inverse Wishart (MNIW) prior
[Equation]
The linear dynamic parameters of an internal node n are conditionally Gaussian given a Gaussian prior on ( A n , b n )
[Equation]
If we
assume the observation model is linear and with additive white Gaussian noise then
the
emission parameters Ψ = { ( C, d ) , S } are also conjugate with a MNIW prior
[Equation]
d, S ) . We can also handle binomial observations through the use of Pólya-gamma augmentation. In the interest of space, the details are explained in Section B.1 in the Appendix.
[Equation]
where ν n,t = R Tn x t − 1 + r n . The likelihood is of the same form as the left hand side of eq.
(20), thus it is amenable to the PG augmentation.
Let ω n,t be the auxiliary Pólya-gamma random variable introduced at time t for an internal node n .
We can express the posterior over the hyperplane of an internal node n as:
[Equation]
where κ n,t = 12
[ j = left( n )] − 12
[ j = right( n )] , j ∈ child( n ) .
Augmenting the model with Pólya-gamma random variables allows for the posterior to be conditionally Gaussian under a Gaussian prior.
Conditioned on the discrete latent states, the continuous latent states are Gaussian.
However, the presence of the tree-structured recurrence potentials ψ ( x t − 1 , z t ) introduced by eq. (10) destroys the Gaussinity of the conditional.
When the model is augmented with PG random variables ω n,t , the augmented recurrence potential, ψ ( x t − 1 , z t , ω n,t ) , becomes effectively Gaussian, allowing for the use of message passing for efﬁcient sampling.
Linderman et al.
(2017) shows how to perform message-passing using the Pólya-gamma augmented recurrence potentials ψ ( x t , z t , w n,t ) .
In the interest of space, the details are explained in Section B.2 in the Appendix. 6.
The discrete latent variables z 1: T are conditionally independent given x 1: T thus
[Equation]
The conditional posterior of the Pólya-Gamma random variables are also Pólya-Gamma: ω n,t | z t , ( R n , r n ) , x t − 1 ∼ PG(1 , ν n,t ) .
Due to the complexity of the model, good initialization is critical for the Gibbs sampler to converge to a mode in a reasonable number of iterations.
Details of the initialization procedure are contained in Section C in the Appendix.
E XPERIMENTS
We demonstrate the potential of the proposed model by testing it on a number of non-linear dynamical systems.
The ﬁrst, FitzHugh-Nagumo, is a common nonlinear system utilized throughout neuroscience to describe an action potential.
We show that the proposed method can offer different angles of the system.
We also compare our model with other approaches and show that we can achieve state of the art performance.
We then move on to the Lorenz attractor, a chaotic nonlinear dynamical system, and show that the proposed model can once again break down the dynamics and offer an interesting perspective.
Finally, we apply the proposed method on the data from Graf et al.
5. F ITZ H UGH -N AGUMO
The FitzHugh-Nagumo (FHN) model is a 2-dimensional reduction of the Hodgkin-Huxley model which is completely described by the following system of differential equations (Izhikevich, 2007):
[Equation]
We set the parameters to a = 0 .
7 , b = 0 .
8 , τ = 12 . 5 ,
and I ext ∼ N (0 . 7 , 0 . 04) .
We trained our model with 100 trajectories where the starting points were sampled uniformly from [ − 3 , 3] 2 .
Each of the trajectories consisted of 430 time points, where the last 30 time points of the trajectories were
[Figure]
B
C
D
E
F
G
H
I used for testing. The observation model is linear and Gaussian where C = (cid:18) 0 −(cid:19) , d = [0 . 5 , 0 . 5] and S = 0 . I 2 where I n is an identity matrix of dimension n. We set the number of leaf nodes to be 4 and ran Gibbs for 1,000 samples; the last 50 samples were kept and we choose the sample that produced the highest log likelihood to produce Fig.
2 where the vector ﬁelds were produced using the mode of the conditional posteriors of the dynamics. To quantitatively measure the predictive power of TrSLDS, we compute the k -step predictive mean squared error, MSE k , and its normalized version, R 2 k , on a test set where MSE k and R 2 k are deﬁned as
[Equation]
k [Equation] where ¯ y is the average of a trial and ˆ y t + k is the prediction at time t + k which is obtained by (i) using the the samples produced by the sampler to obtain an estimate of ˆ x T given y 1: T , (ii) propagate ˆ x T for k time steps forward to obtain ˆ x t + k and then (iii) obtain ˆ y t + k .
We compare the model to LDS, SLDS and rSLDS for k = 1 , . . .
, 30 over the last 30 time steps for all 100 trajectories (Fig.
2I).
5. L ORENZ A TTRACTOR
Lorenz attractors are chaotic systems whose nonlinear dynamics are deﬁned by,
[Equation]
k-step prediction performance simulated trajectories time leaf level true 2nd level prediction horizon (k-steps) 1.
30  true latent trajectories realization from levelinferred latent trajectories realization from leaf nodes
A
B
C
D E F The parameters were set to σ = 10 , ρ = 28 and β = 8 / 3 .
The data consisted of 50 trajectories, each of length of 230 where the ﬁrst 200 time points are used for training and the last 30 are used for testing.
The observation model was a projection onto 10 dimensional space with Gaussian noise. We set the number of leaf nodes to be 4 and ran Gibbs for 1,000 samples; the last 50 samples were kept and we choose the sample that produced the highest log-likelihood to produce Fig.
The butterﬂy shape of the Lorenz attractor lends itself to being roughly approximated by two 2dimensional ellipsoids; this is exactly what TrSLDS learns in the second level of the tree.
As is evident from Fig. 5B, the two ellipsoids don’t capture the nuances of the dynamics.
Thus, the model partitions each of the ellipsoids to obtain a ﬁner description.
We can see that embedding the system with a hierarchical tree-structured prior allows for the children to build off its parent’s approximations.
5. N EURAL D ATA
To validate the model and inference procedure, we used the neural spike train data recorded from the primary visual cortex of an anesthetized macaque monkey collected by Graf et al.
The dataset is composed of short trials where the monkey viewed periodic temporal pattern of motions of 72 orientations, each repeated 50 times.
Dimensionality reduction of the dataset showed that for each orientation of the drifting grating stimulus, the neural response oscillates over time, but in a stimulus dependent geometry captured in 3-dimensions (Zhao & Park, 2017).
We used 50 trials each from a subset of 4 stimulus orientations grouped in two (140 and 150 degrees vs. 230 anddegrees) where each trial contained 140 neurons.
Out of the 140 neurons, we selected 63 well-tuned neurons. The spike trains were binarized with a 10 ms window for Bernoulli observation model and we truncated the onset and offset neural responses, resulting in 111 time bins per trial.
We ﬁt TrSLDS with K = 4 leaf nodes and 3-dimensional continuous latent space; the sampler was run for 500 samples where the last sample was used to produce the results shown in Fig. To obtain an initial estimate for x 0: T , we smoothed the spike trains using a Gaussian kernel and performed
PPCA on the smoothed spike trains. From Fig. it is evident that TrSLDS has learned a multi-scale view as expected. It is able to correctly distinguish between the two groups of orientations by assigning them to two different subtrees (green-yellow vs. red-orange).
The leaf nodes of each subtree reﬁnes the periodic orbit further. From Fig. we can see that TrSLDS also learns two limit cycles that are separated.
[Figure]
C ONCLUSION
In this paper we propose tree-structured recurrent switching linear dynamical systems (TrSLDS) which is an extension of rSLDS (Linderman et al., 2017).
The system relies on the use of treestructured stick-breaking to partition the space.
The tree-structured stick-breaking paradigm naturally lends itself to imposing a hierarchical prior on the dynamics that respects the tree structure.
This tree-structured prior allows for a multi-scale view of the system where one can query at different levels of the tree to see different scales of the resolution.
We also developed a fully Bayesian sampler, which leverages the Pólya-Gamma augmentation, to learn the parameters of the model and infer latent states.
The two synthetic experiments show that TrSLDS can recover a multi-scale view of the system, where the resolution of the system increase as we delve deeper into the tree.
The analysis on the real neural data veriﬁes that TrSLDS can ﬁnd a multi-scale structure. A P ROOF OF T HEOREM Proof.
Let T be a balanced binary tree with K leaf nodes. To show that the models are equal, it sufﬁces to show the equivalence of the likelihood and the prior between models. For compactness, we drop the afﬁne term and the vec( · ) operator. The likelihood of TrSLDS is
[Equation]
) and the likelihood of the residual model is
[Equation]
27) where ¯ A z t is deﬁned in eq.
Substituting A z t = (cid:80) j ∈ path( z t ) ˜
A j into eq.
(27) equates the likelihoods.
All that is left to do is to show the equality of the priors.
We can express A n = (cid:80) j ∈ path( n ) ˜
A j recursively
[Equation]
Plugging eq.
(28) into ln p ( A n | A par( n ) )
[Equation]
[Equation]
[Equation]
[Equation]
where C is a constant.
Because Σ (cid:15) =
˜Σ (cid:15) and λ = ˜ λ , eq.
(32) is equivalent to the kernel of p ( ˜ A n ) implying that the priors are equal.
Since this is true ∀ n ∈ T , the joint distributions of the two models are the same.
B D ETAILS ON B AYESIAN I NFERENCE B. H ANDLING B ERNOULLI O BSERVATIONS
Suppose the observation of the system at time t follows
[Equation]
where c n ∈ R d x , d n ∈ R .
Equation 33 is of the same form as the left hand side of eq.
(20), thus it is amenable to PG augmentation.
We introduce PG axillary variables η n,t .
Conditioning on η 1: N , eq.
(33) becomes
[Equation]
37) where H t = diag([ η 1 ,t , . . .
, η N,t ]) , κ t = [ κ 1 ,t , . .
, κ N,t ] and κ n,t = y n,t − 1 2 .
The observation is now effectively Gaussian and can be incorporated into the message passing for x 1: T .
The emission parameters are also conjugate with the augmented observation potential given a Matrix
Normal prior.
The conditional posterior on the axillary PG variables η n,t also follows a PG distribution i.e. η n,t | ( c n , d n ) , x t ∼ PG(1 , υ n,t ) .
Note that this augmentation scheme can also work for negative binomial, binomial, and multinomial observations (Polson et al., 2013; Linderman et al., 2015).
B. M ESSAGE P ASSING FOR x 1: T
Assuming that the observations, y 1: T , are linear and Gaussian, the posterior of the continuous latent states, x 0: T , conditioned on all the other variables is proportional to
[Equation]
where ψ ( x t , x t − 1 , z t ) is the potential of the conditionally linear dynamics, ψ ( x t , y t ) is the potential of the observation and ψ ( x t − 1 , z t ) is the recurrence potential.
ψ ( x t − 1 , z t ) is a product of all the internal nodes traversed at time t
[Equation]
If the potentials in eq.
(38) were all linear and Gaussian, then we could efﬁciently sample from the posetrior of x 0: T by passing messsages forward through Kalman Filtering and then sampling backwards; the prescence of the recurrence potentials prevent this because they aren’t Gaussian.
By augmenting the model with the PG r.v.’s, the recurrence potential at internal node n becomes
[Equation]
[Equation] which is effectively Gaussian , allowing for the use of the Kalman ﬁlter for message passing. C I NITIALIZATION We initialized the Gibbs sampler using the following initialization procedure: (i) probabilistic PCA was performed on the data, y 1: T to initialize the emission parameters, { C, d } and the continuous latent states, x 1: T .
(ii) To initialize the dynamics of the nodes , Θ , and the hyperplanes, Γ , we propose greedily ﬁtting the proposed model using MSE as the loss function.
We ﬁrst optimize over the root node
[Equation]
and obtain A ∗ (cid:15) , b ∗ (cid:15)
(Note that A ∗ (cid:15) , b ∗ (cid:15) can obtained in closed form by computing their corresponding
OLS estimates).
Fixing A ∗ (cid:15) and b ∗ (cid:15) , we then optimize over the second level in the tree
[Equation] [Equation]
This procedure would continue until we reach the leaf nodes of the tree.
Θ ∗ and Γ ∗ are then used to initialize the dynamics and the hyperplanes, respectively.
In our simulations, we used stochastic gradient descent with momentum to perform the optimization.
(iii)
The discrete latent states, z 1: T , were initialized by performing hard classiﬁcation using Γ ∗ and the initial estimate of x 0: T .
D D EALING WITH ROTATIONAL INVARIANCE
A well known problem with these types of model is it’s susceptibility to rotational and scaling transformation, thus we can only learn the dynamics up to an afﬁne transformation Erosheva & Curtis (2017).
During Gibbs sampling the parameters will continuously rotate and scale, which can slow down the mixing of the chains.
One possible solution to the issue is if we constrained C to have some special structure which would make the model identiﬁable; this would require sampling from manifolds which is usually inefﬁcient.
Similar to Geweke & Zhou (1996), we use the following procedure to prevent the samples from continuously rotating and scaling:
• Once we obtain a sample from the conditional posterior of the emission parameters { C, D } , we normalize the columns of C .
• RQ decomposition is performed on C to obtain U, O where U ∈ R d y × d x is an upper triangular matrix and O ∈ R d x × d x is an orthogonal matrix.
• We set C
=
U and rotate all the parameters of the model using O .
E S CALABILITY AND C OMPUTATIONAL C OMPLEXITY OF THE I NFERENCE
[Figure]
The rSLDS and the TrSLDS share the same linear time complexity for sampling the discrete and continuous states, and both models learn K-1 hyperplanes to weakly partition the space.
Speciﬁcally, both models incur: an O ( TK ) cost for sampling the discrete states, which increases to O ( TK 2 ) if we allow Markovian dependencies between discrete states; an O ( TD 3 ) cost (D is the continuous state dimension) for sampling the continuous states, just like in a linear dynamical system; and an O ( KD 3 ) cost for sampling the hyperplanes.
The only additional cost of the TrSLDS stems from the hierarchical prior on state dynamics.
Unlike the rSLDS, we impose a tree-structured prior on the dynamics to encourage similar dynamics between nearby nodes in the tree.
Rather than sampling
K dynamics parameters, we need to sample 2K-1.
Since they are all related via a tree-structured
Gaussian graphical model, the cost of an exact sample is O ( KD 3 ) just as in the rSLDS, with the only difference being a constant factor of about 2.
Thus, we obtain a multi-scale view of the underlying system with a negligible effect on the computational complexity.
To see how the number of discrete latent states effects the convergence speed of the Gibbs sampler, we ﬁt 3 TrSLDS, with K = 2 , 4 , 8 respectively, to a Lorenz Attractor described in Sec.
but usedtrajectories to train the model as opposed to 50.
To assess convergence, we plotted the logarithm of the joint density as a function of Gibbs samples.
The results are shown Fig.
F S YNTHETIC NASCAR R (cid:13)
We ran the TrSLDS on the synthetic NASCAR R (cid:13) example from (Linderman et al., 2017), where the underlying model is an rSLDS.
We trained TrSLDS on 10,000 time points and ran Gibbs for 1, samples; the last sample was used to create Fig.
6 where the vector ﬁelds where created from the mode of the conditional posterior of the dynamics.
Even though the partitions were created using sequential stick-breaking, TrSLDS was able to reconstruct the dynamics of the model.
[Figure]
G T REE S YNTHETIC NASCAR R (cid:13)
To check whether the sampler is mixing adequately, we test TrSLDS on a twist on the synthetic
NASCAR R (cid:13) example where the underlying model is a TrSLDS.
We also ran rSLDS on the example to highlight the limitations of seqeuntail stick-breaking.
We trained both rSLDS and TrSLDS on 20, time points and Gibbs was ran for 1,000 samples; the last sample was used to create Fig.
To compare the precditive performance between the models, the R 2 k was computed for rSLDS and TrSLDS.
[Figure]
rSLDSTrSLDS