Inference and Learning
The joint distribution of p-dLDS is given by,

 p(\bm{x},\bm{y},\bm{c},\bm{\gamma}|\theta)=p(\bm{x}_{1})\left[\prod_{t=1}^{T}p(y_{t}|x_{t})\right]\left[\prod_{t=1}^{T-1}p(\bm{x}_{t+1}|\bm{x}_{t},\bm{c}_{t})\left[\prod_{k=1}^{K}p(c_{t+1,k}|c_{t,k},\gamma_{t+1,k})p(\gamma_{t+1,k}|c_{t,k})\right]\right], (6)

where we denote \bm{x}=\bm{x}_{1:T} for brevity.
Exact posterior inference is intractable due to the nonconjugacy introduced by incorporating time-informed sparsity-inducing structure into the graphical model. As a result, we devise a variational expectation maximization (vEM) procedure where the approximate posterior is factorized as

\begin{split}p(\bm{x},\bm{c},\bm{\gamma}|\bm{y},\theta)\approx q(\bm{x})q(\bm{c},\bm{\gamma}).\end{split}

Here, the parameters are given by \theta\in\{\bm{f}_{1:K},\bm{D},\bm{d},\bm{\Sigma}_{y},\bm{\Sigma}_{x},\bm{\Sigma}_{c}\} .
Our approach contrasts with BPDN-DF, which estimates latent variables through separate \ell_{1} problems at each point in time. Instead, we preserve the time-dependence structure within each class of latent variables and leverage efficient inference algorithms that marginalize over uncertainty with respect to time.
In general, we seek to maximize the variational lower bound,

\mathcal{L}_{q}(\theta) =\mathbb{E}_{q(\bm{x})q(\bm{c},\bm{\gamma})}[\log p(\bm{y},\bm{x},\bm{c},\bm{\gamma}|\theta)-\log q(\bm{x})q(\bm{c},\bm{\gamma})],

with coordinate ascent updates on the latent state posterior, the dynamics coefficients posterior, and the model parameters.

Updating Latent State Posterior. The optimal coordinate ascent variational update is given by,

 q(\bm{x}) \propto\exp\left(\mathbb{E}_{q(\bm{c},\bm{\gamma})}\left[\log p(\bm{x},\bm{y},\bm{c},\bm{\gamma}|\theta)\right]\right)

Given our decomposition equation ( 4 ), the optimal coordinate ascent approximate posterior becomes

 q(\bm{x})=\mathcal{N}(\bm{x}_{1};\bm{\mu}_{1},\Sigma_{1})\left[\prod_{t=2}^{T}\mathcal{N}(\bm{y}_{t};\bm{D}\bm{x}_{t},\bm{\Sigma}_{y})\right]\left[\prod_{t=1}^{T}\mathcal{N}(\bm{x}_{t};\bm{l}_{t-1}+\bm{F}_{t-1}\bm{l}_{t-1}+\bm{b}_{t},\bm{\Sigma}_{x})\right], (8)

where, \bm{\mu}_{1} and \bm{\Sigma}_{1} are the mean and covariance of the initial state.

Let \bm{l},\bm{b}\in\mathbb{R}^{N} be independent random variables such that \bm{l}\sim p(\bm{l}) and \bm{b}\sim p(\bm{b}) . Their sum \bm{x}=\bm{l}+\bm{b} is distributed according to \mathcal{N}(\bm{\mu}_{l}+\bm{\mu}_{b},\bm{\Sigma}_{l}+\bm{\Sigma}_{b}) when 1) p(\bm{b})=\mathcal{N}(\bm{\mu}_{b},\bm{\Sigma}_{b}) and p(\bm{l})=\mathcal{N}(\bm{\mu}_{l},\bm{\Sigma}_{l}) and when 2) p(\bm{b})=\delta(\bm{b}-\bm{\mu}_{b}) and p(\bm{l})=\mathcal{N}(\bm{\mu}_{l},\bm{\Sigma}_{l}+\bm{\Sigma}_{b}) .

We leverage Lemma 2 to reparameterize the state space trajectories into a deterministic and a stochastic component. The deterministic component captures the slow-moving offset density q(\bm{b})=\prod_{t=1}^{T}\delta(\bm{b}_{t}-\widehat{\bm{b}}_{t}) , where \widehat{\bm{b}}_{t} is estimated using a moving average of window size S which can be efficiently parallelized.
The remaining dynamics are captured in the stochastic component. We define the family of variational distributions to be the class of linear Gaussian state space models, such that q(\bm{l})=\mathcal{N}(\bm{l}_{1},\bm{\Sigma}_{1})\prod_{t=2}^{T}\mathcal{N}(\bm{l}_{t-1}+\bm{F}_{t-1}\bm{l}_{t-1},\bm{\Sigma}_{x}) .
Conditioned on estimates \bm{\widehat{b}} and samples of \bm{c} , the optimal coordinate ascent variational update for q(\bm{l}) is efficiently computed using
the Kalman Smoother [ 31 ] . We provide a full derivation of the update rule and Lemma 2 in Appendix B.2 .

Updating Dynamics Coefficient Posterior. Sparse probabilistic representations introduce non-Gaussian factors which prevent closed-form message passing inference. Specifically, nonconjugacy arises from the inverse gamma term p(\gamma_{t+1,k}|c_{t,k}) since it is parameterized by c_{t,k}^{2}\sim\chi^{2} . Moreover, the posterior distribution over the coefficients is highly multi-modal as a result of the implicit t-distribution in our hierarchical model. To update the coefficient posteriors, we propose a three-step procedure, where we factorize q(\bm{c},\bm{\gamma})=q(\bm{c})q(\bm{\gamma}) .
First, we obtain an initial estimate of the variational distributions using SBL-DF.
Second, we update q(c_{t,k})=\mathcal{N}(c^{*}_{t,k},\widehat{\gamma}_{t,k}) using stochastic gradient descent (SGD) over

\bm{c}^{*}=\operatorname*{arg\,max}_{\bm{c}}\sum_{t=1}^{T-1}\log p(\bm{\widehat{l}}_{t+1}|\bm{\widehat{l}}_{t},\bm{c}_{t})+\log p(\bm{c}_{t+1}|\bm{c}_{t},\bm{\widehat{\gamma}}_{t+1})+\log p(\bm{\widehat{\gamma}}_{t+1}|\bm{c}_{t}), (9)

where we have estimated the expectation in the optimal coordinate ascent update rule using samples from \bm{\widehat{\gamma}}\sim q(\bm{\gamma}) and \bm{\widehat{l}}\sim q(\bm{l}) . To retain coefficient sparsity, we only update coefficients within the active support set. In our work, this is defined as coefficients that have an initial estimate of |c_{t,k}|>\eta where \eta=10^{-4} . Finally, we update q(\bm{\gamma}) based on closed form conjugacy rules.

Update Parameters. Given our updated posteriors of the latent variables, we proceed to update the model parameters based on the ELBO,

\theta^{*} =\operatorname*{arg\,max}_{\theta}\mathbb{E}_{q(\bm{x})q(\bm{c})q(\bm{\gamma})}\left[p(\bm{y},\bm{c},\bm{x},\bm{\gamma}|\theta)-\log q(\bm{x})q(\bm{c})q(\bm{\gamma})\right]\approx\operatorname*{arg\,max}_{\theta}p(\bm{y},\bm{\widehat{c}},\bm{\widehat{x}},\bm{\widehat{\gamma}}|\theta), (10)

where we estimate the expectation with samples
from our variational distributions
and drop terms not dependent on \theta . We use SGD to update all model parameters,
which is possible when we assume that the covariance matrices have diagonal structure.