An MCMC Method for Uncertainty Set Generation
via Operator-Theoretic Metrics
Abstract
Model uncertainty sets are required in many robust optimization problems, such as robust control and prediction with uncertainty, but there is no definite methodology to generate uncertainty sets for nonlinear dynamical systems. In this paper, we propose a method for model uncertainty set generation via Markov chain Monte Carlo. The proposed method samples from distributions over dynamical systems via metrics over transfer operators and is applicable to general nonlinear systems. We adapt Hamiltonian Monte Carlo for sampling high-dimensional transfer operators in a computationally efficient manner. We present numerical examples to validate the proposed method for uncertainty set generation.
I INTRODUCTION
Generating model uncertainty sets of dynamical systems is a universal problem in situations such as robust control, prediction with uncertainty, and scenario optimization. For example, in a min-max model predictive control (MPC) problem, one would like to solve
where is some loss function, denotes control signals, is an initial state, and is a dynamics model. Here, is a model uncertainty set with which the worst-case performance is to be optimized and thus is key to good performance of the robust controller. However, the way to configure a good is not trivial in general.
A possible strategy for model uncertainty set generation is via Bayesian inference, with which we can create an uncertainty set from an inferred posterior. One of the common difficulties in Bayesian inference is that we need to prepare appropriate priors and observation models, which is sometimes challenging when the target dynamics are nonlinear. Moreover, the computational procedures of Bayesian inference may depend on the specific parametrization of dynamics models.
In this paper, we describe an approach toward uncertainty quantification that is parametrization-agnostic, using the transfer operator description of dynamical systems. While commonly used in mathematical physics, the operator-theoretic view of dynamical systems has attracted attention for use in model order reduction, estimation, and control [1]. Considering linear operators (called transfer operators) over function spaces that represent the transition of observable or density functions, we can analyze, identify, and control nonlinear dynamical systems using linear techniques [2, 3, 4, 5, 6, 7, 8, 9].
Model uncertainty quantification within the transfer operator view, however, is a relatively new research area, and developing suitable methods of transfer operator generation for robust optimization and control is the aim of our work. To this end, we develop a method for sampling transfer operators using a metric [10] between nonlinear dynamical systems. The proposed method is based on a Hamiltonian Monte Carlo in the space defined by the metric about a nominal model. Due to the transfer operator representation, our method requires only computing perturbations of linear operators (which are ultimately approximated as matrices) to generate the uncertainty set, and thus does not require error propagation through complex parametrizations. Using both linear and nonlinear examples, we show how the sampling method preserves qualitative dynamical properties while efficiently searching dynamics space. We finally provide heuristics for sampling transfer operators with constraints.
II RELATED WORK
Uncertainty is inevitable as data are always finite and may include observation noise, but the intersection of uncertainty and the operator-theoretic view on dynamical systems has not yet been explored well. Takeishi et al. [11] discussed a probabilistic interpretation of a technique called dynamic mode decomposition (DMD), which is a widely used algorithm for computing transfer operators, but they only considered the uncertainty of spectral components of the operators. Morton et al. [12] considered the uncertainty of linear transition operators via the uncertainty of observable function values for a model based on neural networks.
In terms of parametric models, uncertainty and inference of parameters in nonlinear differential equations is a well-explored problem [13], with recent advances for accelerating Bayesian inference [14, 15]. These methods are useful in certain contexts (e.g. where only parameters or spectral components are uncertain) but may not fully capture dynamics present in uncertain data. In this case, a more general method is needed to explore the space of dynamics, and this is where data-driven methods for approximating transfer operators such as extended DMD [16] and observable eigenfunction learning [17] are promising.
Complementarily to model uncertainty, state uncertainty has been at the center of interests in the control community. Several researchers have investigated the computation of state uncertainty using operator-theoretic techniques [18, 19, 20]. For example, state-space density propagation using Perron–Frobenius operators has been used for controller selection [20].
Our method is complementary to existing techniques for state- and parameter-space uncertainty quantification in two ways. First, rather than performing error propagation from ensembles of trajectories, we utilize a distribution induced by a metric between transfer operators – thus it is a way to take an arbitrary set of initial models and expand it. Secondly, while the uncertainty set we produce can be used to extrapolate uncertain trajectories and perform state estimation, its use is not only limited to trajectory sampling but a wide range of optimization problems where a set of models is needed, without assuming a specific parametrization.
III BACKGROUND
III-A Transfer operator theory of nonlinear dynamics
A transfer operator is a linear map acting on functions on phase space of a dynamical system . is a linear operator over the function space and thus is a convenient alternative to the nonlinear state-space function .
In computational fluid dynamics, statistical physics, control theory, and many other fields, the use of transfer operators in describing dynamical systems has seen a recent surge of popularity since it facilitates the usage of linear techniques (e.g. spectral methods) in analyzing nonlinear systems [1].
When are phase-space densities , is referred to as the Perron–Frobenius operator that acts as the pushforward operator for the Markov process . When are arbitrary observables , is known as the Koopman (or composition) operator [21]. Seminal work by Mezić [1] showed the utility of transfer operator theory in data-driven system identification and model reduction. Using Koopman eigenfunctions to obtain linear descriptions of nonlinear systems facilitated the study of dynamics via the spectrum of the Koopman operator (e.g., characterizations of chaos [22]):
where and are the eigenfunctions and the eigenvalues of the Koopman operator, respectively. This led to the least-squares solutions for by Schmid et al. [23], called DMD.
DMD has since been extended with dictionaries of nonlinear basis functions (extended DMD [16]), observables in reproducing kernel Hilbert spaces [24, 25], neural networks (e.g., [26]), and the incorporation of control [4]. In this paper, we build upon this prior work, exploring uncertainty quantification in the context of transfer operators which are learned from observation data.
III-B Transfer operators for stochastic processes
To discuss transfer operators in the context of uncertain data, let us move to a fundamentally probabilistic setting where observations represent a stochastic process. While the system may not be intrinsically noisy, the probabilistic view facilitates representing uncertainty about future states. We adopt the framework of stochastic Koopman operators as introduced by Klus et al. [25] and Song et al. [27], and provide a brief background below.
Let a dynamical system have invariant probability measure , compactly supported over a measurable subspace . Let the sequence be a Markov process with transition density given by . Given an observable , the action of the stochastic Koopman operator on is defined by the conditional mean:
(1) |
Its right-adjoint, the Perron–Frobenius operator , directly maps marginal distributions as .
Let observables lie in an inner product space ( is taken to be an RKHS in [25], but for our purposes it can be the completion of a finite observable basis , and for trajectory visualization one may define these functions such that the preimage can be computed). Now, we may define the Gramian (i.e., a cross-covariance operator [27]):
Using the relation [27], we can express the stochastic Koopman and Perron–Frobenius operators (1) in terms of the cross-covariance operators as:
(2) | ||||
(3) |
that push forward observables and densities on , respectively. is for ensuring invertibility.
Considering perturbations to these operators, which are estimated from cross-covariances matrices using finite trajectories, forms the population of our uncertainty set.
III-C Kernels over dynamical systems
To compare the behavior of two dynamical systems, various metrics exist in the literature. For Markov processes, total-variation distance between density functions is commonly used, and more general classes of linear metrics over Markov chains have been proposed [28]. The standard operator norm can be used for bounded linear operators; when approximated by matrices, one can use an induced matrix norm, such as where and are linear finite dynamical systems. However, both of these standard metrics fail to capture the iterated behavior of the respective systems. To address this, Viswanathan et al. leverage the Binet–Cauchy theorem to define a kernel between trajectories or iterated maps [29].
In [10], Ishikawa et al. generalize the Binet-Cauchy kernel to general nonlinear dynamical systems defined by their respective Perron–Frobenius operators as follows. For two dynamical systems specified by their initial values and maps ,
(4) | ||||
where is an initial value operator embedding initial data into a Hilbert space, is the th iterate of the Perron–Frobenius operator on , and embeds states into an observable space. There is a relation between (4) and the determinant kernel in [29]; please refer to [10] for details. In the proposed sampling method, we make use of this kernel (4) to generate perturbations to Koopman operators.
IV PROPOSED METHOD
In this section, we first define a kernel and a pseudo-metric over Koopman operators utilizing the previous studies on operator-theoretic kernels over dynamical systems [30, 10]. Then, we present sampling procedures for dynamical systems using the kernel, which depend on the Hamiltonian Monte Carlo method [31] with some heuristic modifications.
IV-A Defining a kernel over Koopman operators
Whereas the kernel proposed by Ishikawa et al. [10] is defined for Perron–Frobenius operators on RKHS, we adapt it for the Koopman operator as follows. Let the initial value and observable operators be already applied, and the kernel (4) evaluated on a dynamical system which acts in this (observable) space. Then we simplify (4) to:
(5) |
As noted in [10], this kernel is convergent in the limit of for semi-stable , that is, those with spectral radius only. To use for general Koopman operators , we use an exponential discounting scheme with factor :
(6) |
Note that the discounting factor has been adopted also in previous studies on dynamical system kernels [32, 30].
Let us show the convergence of (6) as informally, for a finite-dimensional approximation of . We first observe that converges if for any matrix . As the product of two convergent series is convergent, it suffices to show that for all . Using Gelfand’s formula,
Even if , the series is convergent if . Thus converges for all and appropriate .
IV-B Sampling from distributions over transfer operators
We propose a sampling procedure for dynamical systems models given an inner product defined over transfer operators. We define a (pseudo-)metric bounded in for operators , using a cosine similarity, as
where denotes the inner product induced by a positive-definite kernel . As a baseline, we may also consider the standard linear kernel , which is not necessarily a good option for transfer operators.
Let be a random variable with density . Furthermore, let be a nominal transfer operator (such as ones estimated by DMD). Then we define a likelihood of any dynamical system as:
(7) |
For example, we may assume is a Beta distribution with , or an exponential distribution with vanishing density past . Using this we may easily construct an uncertainty set of radius as .
Sampling using can be done in a number of ways. The conceptually simplest algorithm is rejection sampling: for any uniformly perturbed , accept if for and convergence parameter . Unfortunately, even generating the initial uniform perturbations may be computationally intractable due to the high dimensionality of the samples. This results in low acceptance rates for rejection sampling as well as random-walk MCMC methods such as Metropolis–Hastings. We turn our focus to gradient-based MCMC methods which are able to generate distant proposals and achieve dimensionality-independent acceptance rates.
IV-C High-dimensional sampling via HMC
In his seminal work [31], Neal introduced Hamiltonian Monte Carlo (HMC), which uses the gradient of the likelihood to simulate stochastic Hamiltonian dynamics whose stationary distribution is the posterior (7). It is well suited to our case since many kernels over dynamical systems are basically differentiable.
We adapt HMC for transfer operator sampling by introducing an auxiliary momentum variable which is of the same dimension as , whose relation to is given via Hamiltonian dynamics. Let us define the potential and the Hamiltonian of an operator as:
(8) | ||||
(9) |
Noting that the potential must be defined (and continuous) everywhere in order to achieve the correct stationary distribution, must be similarly well-behaved for all . Using the discounted kernel (6), we generate samples of Koopman operators about a nominal via Hamiltonian dynamics in the potential defined by (8) using the leapfrog integrator (we refer the reader to [31] for details).
IV-D Heuristic: parallel HMC with uniform prior
The mixing time of HMC is highly sensitive to the choice of discretization parameters (in particular, n_leapfrog, step_size). In practice, Neal recommends [31], and there also exist adaptive step-determining algorithms such as the No-U-Turn Sampler [33]; however, we find a tradeoff between computational efficiency (samples/step) and sufficient exploration of the model space when using HMC for transfer operators. To compensate, we use a pre-run of HMC in a zero-potential to generate a uniform prior of samples, which are then used as initial conditions for parallel HMC sampling from the distribution (7). We find that this accelerates the mixing time and wall-clock time for sampling significantly.
IV-E Heuristic: HMC with spectral constraints
In the interest of producing meaningful samples, one may wish to constrain the space of models using prior knowledge of the underlying system. Constraints can be readily expressed as boundary conditions on HMC without changing its stationary solution or reversibility (under some assumptions) – known as Reflective HMC [34]. As an example, suppose that we have knowledge that the system is structurally stable under any realistic perturbation; then, we can (roughly) encode this as a constraint on the spectral radius .
Extending the reflective HMC procedure from [34], we describe a leapfrog integrator (Algorithm 1) which ensures for any differentiable, scalar-valued . In numerical experiments, we use and .
IV-F Computation of samples in practical settings
We will give two formulations of HMC (8) for finite arguments, one explicitly over transfer operators, and one implicitly over observed trajectories. Either may be used.
Formulation 1
Assume a transfer operator for a dynamical system is approximated as a matrix . Then, (6) simplifies to:
(10) | ||||
where denotes the submatrix given by indices . This formulation can be used when we have a nominal Koopman operator estimation and want to generate perturbed ’s.
Formulation 2
Assume observations of a dynamical system are given as a matrix . Then, we may define the Hamiltonian (8) for trajectories as:
The kernel (6) can be defined for trajectories of length in a similar fashion to (10). With fixed, an explicit discounting term is no longer needed. As an example, for :
for some feature kernel . Here, and are the elements of and , respectively. If we have explicit observables , simply let . This formulation allows one to sample trajectories about some observed trajectory . When used in conjunction with a parametrized dynamics model , {X} can be used for inference procedures (e.g., E-M) on .

V NUMERICAL EXAMPLES
We show how our sampling procedure compares against baseline perturbation methods in generating meaningful perturbations of dynamical systems111Codes: github.com/ooblahman/koopman-robust-control.. For example, methods in robust optimization (RO) take the general form
where is a model and is an uncertainty structure. may have a particular form, e.g. block-diagonal, or unstructured, e.g. . The goodness of the RO minimizer depends solely on the choice of uncertainty set. Either of these uncertainty structures essentially induces a distribution over the norms of perturbations; we note that this is an assumption, and the subject of our testing is whether this assumption is valid when it is known the perturbed matrices represent dynamical systems.
A norm-bounded perturbation set essentially translates as sampling with a trace kernel:
(11) |
which we use as a baseline for comparison. As mentioned in section III-C, despite its naturalness, it is not necessarily suitable for dynamical systems. By contrast, the proposed uncertainty structure induced by (10) incorporates the iterated behavior of . We demonstrate that the latter better preserves key properties of dynamical systems such as structural stability and attractor basins, while effectively exploring dynamics space, on both linear systems of ODEs and nonlinear systems via the Koopman operator.
V-A 2-dimensional LTI systems
We first consider linear systems of the form via discretization as . We use simple 2x2 systems in order to clearly characterize the dynamics in a trace-determinant plot. Using the discounted kernel (10), we are able to generate perturbations of both source- and saddle-types in addition to the semistable regimes. We use spread parameter , HMC step , HMC leapfrog , and generate samples with initial conditions for every test shown. We compare the following two kernels:
termed the “trace kernel” and “Koopman kernel”, respectively.
The strength of the proposed method, using , can be seen when the nominal system is within a region of structural instability (see the two center systems, Figure 1). The trace kernel perturbations venture easily into spiral sink or spiral sources, which are distant in dynamics terms but very close in absolute norm. In these cases, the proposed method using the Koopman kernel retains a much tighter spread in the trace-determinant plane. Furthermore, it can be seen from the posterior distributions that the proposed method is able to explore distant dynamics while staying bounded within structurally similar regions.
V-B Unforced Duffing oscillator

Next, we consider perturbations of a nonlinear system. We use the unforced Duffing equation:
(12) |
whose basins of attraction are like in Figure 2.


We use simulated trajectories of length seconds with samples per trajectory across initial conditions in the range . Using polynomial observables with maximum degree , we compute the Koopman operator as . For all experiments we use spread , HMC step , HMC leapfrog , samples, and initial conditions. In the shown perturbations, trajectories in the left and right basins of attraction are highlighted in red and blue, respectively (Figure 3).
We immediately observe some qualitative differences between the two perturbation sets. First, it is apparent that perturbations via the Koopman kernel preserve attractor structure in most samples, versus almost none in the baseline setting. In the case of the Duffing oscillator, this is a defining feature, and such preservations are important consideration for any robust prediction or control procedure over dynamics models. Second, a large proportion of samples produced by the baseline method are diverging; these would need to be manually filtered out if used in a robust optimization setting. We observe in experiments that this can be mitigated by restricting the norm of perturbations (i.e., increasing ), but this comes at the cost of decreased exploration of dynamics space and changes the robustness of an RO solution using the perturbation set (moreover, manual filtering changes the posterior, altering the RO problem). We also find that the spectral radius constraint alleviates many of these concerns with the baseline method, however, non-convex reflection is not a trivial procedure to implement in HMC and has not been a typically used method in generating uncertainty sets.
Finally, while attractors are mostly preserved in our method, the attractor basins seem to undergo some geometry warping. This suggests an interpretation of our perturbation method as warping the underlying potential wells, which may have meaningful physical interpretations.
VI CONCLUSIONS
In this work, we developed a method for sampling from distributions over dynamical systems using transfer-operator representations, leveraging operator-theoretic metrics to generate perturbations. We suggested to use the method for model uncertainty set generation, which is a universal problem in robust control and prediction and an important step for uncertainty quantification. Future directions of research include expressing constraints over sampled dynamical systems where we may have domain-specific knowledge.
References
- [1] I. Mezić, “Spectral properties of dynamical systems, model reduction and decompositions,” Nonlinear Dynamics, vol. 41, no. 1, pp. 309–325, 2005.
- [2] A. Mauroy, F. Forni, and R. Sepulchre, “An operator-theoretic approach to differential positivity,” in Proc. of the 54th IEEE Conf. on Decision and Control, pp. 7028–7033, 2015.
- [3] J. Annoni, P. Seiler, and M. R. Jovanović, “Sparsity-promoting dynamic mode decomposition for systems with inputs,” in Proc. of the 55th IEEE Conf. on Decision and Control, pp. 6506–6511, 2016.
- [4] J. L. Proctor, S. L. Brunton, and J. N. Kutz, “Dynamic mode decomposition with control,” SIAM J. on Applied Dynamical Systems, vol. 15, no. 1, pp. 142–161, 2016.
- [5] A. Surana, “Koopman operator based observer synthesis for control-affine nonlinear systems,” in Proc. of the 55th IEEE Conf. on Decision and Control, pp. 6492–6499, 2016.
- [6] A. Mauroy and J. Goncalves, “Linear identification of nonlinear systems: A lifting technique based on the Koopman operator,” in Proc. of the 55th IEEE Conf. on Decision and Control, pp. 6500–6505, 2016.
- [7] A. Mauroy and I. Mezić, “Global stability analysis using the eigenfunctions of the Koopman operator,” IEEE Trans. on Automatic Control, vol. 51, no. 1, pp. 3356–3369, 2016.
- [8] A. Surana, M. O. Williams, M. Morari, and A. Banaszuk, “Koopman operator framework for constrained state estimation,” in Proc. of the 56th IEEE Conf. on Decision and Control, pp. 94–101, 2017.
- [9] N. Takeishi, T. Yairi, and Y. Kawahara, “Factorially switching dynamic mode decomposition for Koopman analysis of time-variant systems,” in Proc. of the 57th IEEE Conf. on Decision and Control, pp. 6402–6408, 2018.
- [10] I. Ishikawa, K. Fujii, M. Ikeda, Y. Hashimoto, and Y. Kawahara, “Metric on nonlinear dynamical systems with Perron–Frobenius operators,” in Advances in Neural Information Processing Systems 30, pp. 2856–2866, 2018.
- [11] N. Takeishi, Y. Kawahara, Y. Tabei, and T. Yairi, “Bayesian dynamic mode decomposition,” in Proc. of the 26th Int. Joint Conf. on Artificial Intelligence, pp. 2814–2821, 2017.
- [12] J. Morton, F. D. Witherden, and M. J. Kochenderfer, “Deep variational Koopman models: Inferring Koopman observations for uncertainty-aware dynamics modeling and control,” in Proc. of the 28th Int. Joint Conf. on Artificial Intelligence, pp. 3173–3179, 2019.
- [13] M. Girolami, “Bayesian inference for differential equations,” Theoretical Computer Science, vol. 408, no. 1, pp. 4–16, 2008.
- [14] B. Calderhead, M. Girolami, and N. D. Lawrence, “Accelerating bayesian inference over nonlinear differential equations with gaussian processes,” in Advances in neural information processing systems 21, pp. 217–224, 2009.
- [15] M. Niu, S. Rogers, M. Filippone, and D. Husmeier, “Fast inference in nonlinear dynamical systems using gradient matching,” in Proc. of the 33rd Int. Conf. on Machine Learning, pp. 1699–1707, 2016.
- [16] M. O. Williams, I. G. Kevrekidis, and C. W. Rowley, “A data-driven approximation of the Koopman operator: Extending dynamic mode decomposition,” J. of Nonlinear Science, vol. 25, no. 6, pp. 1307–1346, 2015.
- [17] M. Korda and I. Mezić, “Optimal construction of Koopman eigenfunctions for prediction and control.” arXiv:1810.08733, 2018.
- [18] A. Surana and A. Banaszuk, “Linear observer synthesis for nonlinear systems using Koopman operator framework,” IFAC-PapersOnLine, vol. 49, no. 18, pp. 716–723, 2016.
- [19] T. Shnitzer, R. Talmon, and J.-J. Slotine, “Diffusion maps Kalman filter for a class of systems with gradient flows.” arXiv:1711.09598, 2017.
- [20] J. J. Meyers, A. M. Leonard, J. D. Rogers, and A. R. Gerlach, “Koopman operator approach to optimal control selection under uncertainty,” in Proc. of the 2019 American Control Conf., pp. 2964–2971, 2019.
- [21] B. O. Koopman and J. v. Neumann, “Dynamical systems of continuous spectra,” Proc. of the National Academy of Sciences, vol. 18, no. 3, pp. 255–263, 1932.
- [22] H. Arbabi, Koopman Spectral Analysis and Study of Mixing in Incompressible Flows. PhD thesis, University of California, Santa Barbara, 2017.
- [23] P. J. Schmid, “Dynamic mode decomposition of numerical and experimental data,” J. of Fluid Mechanics, vol. 656, pp. 5–28, 2010.
- [24] Y. Kawahara, “Dynamic mode decomposition with reproducing kernels for Koopman spectral analysis,” in Advances in Neural Information Processing Systems 29, pp. 911–919, 2016.
- [25] S. Klus, I. Schuster, and K. Muandet, “Eigendecompositions of transfer operators in reproducing kernel Hilbert spaces,” J. of Nonlinear Science, vol. 30, p. 283–315, Aug 2019.
- [26] N. Takeishi, Y. Kawahara, and T. Yairi, “Learning Koopman invariant subspaces for dynamic mode decomposition.,” in Advances in Neural Information Processing Systems 30, pp. 1130–1140, 2017.
- [27] L. Song, J. Huang, A. Smola, and K. Fukumizu, “Hilbert space embeddings of conditional distributions with applications to dynamical systems,” in Proc. of the 26th Int. Conf. on Machine Learning, pp. 961–968, 2009.
- [28] P. Daca, T. A. Henzinger, J. Kretínský, and T. Petrov, “Linear distances between Markov chains.” arXiv:1605.00186, 2016.
- [29] A. J. Smola and S. Vishwanathan, “Binet-Cauchy kernels.,” in Advances in Neural Information Processing Systems 17, pp. 1441–1448, 2005.
- [30] K. Fujii, Y. Inaba, and Y. Kawahara, “Koopman spectral kernels for comparing complex dynamics: Application to multiagent sport plays,” in Lecture Notes in Computer Science, vol. 10536, pp. 127–139, 2017.
- [31] R. M. Neal, MCMC Using Hamiltonian Dynamics, ch. 5. CRC Press, 2011.
- [32] S. Vishwanathan, A. J. Smola, and R. Vidal, “Binet–Cauchy kernels on dynamical systems and its application to the analysis of dynamic scenes,” Int. J. of Computer Vision, vol. 73, no. 1, p. 95–119, 2007.
- [33] M. D. Hoffman and A. Gelman, “The No-U-Turn sampler: Adaptively setting path lengths in Hamiltonian Monte Carlo,” J. of Machine Learning Research, vol. 15, no. 47, pp. 1593–1623, 2014.
- [34] H. Mohasel Afshar and J. Domke, “Reflection, refraction, and Hamiltonian Monte Carlo,” in Advances in Neural Information Processing Systems 28, pp. 3007–3015, 2015.