<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Data-Driven Encoding: A New Numerical Method for Computation of the Koopman Operator</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>07/01/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10438718</idno>
					<idno type="doi">10.1109/LRA.2023.3273515</idno>
					<title level='j'>IEEE Robotics and Automation Letters</title>
<idno>2377-3774</idno>
<biblScope unit="volume">8</biblScope>
<biblScope unit="issue">7</biblScope>					

					<author>Jerry Ng</author><author>H. Harry Asada</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[This paper presents a data-driven method for constructing a Koopman linear model based on the Direct Encoding (DE) formula. The prevailing methods, Dynamic Mode Decomposition (DMD) and its extensions are based on least squares estimates that can be shown to be biased towards data that are densely populated. The DE formula consisting of inner products of a nonlinear state transition function with observable functions does not incur this biased estimation problem and thus serves as a desirable alternative to DMD. However, the original DE formula requires knowledge of the nonlinear state equation, which is not available in many practical applications. In this paper, the DE formula is extended to a data-driven method, Data-Driven Encoding (DDE) of Koopman operator, in which the inner products are calculated from data taken from a nonlinear dynamic system. An effective algorithm is presented for the computation of the inner products, and their convergence to true values is proven. Numerical experiments verify the effectiveness of DDE compared to Extended DMD. The experiments demonstrate robustness to data distribution and the convergent properties of DDE, guaranteeing accuracy improvements with additional sample points. Furthermore, DDE is applied to deep learning of the Koopman operator to further improve prediction accuracy.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Dynamic Mode Decomposition (DMD) was presented as a method to produce linear models from data generated through nonlinear dynamical processes by using Singular Value Decomposition (SVD) <ref type="bibr">[1]</ref>. Later, this method was developed further to create Extended Dynamic Mode Decomposition (EDMD), which introduced the concept of using observable functions, nonlinear functions of state variables, as a method of augmenting the state space <ref type="bibr">[2]</ref>. EDMD referenced the Koopman Operator as justification and a theoretical underpinning for lifting the state space. Decades prior, Bernard Koopman showed the existence of this operator that transforms nonlinear systems into linear systems <ref type="bibr">[3]</ref>. Another extension of DMD has shown the viability of using DMD for control on non-autonomous systems <ref type="bibr">[4]</ref>. This enabled complex nonlinear Model Predictive Control (MPC) to be converted to linear MPC <ref type="bibr">[5]</ref>, leading to numerous studies utilizing the methodology to real systems <ref type="bibr">[6]</ref>- <ref type="bibr">[9]</ref>.</p><p>To improve the accuracy of the models based on the Koopman Operator, two avenues of research have formed. The first avenue regards the selection of the observable functions used for constructing a lifted state space, as these functions are a key ingredient in creating an accurate linear model. Various methods have been developed, including deep neural networks for learning effective observable functions <ref type="bibr">[10]</ref>- <ref type="bibr">[12]</ref> and optimization <ref type="bibr">[13]</ref>. However, an efficient selection of observables does not solve all the issues that arise when attempting to construct an accurate linear model. The second avenue of research addressed the proper formulation of the linear transition matrix. It is known that unstable modes are involved in Koopman-based DMD models and their extensions although the underlying nonlinear systems are known to be stable <ref type="bibr">[14]</ref>. Extensive studies have been done to create stable linear models to remedy the situations where an outright use of DMD would lead to the creation of an unstable linear model <ref type="bibr">[14]</ref>- <ref type="bibr">[17]</ref>. Recently, an extension of DMD, called Robust Dynamic Mode Decomposition (RDMD), utilizes statistical measures to suppress the effect of outliers on modeling the linear Koopman matrix <ref type="bibr">[18]</ref>.</p><p>A fundamental difficulty in constructing a proper linear model is data dependency. Least Squares Estimation (LSE), involved in all DMD based methods, often produces a significant bias, an over weighting of samples. This bias is due to the distribution, how prevalent similar data points are, of the dataset. To eliminate this dependency on distribution, the current work takes an alternative approach to LSE.</p><p>Recently, a new formulation of the Koopman Operator, termed Koopman Direct Encoding (DE), was produced <ref type="bibr">[19]</ref>. This method directly encodes the nonlinear dynamics into the lifted linear model. Inner products of observable functions in composition with the nonlinear state transition function are used to construct the state transition matrix without use of LSE. While DE theoretically guarantees the exact linear model, it requires access to the nonlinear state equations, which are often not available in practical applications. The current work aims to fill the gap between DE and data-driven approaches.</p><p>There are four significant contributions presented in this work. The first is the conversion of the DE formula of the Koopman Operator to a data-driven formula. The second is a computational algorithm and proof of its convergence to the true inner products that constitute the DE formula. The third is numerical experiments that provide evidence that the proposed method, unlike EDMD, does not exhibit biases to data distribution, but can produce consistently higher accuracy compared to EDMD. Finally, the DDE algorithm is utilized in modeling a high order nonlinear system in combination with deep learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. KOOPMAN OPERATOR AND THE DIRECT ENCODING METHOD</head><p>In this section, we give a brief overview of the Koopman Operator and dynamic mode decomposition <ref type="bibr">[2]</ref>, and introduce the direct encoding method for obtaining a Koopman Operator directly from nonlinear dynamics <ref type="bibr">[19]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Least Squares Estimation of the Koopman Operator</head><p>Consider a discrete-time dynamical system, given by</p><p>where x &#8712; X &#8834; R n is the independent state variable vector representing the dynamic state of the system, f is a selfmap, nonlinear function f : X &#8594; X, and t is the current time step. Also consider a real-valued observable function of the state variables g : X &#8594; R. The Koopman Operator K is an infinite-dimensional linear operator acting on the observable function g :</p><p>where g &#8226; f is the composition of function g with function f :</p><p>A common data-driven method for constructing the operator is Extended Dynamic Mode Decomposition (EDMD) <ref type="bibr">[2]</ref>, where observables that are experimentally obtained or simulated from the governing equation of the system are augmented by including real-valued observable functions of the independent state vector x t . This collection of observables, z t is</p><p>. . .</p><p>where m is the order of the lifted state corresponding to the number of observable functions. Underpinned by the Koopman Operator theory, EDMD assumes the existence of a linear state transition matrix A relating z t+1 to z t , and determine A by solving a least squares regression that minimizes the Sum of Squared Error (SSE) through</p><p>Singular Value Decomposition (SVD) is used for the least squares optimization.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Direct Encoding of the Koopman Operator</head><p>An alternative to the least squares estimate and EDMD is to obtain the exact A matrix by directly encoding the selfmap, nonlinear state transition function f (x) with an independent and complete set of observable functions through inner product computations. This Direct Encoding method is introduced next, while the full proof can be found in <ref type="bibr">[19]</ref>.</p><p>Let us first consider the case where g 1 , g 2 , g 3 , ... are orthonormal basis functions spanning a Hilbert space H. We assume that the self-map nonlinear function f (x) is continuous and that the composition of g j with f is also involved in the Hilbert space.</p><p>This implies that the function g j &#8226; f can be expanded in [g 1 , g 2 , g 3 , ...].</p><p>Concatenating g 1 , g 2 , g 3 , ... and</p><p>eq. ( <ref type="formula">6</ref>) can be written in matrix and vector form.</p><p>where &#256; is an infinite dimensional matrix consisting of the inner products involved in eq. ( <ref type="formula">6</ref>),</p><p>Eq. ( <ref type="formula">8</ref>) manifests that the state lifted to the infinite dimensional space zt makes linear state transition with matrix &#256;. The observables g 1 , g 2 , g 3 , ... were assumed to be orthonormal basis functions in the above derivation. This assumption can be relaxed to an independent and complete set of basis functions spanning the Hilbert space. Hereafter, let [g 1 , g 2 , g 3 , ...] be an independent and complete set of basis functions spanning the Hilbert space.</p><p>It can be shown that the time evolution of lifted state z t is given by a constant matrix A f for the independent and complete set of basis functions [g 1 , g 2 , g 3 , ...].</p><p>The matrix A f can be computed directly from the selfmap, state transition function f (x) and an independent and complete set of observables [g 1 , g 2 , g 3 , ...] through inner product computations. Post-multiplying the transpose of z t to both sides of eq. ( <ref type="formula">10</ref>) and integrating them over X yield:</p><p>which can be written as</p><p>where</p><p>Because the observables are independent, the matrix R is non-singular. Therefore, the matrix A f is given by</p><p>This formula for obtaining the matrix A f directly from the governing nonlinear state equation with the function f (x) and the independent observables through inner products, which are guaranteed to exist in Hilbert space H, is the Direct Encoding method.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. DATA-DRIVEN KOOPMAN ENCODING</head><p>The prevailing method for construction of the Koopman Operator, EDMD, is based on LSE and SVD. This method, however, cannot provide an unbiased estimate; the result is biased -dependent on the distribution of data within a dataset-as the Koopman Operator is being approximated <ref type="bibr">[20]</ref>. This dependency on distribution of a dataset occurs because a core assumption of LSE is that the model structure is correct; when this assumption is violated, LSE is unable to create an unbiased estimator <ref type="bibr">[21]</ref>. As the Koopman Operator is truncated in practical use, this assumption does not hold.</p><p>Non-uniform data distributions, that is datasets where distances between data points in the state space are not equidistant from their nearest neighbors, inevitably occur in practical applications. For a nonlinear dynamical system with a stable equilibrium, for example, data collected from experiments and/or simulation of the system tend to be dense in the vicinity of the equilibrium, as all trajectories that begin within a region of attraction converge to the equilibrium. Because LSE applies equal weighting to all data points, the model is heavily tuned to the behavior of the densely populated region.</p><p>The Direct Encoding method described previously enables us to obtain the exact linear state transition matrix A through inner product computations. As the formulation is based on integration over the entire state space, there is no bias towards particular parts of the domain.</p><p>However, the original form of the Direct Encoding method utilizes the nonlinear state equation, i.e. the self-map f (x), to compute the inner products. In practical applications, such a nonlinear function is not always available; only data are available. The objective of this section is to establish a computational algorithm to obtain the A matrix by numerically computing the inner products, &#10216;g i , g j &#10217;, &#10216;g i &#8226; f, g j &#10217;, from a given set of data.</p><p>The method presented consists of three operations.</p><p>&#8226; The integral of the inner products is reduced in range from the entire state space to the dynamic range encapsulated by the data. &#8226; The dynamic range is discretized with data points.</p><p>&#8226; The inner product integral is reduced to a weighted summation of the integrand evaluated at each data point multiplied by the volume &#8710;v associated to each point. Naturally, if data are densely populated in a small region, the discretized integral interval is small and thereby the volume also becomes small. Similarly, the volume tends to be larger where the data are sparse. In the summation, the integrand evaluated at individual data points are "weighted" by the size of the volume. This numerical inner product calculation prevents overemphasis of clustered data.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Inner Product Computation</head><p>We present the data-driven encoding method (DDE) as an alternative data-driven method to DMD for calculating a finite order approximation of the Koopman Operator. The objective of this method is to compute the matrices R and Q in ( <ref type="formula">13</ref>) and ( <ref type="formula">14</ref>) from data. This entails the computation of inner products:</p><p>where</p><p>are assumed to be Riemann Integrable; the functions are bounded and continuous <ref type="bibr">[22]</ref>.</p><p>There are two data sets used for the inner product computation. The first data set is</p><p>Note that all the data values are finite, |x i | &lt; &#8734;. As such, the integral interval of the inner products is finite in computing them from the data. To define the integral interval, we consider the dynamic range of the system, X D , determined from the data set D N . See Fig. <ref type="figure">1</ref>. The dynamic range X D is defined to be the minimum domain in the space X that includes all the data points in D N , X D &#8835; D N , and that is convex. Namely, for any two states in</p><p>where 0 &#8804; &#945; &#8804; 1. Each data point x i is mapped to f (x i ),</p><p>Fig. <ref type="figure">1</ref>: Illustration of the dynamic range of a dataset defined by the convex hull containing all points in the set, partitioned using a triangulation method. The data points are in black and the convex hull that encapsulates all data points is in grey.</p><p>following the state transition law in eq.( <ref type="formula">1</ref>). We assume that the transferred state, too, stays within the same dynamic range X D . Collecting all the transferred states yields the second data set.</p><p>This implies that the state space of the nonlinear system under consideration is closed within the dynamic range X D . With this dynamic range, we redefine our objective to compute the inner products over X D .</p><p>The integrals can be computed by partitioning the domain X D into many segments X 1 , &#8226; &#8226; &#8226; X P , as shown in Fig. <ref type="figure">1</ref>.</p><p>We generate these segments by applying a meshing technique to the data set D N , where the n-dimensional coordinates of individual data points are treated as nodes of a mesh. Delaunay Triangulation, for example, generates a triangular mesh structure with desirable properties <ref type="bibr">[23]</ref>. As illustrated in Fig. <ref type="figure">1</ref>, each triangular element is convex and has no internal node. The volume of the dynamic range V (X D ) is the sum of the volumes of all the elements.</p><p>Accordingly, the integral R ij in eq.( <ref type="formula">23</ref>) can be segmented to</p><p>Suppose that the p-th element has K p nodes, as shown in Fig. <ref type="figure">2</ref>. Renumbering these nodes 1 through K p ,</p><p>The integrand G ij within the p-th element can be approximated to the mean of the K p nodes involved in the p-th element.</p><p>If Delaunay Triangulation is used, K p = n + 1. See Fig. <ref type="figure">2</ref>. Substituting this into (23) yields the approximate value of R ij .</p><p>where Similarly, each component of the matrix Q can be computed by using the same meshing.</p><p>Note that F ij is evaluated by using the data points in both</p><p>where f (x[k p ]) &#8712; D f N , thus not requiring evaluation of the nonlinear function f .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Convergence</head><p>Consider the center of each partition, xp = Xp xdx/&#8710;v p , and the distance between xp and each point,</p><p>See Fig. <ref type="figure">2</ref>. The maximum distance from the center of the partition to each point that makes up the partition is</p><p>Consider a sequence of refining the approximate inner product integral Rij by increasing data points N . We can show that, as the number of partition P tends infinity and the maximum subintervals |&#8710;x p | approach zero, the approximate inner product integral Rij converges to its true integral.</p><p>This formulation takes the form of weighted sums, specifically Riemann sums. Given functions that are bounded and continuous over the subdomain of interest, sequences of this form are known to have a common limit and thus converge upon refinement to the Riemann integral value over that subdomain, according to Numerical Integration theory [22, Section 1.5].</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Algorithm</head><p>In the prior section, integrals (30) and (32) are presented as summations over partitions. This computation can be streamlined by converting the summations over partitions to the one over nodes. Consider node 3 associated to data point x 3 in Fig. <ref type="figure">1</ref>, for example. This node is an apex of the 5 surrounding triangles. This implies that integrand G ij (x) is calculated or recalled 5 times in computing (30) and (32). This repetition can be eliminated by computing volume &#8710;v k associated to node k, rather than partition p : &#8710;v p . Namely, we compute</p><p>where I(k, p) is a membership function that takes value 1 when node k is an apex of triangle p, that is, node k is involved in partition p. Using this volume as a new weight we can rewrite (30) and (32) to be</p><p>Using this conversion, the computation can be streamlined and cleanly separated into three steps, as shown by pseudocode in Algorithm 1. The steps are: (1) Graph Creation: data are connected to create partitions of the domain using a mesh generator: lines 3 to 8, (2) Weighting Calculation: calculation of the weights for each data point: lines 10 to 17, and (3) Matrix Calculation: the calculation of the R and Q matrices to find the matrix A, lines 19 to 21.</p><p>In comparison to EDMD, this algorithm is notably slower. In terms of time complexity, EDMD uses Singular Value Decomposition (SVD) which is O(mn 2 ), while the current method of graph creation for DDE, Delaunay Triangulation, is O(m n/2 ), where n is the dimensions of the space and m is the number of points <ref type="bibr">[24]</ref>  <ref type="bibr">[25]</ref>. In addition, as DDE is based on numerical integration, issues arise when the underlying nonlinear system becomes significantly high order.</p><p>IV. EXPERIMENTS In this section, the DDE algorithm is implemented for the sake of evaluating its validity and comparing its modeling accuracy to EDMD. Consider a 2nd order nonlinear system consisting of a pendulum with a nonlinear damper. See Fig. <ref type="figure">3</ref>. The pendulum also bounces against walls with nonlinear compliance. The state variables for this system are x = [&#952;, &#952;] T , and the equation of motion can be written as:</p><p>where F k and F c are wall reaction moment and damping moment, respectively, where k = 200 and c = 1. We present a two part numerical experiment for this system. The first experiment regards variations in dataset size and distribution, and the second experiment varies the usage of observable functions.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Dataset Variations</head><p>The datasets tested are of three types: 1) Uniform: These datasets are composed of a rectangular dynamic range which is sampled uniformly, like an evenly divided grid. The range varies from &#952; = [-0.   walls and the damping can vary from 0 to a significant value. See Fig. <ref type="figure">3-(b</ref>), (c). 2) Gaussian: Data points are sampled with a finitesupport Gaussian distribution. The data are distributed non-uniformly with their highest density at the peak of the Gaussian placed at diverse locations. In addition, each dataset contains 100 data points uniformly distributed along the border of the dynamic range to guarantee the same dynamic range as the uniform datasets. Samples outside the dynamic range are excluded. 3) Trajectories: These datasets are composed of trajectories, beginning from 100 initial conditions that are simulated forward the same number of time steps. The dynamic range of this dataset differs from the two other dataset types.</p><p>The models constructed for DDE and EDMD use the same observable functions. The observable functions chosen are two dimensional radial basis functions (RBFs), uniformly distributed between the maximum and minimum values of each state variable in their respective dataset, and the state variables. The total order of the system is 27th order with 25 RBFs and 2 state variables.</p><p>A trajectory dataset graph is generated using Delaunay Triangles in DDE, shown in Fig. <ref type="figure">4</ref>.</p><p>The accuracy of the models is tested through calculating sum of squared errors (SSE) for one-step ahead predictions  over the dynamic range of the datasets. These error values are calculated for a uniform grid of points, similar to that used in the uniform datasets. A visualization of the SSE is plotted in Fig. <ref type="figure">5</ref>. The results of these calculations are shown in Table <ref type="table">I</ref> and II. In the computation, the dynamic range is discretized, and the SSE value of each point is summed.</p><p>For the Gaussian datasets, the test is run for eight iterations of each dataset to account for randomness and the average result is noted. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Observable Function Variation</head><p>The second experiment varies the number of observable functions selected, thus increasing the order. In this experiment, the number of RBFs is varied through uniformly increasing the density of the centers of the function over the range of the dataset. The results are noted in Table <ref type="table">III</ref>. In the table, the number detailing number of observables is the number of functions including the state variables.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Discussion</head><p>From these results we can make the following observations.</p><p>&#8226; All the numerical experiments show that DDE outperforms EDMD in total SSE. &#8226; For uniform datasets, both models are nearly equivalent, though DDE has slightly lower SSE in all cases, shown in Table <ref type="table">I</ref>. This result is expected as all data points are weighted equally in a uniform distribution. &#8226; For trajectory datasets, the total SSE converges for DDE with small dataset sizes. This result implies that the elements in the R and Q matrices of DDE, that is, the inner product integral computations, converge as the data size and the data density increase. This convergence is confirmed in Fig. <ref type="figure">6</ref>, where several elements of the Q matrix are plotted against the data size. &#8226; The second experiment, regarding variations in observable function numbers demonstrates the effect of DDE remains even for significant increases in observable functions, referring to Table <ref type="table">III</ref>. In all cases tested, DDE significantly outperforms EDMD over the dynamic range, as expected for a non-uniform dataset.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. APPLICATION TO NEURAL NET KOOPMAN MODELING</head><p>The use of deep neural networks for finding effective observable functions and constructing a Koopman linear model has been reported by several groups <ref type="bibr">[10]</ref>- <ref type="bibr">[12]</ref>. This method, sometimes referred to as Deep Koopman, is effective for approximating the Koopman Operator to a low-order model, compared to the use of locally activated functions, such as RBFs, which scale poorly for high-order nonlinear  DDE can be applied to the neural network having an architecture similar to prior works <ref type="bibr">[10]</ref>- <ref type="bibr">[12]</ref>. See Fig. <ref type="figure">7</ref>. The input layer receives training data of independent state variables. The hidden layers produce observable functions; these functions feed into the output layer consisting of linear activation units. This linear output layer corresponds to the A matrix that maps the observables of the current time to those of the next time step, i.e. the state transition in the lifted space. In the Deep Koopman approach, the output layer, that is, the A matrix, is trained together with observable functions in the hidden layers. This A matrix can be further improved by replacing it with the A matrix obtained from DDE, captioned in Fig. <ref type="figure">7</ref>.</p><p>This Deep Koopman-DDE method is applied to a simulated cable manipulation system, similar to prior art <ref type="bibr">[6]</ref>. The specific system used for the simulation experiment consists of one cable suspending a point mass, where a winch varies the length of one cable. The system is a 6-th order nonlinear, switched system where the cables go slack because of the unidirectional nature of cable tension. Because this system is higher order, it necessitates the application of Deep Koopman for the selection of observable functions to accurately represent the system linearly with a finite order. More details can be found in <ref type="bibr">[26]</ref>. The network is constructed using PyTorch with the parameters shown in Table <ref type="table">IV</ref>. From simulated trajectories starting at diverse initial conditions, 3,000 data points are drawn.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. CONCLUSION</head><p>In this work, a new data-driven approach to generating a Koopman linear model based on the direct encoding of Koopman Operator (DDE) is presented as an alternative to dynamic mode decomposition (DMD) and other related methods using least squares estimate (LSE). The major contributions include: 1) The analytical formula of Direct Encoding is converted to a numerical formula for computing the inner product integrals from given data; 2) An efficient algorithm is developed and its convergence conditions to the true results are analyzed; 3) Numerical experiments demonstrate a) greater accuracy compared to EDMD, b) lower sensitivity to data distribution, and c) rapid convergence of inner product computation. Furthermore, the DDE method is incorporated to Deep Koopman, i.e. neural network based methods for construction of the Koopman Operator, for improving prediction accuracy. The current method, however, is for autonomous systems. The extension to systems with control is a challenge for the future and must be addressed rigorously, beyond utilizing an input as an observable.</p></div></body>
		</text>
</TEI>
