Exploring Neurological Dynamical Systems: Part 1

In the next two posts, I want to talk briefly about an algorithm called Dynamic Mode Decomposition (DMD). DMD is a spatiotemporal modal decomposition technique that can be used to identify spatial patterns in a signal (modes), along with the time course of these spatial patterns (dynamics). As such, the algorithm assumes that the input data has a both a spatial and a temporal component. We are interested in modeling how the system evolves over time.

If you’d like to find more information about DMD, Peter Schmid1 and Jonathan Tu2 have written excellent expositions on the topic. Likewise, if you’d like to follow along with the code for the following analysis, see my repo. For a more in-depth analysis that applies DMD to brain activity in the resting brain, see a recent publication by my colleagues and I3, along with the code used for our analysis.

The DMD Algorithm

Let’s assume that you’ve taken n measurements from specific points in space for m time points, where for now we assume that m<n. For now, we’ll assume that the sampling frequency, ω, is stable across the entire experiment. We define our entire data matrix as

X=[xn1,m1xn1,m2xn1,m3xn2,m1xn1,m2xn2,m3xn3,m1xn1,m2xn3,m3]Rn×m

We are interested in solving for the matrix, ARn×n, such that

xt+1=Axtt=1,2,m1

Given our full data matrix X, we can define two matrices X and Y such that

X=[|||x1x2xm1|||]Rn×(m1)Y=[|||x2x3xm|||]Rn×(m1)

so that we can write

Y=AX

If n is small, this is relatively easy to compute – however, if n is large, as is the case when modeling temporal dynamics in resting-state MRI, it would be computationally inefficient to compute A directly. To alleviate this, we can make use of the Singular Value Decomposition (SVD) of our predictor matrix X. We define the SVD of X as

X=UΣVT 

as well as the Moore-Penrose psuedo-inverse of X=X as

X=VΣ1UT

such that we can write

YX=YVΣ1UT=AXX=A

Additionally, if we assume that rank(X)=rm, then we can use the truncated SVD such that

URn×rVTRr×m

and

Σ=[σ1000σ2000σr]Rr×r

As it stands now, we still compute an ARn×n matrix. However, because we have a potentially low-rank system, we can apply a Similarity Transformation to A in order to reduce its dimensionality, without changing its spectrum. Using our spatial singular vectors U, we define

A~=UTAU=UT(YVΣ1UT)U=UTYVΣ1

where A~Rr×r. If we consider the above SVD, we see that U is the matrix of left singular vectors, an orthogonal basis that spans C(X), which is an r-dimensional subspace of Rn. Thus, the similarity transform represents a mapping f(A)=UTAU:RnRr. We now have a reduced-dimensional representation of our linear operator, from which we can compute the spatial modes and dynamic behavior of each mode. First, however, because of the notion of variance captured by the singular values of our original predictor matrix, we weight A~ by the singular values as

A^=Σ12A~Σ12

such that our computed spatial modes have been weighted by the amount they contribute to our measured signal. We can now compute the eigendecomposition of A^ as

A^W=WΛ

where the eigenvectors W are the reduced-dimension representations of our spatial modes, and the eigenvalues Λ capture the dynamic behavior of our spatial modes. Because our original data matrix X had spatial dimension n and our eigenvectors have dimension r, we need to up-project our eigenvectors W to compute the final spatial modes, via

Φ=YVΣ12W

From the SVD of our prediction matrix X=UΣVT, the matrix VRm×r is the matrix of right singular vectors, an orthogonal basis spanning the space of XT (i.e. r basis vectors spanning the space of the measured time courses). Thus, we see that H=(VΣ12)W represents a linear combination of the temporal basis vectors (a mapping from RrRm) for each eigenvector wi of W, weighted by the corresponding singular value σi12 (that acts to normalize the spatial mode amplitudes). Finally, we see that Φ=XH computes how much of each temporal basis vector is present in the measured time course at each point in space.

Because we are modeling a dynamical system, we can compute the continuous time dynamics of our system using our spatial modes and eigenvalues as

x(t)i=1rbiexp((γi+2iπfi)t)ϕi

where γi is a growth-decay constant and fi is the frequency of oscillation of the spatial mode ϕi. We can compute these two constants as

γi=real(ln(λi))Δtfi=imag(ln(λi))2πΔt

So, we can see that DMD linearizes our measured time series, by fitting what can be analogized to a “global” regression. That is, instead of computing how a single time point predicts the next time point, which could readily be solved using the simple Normal equations, DMD computes how a matrix of time points predicts another matrix of time points that is shifted one unit of time into the future. To this extent, DMD minimizes the Frobenius norm of

minAYAXF2

However, rather than explicitly computing the matrix A, DMD computes the eigenvectors and eigenvalues of A, by utilizing the Singular Value Decomposition, along with a Similarity Transformation, in order to generate a reduced-dimensional representation of A.

This spectral decomposition of our linear operator is of particular importance, because it sheds light on the fact the DMD models the temporal dynamics of our system using a Fourier basis. Each spatial mode is represented by a particular Fourier frequency along and growth-decay constant that determines the future behavior of our spatial mode. Additionally, the Fourier basis also determines what sorts of time series can be modeled using DMD – time series that are expected to have sinusoidal behavior will be more reliably modeled using DMD, whereas signals that show abrupt spike patterns might be more difficult to model.


  1. P.J. Schmid. Dynamic mode decomposition of numerical and experimental data. Journal of Fluid Mechanics 656.1. 2010. ↩︎

  2. Tu et al. On Dynamic Mode Decomposition: Theory And Applications ↩︎

  3. Kunert-Graf et al. Extracting Reproducible Time-Resolved Resting State Networks Using Dynamic Mode Decomposition. Front. Comput. Neurosci. 2019. ↩︎

Data Scientist + Engineer