Reconstructing Odes From Time Series Data
Reconstructing Odes From Time Series Data
functions fi can be obtained by taking numerical deriva- The solution to Eq. 5 can be obtained by minimizing
tives of the solutions with respect to time: the squared differences between the measurements of the
signal ~y and the reconstructed signal Φ~c subject to the
xi (t0 + ∆t) − xi (t0 ) constraint that the solution ĉ is sparse [43]:
fi (t0 ) ≈ . (2)
∆t
1
We will reconstruct the functions from a set of m mea- ĉ = min k~y − Φ~ck22 + λk~ck1 , (6)
c 2
~
surements, yk = fi (~xk ) at positions {~xk } with k =
1, . . . , m. To do this, we will express the functions fi as where k.kp denotes the Lp vector norm and λ is a Lan-
linear superpositions of arbitrary, non-linear basis func- grange multiplier that penalizes a large L1 norm of ĉ.
tions φj (~x): The Lp norm of an n-dimensional vector ~x is defined as
n " N
#1/p
X X
fi (~x) = cj φj (~x), (3) k~xkp = p
|xi | (7)
j=1 i=1
where cj are the expansion coefficients and n is the num- for p > 1, where N is the number of components of the
ber of basis functions used in the expansion. The mea- vector ~x.
surements yk = fi (~xk ) impose the following constraints We now demonstrate how the sparse signal reconstruc-
on the expansion coefficients: tion method compares to a standard least squares fit.
We first construct a sparse signal (with sparsity s) in a
n
X given basis. We then sample the signal randomly and at-
fi (~xk ) = yk = cj φj (~xk ) (4)
tempt to recover the signal using the regularized L1 and
j=1
least-squares reconstruction methods. For this example,
for each k = 1, . . . , m. The constraints we choose the discrete cosine basis. For a signal size of
Pnin Eq. 4 can also 100 values, we have a complete and orthonormal basis of
be expressed as a matrix equation: j=1 Φij cj = yi for
i = 1, . . . , m or 100 functions φn (i) (n = 0, . . . , 99) each with 100 values
(i = 0, . . . , 99):
φ1 (~x1 ) . . . φn (~x1 ) c1 y1
φ1 (~x2 ) . . . φn (~x2 ) c2 y2 π 1
φn (i) = F (n) cos i+ n , (8)
.. .. = .. ,
(5) 100 2
. . .
φ1 (~xm ) . . . φn (~xm ) cn ym where F (n) is a normalization factor
where Φij = φj (~xi ). In most cases of ODE reconstruc- √1 for n = 0
100
tion, the number of rows of Φ, i.e. the number of mea- F (n) = q 2 (9)
100 for n = 1, . . . , 99.
surements m, is smaller than the number of columns of
Φ, which is equal to the number of basis functions n used
Note that an orthonormal basis is not a prerequisite for
to represent the signals fi . Thus, in general, the system
the sparse reconstruction method.
of equations (Eq. 5) is underdetermined with n > m.
Similar to Eq. 3, we can express the signal as a super-
Sparse coding is ideally suited for solving underdeter-
position of basis functions,
mined systems because it seeks to identify the minimum
number of basis functions to represent the signals fi . If 99
X
we identify a basis that can represent a given set of sig- g(i) = cj φj (i) . (10)
nals fi sparsely, an L1 regularized minimization scheme j=0
will be able to find the sparsest representation of the sig-
nals [42]. The signal ~g of sparsity s is generated by randomly select-
ing s of the coefficients cj and assigning them a random
amplitude in the range [−1, 1]. We then evaluate g(i) at
B. Sparse Coding m randomly chosen positions i and attempt to recover
g(i) from the measurements. If m < 100, recovering the
original signal involves solving an underdetermined sys-
In general, the least squares (L2 ) solution of Eq. 5
tem of linear equations.
possesses many nonzero coefficients ci , whereas the min-
Recovering the full signal ~g from a given number of
imal L1 solution of Eq. 5 is sparse and possesses only
measurements proceeds as follows. After carrying out
a few non-zero coefficients. In the case of underdeter-
the m measurements, we can rewrite Eq. 4 as
mined systems with many available basis functions, it has
been shown that a sparse solution obtained via L1 reg- ~y = P~g , (11)
ularization more accurately represents the solution com-
pared to those that are superpositions of many basis func- where ~y is the vector of the measurements of ~g and P is
tions [42]. the projection matrix with m × n entries that are either
4
~grec = Φ ĉ . (13)
(a) (b)
(a)
FIG. 3: (a) 128 × 128 pixel image of a cat. (b) Using the
(b) sparse learning method, we obtained 100 8 × 8 pixel basis
functions for the image in (a).
(a) (b)
(c)
x2
predation, the predator population x2 would decrease at
death rate γ. With the presence of prey x1 , the preda- 1.0
tor population grows proportional to the product of the
two population sizes x1 and x2 with a proportionality 0.5
constant δ (with units of inverse time). 0.0
For the Lotka-Volterra system of ODEs, there are two 0.0 0.5 1.0 1.5 2.0 2.5 3.0
fixed points, one at x1 = 0 and x2 = 0 and one at x1 =
γ/δ and x2 = α/β. The stability of the fixed points
x1
is determined by the eigenvalues of the Jacobian matrix
evaluated at the fixed points. The Jacobian of the Lotka- FIG. 7: Solutions of the two-dimensional Lotka-Volterra ODE
Volterra system is given by model (Eq. 18) with α = 0.4, β = 0.4, γ = 0.1, and δ =
0.2 plotted parametrically (x2 (t) versus x1 (t)) for 15 random
α − βx2 −βx1 initial conditions in the domain 0 ≤ x1 ≤ 0.5 and 0 ≤ x2 ≤ 1.
JLV = . (19)
δx2 −γ + δx1 This model has an unstable fixed point at x1 = 0 and x2 = 0
and an oscillatory fixed point at x1 = 0.5 and x2 = 1.
The eigenvalues of the Jacobian JLV at the origin are
J1 = α, J2 = −γ. Since the model is restricted to posi-
tive parameters, the fixed point at the origin is a saddle and chaotic dynamics. The three dimensionless variables
point. The interpretation is that for small populations x1 , x2 , and x3 describe the intensity of the convective
of predator and prey, the predator population decreases flow, temperature difference between the ascending and
exponentially due to the lack of a food source. While un- descending fluid, and spatial dependence of the temper-
harmed by the predator, the prey population can grow ature profile, respectively.
exponentially, which drives the system away from the The system possesses three fixed points at
zero population state, x1 = 0 and x2 = 0. (x1 , x2 , x3 ) = (0, 0, 0), (−β 1/2 (ρ − 1)1/2 , −β 1/2 (ρ −
The eigenvalues of the Jacobian JLV at the second 1)1/2 , ρ − 1), and (β 1/2 (ρ − 1)1/2 , β 1/2 (ρ − 1)1/2 , ρ − 1).
fixed point x1 = γ/δ and x2 = α/β are purely imagi- The Jacobian of the system is given by
√ √
nary complex conjugates, J1 = −i αγ and J2 = i αγ,
where i2 = −1. The purely imaginary fixed point causes
−σ σ 0
trajectories to revolve around it and form closed orbits. JL = ρ − x3 −1 −x1 . (21)
The interpretation of this fixed point is that the predators x2 x1 −β
decrease the number of prey, then the predators begin to
die due to a lack of food, which in turn allows the prey When we evaluate the Jacobian (Eq. 21) at the fixed
population to grow. The growing prey population pro- points, we find that each of the three eigenvalues pos-
vides an abundant food supply for the predator, which sesses two stable and one unstable eigendirection in the
allows the predator to grow faster than the food supply parameter regime σ = 10, ρ = 28 and β = 8/3. With
can sustain. The prey population then decreases and the these parameters, the Lorenz system displays chaotic dy-
cycle repeats. For the results below, we chose the pa- namics with Lyapunov exponents `1 = 0.91, `2 = 0.0,
rameters α = 0.4, β = 0.4, γ = 0.1, and δ = 0.2 for and `3 = −14.57. In Fig. 8, we show the time evolution
the Lotka-Volterra system, which locates the oscillatory of two initial conditions in x1 -x2 -x3 configuration space
fixed point at x1 = 0.5 and x2 = 1.0 (Fig. 7). for this parameter regime.
c. 3D model In 3D, we focused on the Lorenz system
of ODEs [1], which describes fluid motion in a container
that is heated from below and cooled from above: III. RESULTS
dx1
= f1 (x1 , x2 , x3 ) = σ(x2 − x1 ) In this section, we present the results of our methodol-
dt
dx2 ogy for ODE reconstruction of data generated from the
= f2 (x1 , x2 , x3 ) = x1 (ρ − x3 ) − x2 (20) three systems of ODEs described in Sec. II D. For each
dt
system, we measure the accuracy of the reconstruction as
dx3
= f3 (x1 , x2 , x3 ) = x1 x2 − βx3 , a function of the size of the sections used to decompose
dt the signal for basis learning, the sampling time interval
where σ, ρ, β are positive, dimensionless parameters that between time series measurements, and the number of
represent properties of the fluid. In different parame- trajectories. For each model, we make sure that the to-
ter regimes, the fluid can display quiescent, convective, tal integration time is sufficiently large that the system
8
100
10-1
10-2
d
10-3
10-4 0 20 40 60 80 100 120 140
p
100 (a)
10-1
10-2
d
10-3
10-4
10-5
10-1 100 101 (b)
∆t
100
10-1
10-2 FIG. 12: Reconstructions (solid blue lines) of f1 (i1 ) for the 1D
d
100
(a)
10-1
10-2
d
10-3
10-4 -2
10 10-1 100 101
(b) ∆t
dent runs, the error reaches a minimum (d ≈ 10−5 ) near Using the reconstructions of f1 and f2 , we solved for
p2min ≈ 100. the trajectories x1 (t) and x2 (t) (for times comparable to
In Fig. 14, we show the reconstruction error d as a tend ) and compared them to the trajectories from the
function of the sampling time interval ∆t for several val- original Lotka-Volterra model (Eq. 18). In Fig. 17 (a)
ues of Nt from 5 to 500 trajectories, for a total time tend and (b), we show parametric plots (x2 (t) versus x1 (t))
that allows several revolutions around the closed orbits, for the inaccurate (Fig. 15) and accurate (Fig. 16) recon-
and for patch size p2min . As in 1D, we find that increas- structions of f1 and f2 , respectively. We solved both the
ing Nt reduces the reconstruction error. For Nt = 5, inaccurate and accurate models with the same four sets
d ∼ 10−1 , while d < 10−3 for Nt = 500. d also decreases of initial conditions. For the inaccurate reconstruction,
with decreasing ∆t, although d reaches a plateau in the most of the trajectories from the reconstructed ODE sys-
small ∆t limit, which depends on the number of trajec- tem do not match the original trajectories. In fact, some
tories included in the reconstruction. of the trajectories spiral outward and do not form closed
In Figs. 15 and 16, we show examples of inaccurate orbits. In contrast, for the accurate reconstruction, the
(d ∼ 10−2 ) and accurate (d ∼ 10−5 ) reconstructions of reconstructed trajectories are very close to those of the
f1 (i1 , i2 ) and f2 (i1 , i2 ). The indexes i1,2 = 0, . . . , 127 original model and all possess closed orbits.
11
FIG. 15: Example of inaccurate reconstructions of f1 (i1 , i2 ) FIG. 16: Example of accurate reconstructions of f1 (i1 , i2 ) and
and f2 (i1 , i2 ) (with errors d = 0.04 and 0.03, respectively) f2 (i1 , i2 ) (with errors d = 4 × 10−5 and 5 × 10−5 , respectively)
for the 2D Lotka-Volterra system of ODEs (18). The indexes for the 2D Lotka-Volterra system of ODEs (18). The indexes
i1,2 = 0, . . . , 127 indicate uniformly spaced x1 and x2 values i1,2 = 0, . . . , 128 indicate uniformly spaced x1 and x2 values
in the interval 0 ≤ x1,2 ≤ 2. Panels (a) and (d) give the in the interval 0 ≤ x1,2 ≤ 2. Panels (a) and (d) give the
exact functions f1 (i1 , i2 ) and f2 (i1 , i2 ), panels (b) and (e) exact functions f1 (i1 , i2 ) and f2 (i1 , i2 ), panels (b) and (e) give
give the reconstructions, and panels (c) and (f) indicate the the reconstructions, and panels (c) and (f) indicate the i1 -i2
i1 -i2 values that were sampled (2% of the 128 × 128 grid). values that were sampled (68% of the 128 × 128 grid). The
The white regions in panel (c) and (f) indicate missing data. white regions in panel (c) and (f) indicate missing data. The
In the top row, the color scale varies from −0.8 to 0.8 (from color scales are the same as in Fig. 15. This reconstruction
dark blue to red). In the bottom row, the color scale varies was obtained using Nt = 100 trajectories, a sampling interval
from −0.2 to 0.6 (from dark blue to red). This reconstruction of ∆t = 0.01, and a basis patch area p2 = 625.
was obtained using Nt = 30 trajectories, a sampling interval
∆t = 5, and a basis patch area p2 = 625.
(a) (b)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
FIG. 19: Reconstruction of the Lorenz system of ODEs in 3D (Eq. 20) using the sampling time interval ∆t = 10−2 and
Nt = 104 trajectories. Panels (a)-(c) indicate f1 (i1 ), (d)-(f) indicate f2 (i2 ), and (g)-(i) indicate f3 (i3 ), where the indexes i1 ,
i2 , and i3 represent uniformly spaced x1 , x2 , and x3 values on the intervals −21 ≤ x1 ≤ 21, −29 ≤ x2 ≤ 29, and −2 ≤ x3 ≤ 50.
Each of the 32 panels along x3 represents a 32 × 32 discretization of the x1 -x2 domain. The first rows of each grouping of
three (i.e. panels (a), (d), and (g)) give the original functions f1 , f2 , and f3 . The second rows of each grouping of three
(i.e. panels (b), (e), and (h)) give the reconstructed versions of f1 , f2 , and f3 . The third rows of of grouping of three (i.e.
panels (c), (f), and (i)) show the points in the x1 , x2 , and x3 domain that were used for the reconstruction. The white regions
indicate missing data. The color scales range from dark blue to red corresponding to the ranges of −500 ≤ f1 (i1 , i2 , i3 ) ≤ 500,
−659 ≤ f2 (i1 , i2 , i3 ) ≤ 659, and −742 ≤ f3 (i1 , i2 , i3 ) ≤ 614 for the groups of panels (a)-(c), (d)-(f), and (g)-(i), respectively.
[1] E. N. Lorenz, “Deterministic nonperiodic flow,” Journal [2] C. O. Weiss and J. Brock, “Evidence for Lorenz-type
of the Atmospheric Sciences 20 (1963) 130.
14
chaos in a laser,” Physical Review Letters 57 (1986) 2804. [22] B. A. Olshausen and D. J. Field, “Sparse coding with an
[3] K. M. Cuomo, A. V. Oppenheim, and S. H. Strogatz, overcomplete basis set: A strategy employed by V1?,”
“Synchronization of Lorenz-based chaotic circuits with Vision Research 37 (1997) 3311.
applications to communications,” IEEE Transactions on [23] M. Aharon, M. Elad, and A. Bruckstein, “K-SVD: An
Circuits and Systems II: Analog and Digital Signal Pro- Algorithm for designing overcomplete dictionaries for
cessing 40 (1993) 626. sparse representation,” IEEE Transactions on Signal
[4] H. Aref, “The development of chaotic advection,” Physics Processing 54 (2006) 4311.
of Fluids 14 (2002) 1315. [24] M. Aharon and M. Elad, “Sparse and redundant
[5] M. E. Csete and J. C. Doyle, “Reverse engineering of modeling of image content using an image-signature-
biological complexity,” Science 295 (2002) 1664. dictionary,” SIAM Journal on Imaging Sciences 1 (2008)
[6] A. F. Villaverde and J. R. Banga, “Reverse engineering 228.
and identification in systems biology: Strategies, per- [25] E. C. Smith and M. S. Lewicki, “Efficient auditory cod-
spectives and challenges,” Journal of the Royal Society ing,” Nature 439 (2006) 978.
Interface 11 (2014) 2013.0505. [26] R. Raina, A. Battle, H. Lee, B. Packer, and A. Y. Ng,
[7] A. S. Perelson and P. W. Nelson, “Mathematical analysis “Self-taught learning: Transfer learning from unlabeled
of HIV-1 dynamics in vivo,” SIAM Rev. 41 (1999) 3. data,” Proceedings of the 24th International Conference
[8] D. S. Callaway and A. S. Perelson, “HIV-1 infection and on Machine Learning (ACM) (2007) 759.
low steady state viral loads,” B. Math. Biol. 64 (2002) [27] J. Mairal, J. Ponce, G. Sapiro, A. Zisserman, and F.
29. R. Bach, “Supervised dictionary learning,” Advances in
[9] P. W. Nelson and A. S. Perelson, “Mathematical analysis Neural Information Processing Systems 21 (2009) 1033.
of delay differential equation models of HIV-1 infection,” [28] E. J. Candès, J. Romberg, and T. Tao, “Robust uncer-
Math Biosci. 179 (2002) 73. tainty principles: Exact signal reconstruction from highly
[10] H. Dahari, E. Shudo, R. M. Ribeiro, and A. S. Perelson, incomplete frequency information,” IEEE Transactions
“Modeling complex decay profiles of hepatitis B virus on Information Theory 52 (2006) 489.
during antiviral therapy,” Hepatology 49 (2009) 32. [29] D. L. Donoho, M. Elad, and V. N. Temlyakov, “Stable
[11] S. A. Gourley, Y. Kuang, and J. D. Nagy, “Dynamics of recovery of sparse overcomplete representations in the
a delay differential equation model of hepatitis B virus presence of noise,” IEEE Transactions on Information
infection,” Journal of Biological Dynamics 2 (2008) 140. Theory 52 (2006) 6.
[12] B. Hancioglu, D. Swigon, and G. Clermont, “A dynami- [30] E. J. Candès “Compressive sampling,” Proceedings of the
cal model of human immune response to influenza A virus International Congress of Mathematicians 3 (2006) 1433.
infection,” Journal of Theoretical Biology 246 (2007) 70. [31] D. L. Donoho, “Compressed sensing,” IEEE Transac-
[13] A. S. Perelson, “Modeling viral and immune system dy- tions on Information Theory 52 (2006) 1289.
namics,” Nat. Rev. Immunol. 2 (2002) 28. [32] E. J. Candès and J. Romberg, “Quantitative robust
[14] A. Reynolds, J. Rubin, G. Clermont, J. Day, Y. uncertainty principles and optimally sparse decompo-
Vodovotz, and G. B. Ermentrout, “A reduced mathe- sitions,” Foundations of Computational Mathematics 6
matical model of the acute inflammatory response: I. (2006) 227.
Derivation of model and analysis of anti-inflammation.” [33] E. J. Candès, J. Romberg, and T. Tao. “Stable signal
Journal of Theoretical Biology 242 (2006) 220. recovery from incomplete and inaccurate measurements,”
[15] J. Day, J. Rubin, Y. Vodovotz, C. C. Chow, A. Reynolds, Communications on Pure and Applied Mathematics 59
and G. Clermont, “A reduced mathematical model of the (2006) 1207.
acute inflammatory response II. Capturing scenarios of [34] R. G. Baraniuk, “Compressive sensing,” IEEE Signal
repeated endotoxin administration.” Journal of Theoret- Processing Magazine 24 (2007) 118.
ical Biology 242 (2006) 237. [35] E. J. Candès and M. B. Wakin, “An introduction to com-
[16] R. Arditi and L. R. Ginzburg, “Coupling in predator- pressive sampling,” IEEE Signal Processing Magazine 25
prey dynamics: Ratio-dependence,” Journal of Theoret- (2008) 21.
ical Biology 139 (1989) 311. [36] D. L. Donoho and J. Tanner, “Precise undersampling the-
[17] E. Baake, M. Baake, H. G. Bock, and K. M. Briggs, orems,” Proceedings of the IEEE 98 (2010) 913.
“Fitting ordinary differential equations to chaotic data,” [37] M. Lustig, D. L. Donoho, and J. M. Pauly, “Sparse MRI:
Physical Review A 45 (1992) 5524. The application of compressed sensing for rapid MR
[18] S. Marino and E. O. Voit, “An automated procedure imaging,” Magnetic Resonance in Medicine 58 (2007)
for the extraction of metabolic network information from 1182.
time series data,” Journal of Bioinformatics and Com- [38] M. Lustig, D.L. Donoho, J.M. Santos, and J.M. Pauly,
putational Biology 4 (2006) 665. “Compressed sensing MRI,” IEEE Signal Processing
[19] J. Bongard and H. Lipson, “Automated reverse engineer- Magazine 25 (2008) 72.
ing of nonlinear dynamical systems,” Proc. Nat. Acad. [39] J. P. Haldar, D. Hernando, and Z.-P. Liang,
Sci. 104 (2007) 9943. “Compressed-sensing MRI with random encoding,”
[20] M. D. Schmidt and H. Lipson, “Data-mining dynamical IEEE Transactions on Medical Imaging 30 (2011) 893.
systems: Automated symbolic system identification for [40] M. Duarte, M. Davenport, D. Takhar, J. Laska, T. Sun,
exploratory analysis,” (ASME 2008 9th Biennial Confer- K. Kelly, and R. G. Baraniuk, “Single-pixel imaging via
ence on Engineering Systems Design and Analysis. Amer- compressive sampling, IEEE Signal Processing Mag. 25
ican Society of Mechanical Engineers, 2008). (2008) 83.
[21] M. D. Schmidt and H. Lipson, “Distilling free-form nat- [41] J. Yang, J. Wright, T. S. Huang, and Y. Ma, “Image
ural laws from experimental data,” Science 324 (2009) super-resolution via sparse representation,” IEEE Trans-
81. actions on Image Processing 19 (2010) 2861.
15