## Practical Guidelines for Data-driven Identification of Lifted Linear Predictors for Control

Loi Do, Adam Uchytil, and Zdenˇ ek Hur´ ak

Abstract -Lifted linear predictor (LLP) is an artificial linear dynamical system designed to predict trajectories of a generally nonlinear dynamical system based on the current state (or measurements) and the input. The main benefit of the LLP is its potential ability to capture the nonlinear system's dynamics with precision superior to other linearization techniques, such as local linearization about the operation point. The idea of lifting is supported by the theory of Koopman Operators. For LLP identification, we focus on the data-driven method based on the extended dynamic mode decomposition (EDMD) algorithm. However, while the EDMD algorithm presents an extremely simple and efficient way to obtain the LLP, it can also yield poor results. In this paper, we present some less intuitive practical guidelines for data-driven identification of the LLPs, aiming at improving usability of LLPs for designing control. We support the guidelines with two motivating examples. The implementation of the examples are shared on a public repository.

Index Terms -Koopman operator, extended dynamic mode decomposition, lifting, linear predictor, data-driven

## I. INTRODUCTION

One approach to control design for nonlinear systems is to use linear control system methods. To this end, a linear model of the system's dynamics is required. There are many ways to obtain a linear model, but the primary issue with such linear models is their small validity region.

Lifted linear predictor (LLP) is an artificial linear dynamical system designed to predict trajectories of a generally nonlinear dynamical system based on the current states (or measurements) and the inputs. By lifting we mean mapping the original state x ∈ R n into a higher-dimensional space R N , N &gt; n , where the evolution of the state x is approximately linear. The idea of capturing nonlinear system's behavior linearly in lifted space dates back to the seminal works [1], [2] of Koopman and von Neummann in the 1930s, with the resurgence of interest in mid 2000s with the works [3], [4]. Notably, the authors in [5] introduced the use of LLP in conjunction with the Model Predictive Control (MPC). Comprehensive picture of the applied Koopman Approach, discussing the theory and applications, can be found in [6].

There are several options to obtain the LLPs. We focus on a data-driven approach, the Extended Dynamic Mode Decomposition (EDMD) algorithm introduced in [7]. The EDMD presents an extremely simple method to obtain the

This work was co-funded by the European Union under the project ROBOPROX (reg. no. CZ.02.01.01/00/22 008/0004590).

Loi Do, Adam Uchytil, and Zdenˇ ek Hur´ ak are with Faculty of Electrical Engineering, Czech Technical University in Prague { doloi, uchytada, hurak [at]fel.cvut.cz }

control-oriented LLP from data, proving its efficiency in the control design for various systems [8], [9], [10]. However, despite the method's efficiency, we show several practical problems that can arise in the process, failing to provide the desired control performance.

## A. Main Contribution

In this paper, we address some less intuitive practical issues arising in identification of LLPs. We present practical guidelines for identification and evaluation of linear predictors that address these issues. As a result, better LLPs can be obtained. We support the guidelines with two motivating examples as well as with references to relevant works. The implementation of the examples are available at github.com/aa4cc/Lifted-Linear-Predictors-Guidelines.

## II. LINEAR PREDICTORS IN LIFTED SPACE

This section serves only as an overview - providing definitions, fixing the notation and terminology for the purpose of this paper. If it is found too terse, we refer the reader to [11], [6] for more detailed description.

Consider a nonlinear discrete-time dynamical system

$$x _ { k + 1 } = f ( x _ { k }, u _ { k } )$$

where f ( ) · is a generally nonlinear transition mapping, and x ∈ R n , and u ∈ R p are the system's state, output, and input, respectively. The goal is to predict the trajectory of the system, given an initial condition x 0 at time t 0 , and the sequence of the inputs { u i } N p i =0 , where N p is the prediction horizon length. To this end, we define the lifted linear predictor as a dynamical system

$$z _ { 0 } & = \Psi ( x _ { 0 } ) \, \\ z _$$

where z ∈ R N is the lifted state, Ψ : R n → R N is the lifting mapping, and ˆ x is the prediction of original system's state x . The lifting mapping Ψ( ) · is defined as

$$\Psi ( x ) = \left [ \psi _ { 1 } ( x ), \$$

where ψ i : R n → R is a scalar function called an observable . Apart from the LLP (2), other forms of lifted predictors were introduced in literature that can have better prediction ability, see Remark 1. However, we focus only on the LLP as it is immediately suited for linear control systems methods.

Remark 1: The predictor can also be in the form of a bilinear system

$$z _ { k + 1 } & = A z _ { k } + ( B z _ { k$$

which can to capture a more complex dynamical behaviors. Another form can be obtained by modifying the LLP (or the bilinear predictor) with the project-and-lift method proposed in [12]. In particular, for LLP (2), the modified version is

$$\begin{array} {$$

Generally, the modified version (5) should have better prediction ability on longer time horizons than the LLP [12]. However, both modifications (4) and (5) lose the linear structure.

## A. Koopman Operator for Autonomous Systems

To rigorously justify the construction of a linear predictor through state-space lifting , we briefly describe the Koopman operator approach for analysis of dynamical systems. Consider a discrete-time dynamical system

$$x ^ { + } = f ( x ) \,,$$

where x, x + ∈ M denote the current state, and the state in the next time step, respectively. Both are defined on some state space M . Instead of directly analyzing the generally nonlinear mapping f , we investigate how functions of the states, the observables , evolve along the trajectories of the system. Formally, an observable is a scalar function ψ : M→ R that belongs to a typically infinite-dimensional space of functions F . The (discrete-time) Koopman operator K : F → F is then defined as

$$( \mathcal { K } \psi ) ( x ) = \psi ( f ( x ) ) = \psi ( x ^ { + } ) \. \quad \ \ ( 7 ) \quad \text{ing}$$

Thus, the Koopman operator K advances the observables ψ ∈ F from the current time step into the next one.

↦

There are two key properties of the Koopman operator. First, if the space of observables F contains the coordinate identity mappings x → x i ( ) for all components i of the state x , the operator fully captures the behavior of the nonlinear system (6). Second, it follows from the definition and the linearity of the addition in the function space that the operator is linear even if T is nonlinear.

Note, however, that the definition (7) requires the space F to be invariant under the action of the operator K . For most systems, this leads to a requirement of the space F to be infinite dimensional - containing infinitely many observables ψ x ( ) -which precludes its use for control synthesis.

There are two ways how the Koopman operator can be linked with the LLP (2). For some systems, one can find an invariant subspace of F spanned by a finite number of observables, while also containing the coordinate identity mappings. The Koopman operator can then be represented by a finite-dimensional matrix, coinciding with the linear system's matrix. Second, more generally applicable option, that we pursue in this paper, is to find a finite approximation to the Koopman operator via the algorithm described in Sec. II-C.

## B. Koopman Operator for Controlled Systems

There are several ways of extending the Koopman operator to controlled systems. For example, in [13], the authors proposed treating a controlled system as an uncontrolled one with the input as system's parameter, see Remark 2.

We follow the extension proposed in [5], that associates a Koopman Operator with the dynamical system that evolves on the extended state space. In particular, consider a controlled system

$$x ^ { + } = f ( x, u ) \,.$$

Let ℓ ( U ) be the space of all infinite input sequences u · = { u i } ∞ i =0 , with u i ∈ U and U being some input-space. We denote the i th component of the sequence as u · ( ) i and S ∗ to be the (left) shift operator, i.e., S ∗ u · ( ) = i u · ( i +1) . By defining an augmented state χ = [ x, u · ] T , we can rewrite the system (8) as

$$\chi ^ { + } = f ^ { \prime } ( \chi ) = \begin{bmatrix} f \left ( x, u _ { \bullet } ( 0 ) \right ) \\ \mathcal { S } ^ { * } u _ { \bullet } \end{bmatrix} \,. \quad \quad \ \ \ ( 9 )$$

Let ψ ′ : M× U → ℓ ( ) R be an observable for the augmented state that belongs to a suitable space of functions H . The Koopman operator K : H → H for the controlled system (9) is then

$$( \mathcal { K } \psi ^ { \prime } ) ( \chi ) = \psi ^ { \prime } ( f ^ { \prime } ( \chi ) ) = \psi ^ { \prime } ( \chi ^ { + } ) \. \quad \ \ ( 1 0 )$$

Constructing a finite-dimensional approximation to the operator K then induces a linear predictor in the form of the system (2).

Remark 2: Instead of a single Koopman operator describing the system's dynamics, a set of Koopman operators are identified. Each Koopman operator (parametrized by the input) then captures the system's behavior for a certain, constant, input.

## C. Extended Dynamic Mode Decomposition with Control

The Extended Dynamic Mode Decomposition (EDMD) presents a simple way to approximate the Koopman operator from data, hence obtaining the LLP. The starting point is to select N observables ψ , . . . , ψ 1 N and form the predictor's state z from the measured state x of the system (1) as

$$z = \Psi ( x ) = [ \psi _ { 1 } ( x ), \psi _ { 2 } ( x ), \dots, \psi _ { n } ( x ) ] ^ { T$$

Next, we gather measured states x i and x + i from the system and form a set of data

$$\dots \dots \dots \dots \dots \dots \dots \\ X & = [ x _ { 1 }, x _ { 2 }, \dots, x _ { N _ { d }$$

where N d is the number of measurements, and the measurements satisfy a relation

$$x _ { i } ^ { + } = f ( x _ { i }, u _ { i } ) \,, \quad \ \ \ \ ( 1 3 ) \quad \ \ \ \ \ \ \ \ \ \ \$$

that we wish to capture with the linear predictor. Note that the states x i forming the set (12) need not be temporally ordered, i.e., the states could be gathered from multiple trajectories. The linear predictor (2) can be then identified by solving

$$\min _ { A, B } & \| Y _ { \text{lift} } - A X _ { \text{lift} } - B U \| _ { F } \, \quad \quad \quad$$

where ∥ ∥ . F denotes a Frobenius norm of a matrix. The solution to (14) can be analytically obtained from

$$\begin{bmatrix} A & B \\ C & 0 \end{bmatrix} = \begin{bmatrix} Y _ { \text{lift} } \\ X \end{bmatrix} \begin{$$

where ( ) . † denotes the Moore-Penrose pseudoinverse of a matrix. Note that when all components of the original state x of the nonlinear system are incorporated in the set of observables, the matrix C can be directly constructed by selecting the corresponding observables from (11).

The convergence of the EDMD to the Koopman operator (7) for autonomous systems was proven in [14]. This proof holds true when both the number of data points and the number of observables go to infinity. However, from the practical point of view, one always works with finite number of both the data and the observables. Additionally, identifying Koopman operator for controlled systems requires, generally, all possible input sequences, which is also unfeasible to obtain.

## D. Control Synthesis with LLP

With identified LLP (2), we can design a feedback controller with classical linear control systems method. In this paper, we use two model-based techniques, a linear quadratic regulator (LQR) and model predictive control (MPC).

1) LQR: The discrete-time LQR minimizes the quadratic cost function

$$J ( z, u ) = \sum _ { k = 0 } ^ { \infty } \left ( z _ { k } ^ { T } Q z _ { k } + u _ { k } ^ { T } R u _ { k } + 2 z _ { k } ^ { T } S u _ { k } \right ) \,, \quad ( 1 6 ) \, \begin{array} { c } \text{LLP b} \\ \text{functi} \\ \text{evaluate} \\ \text{Prol} \end{array}$$

subjected to the system's dynamics (2), and where Q,R,S are cost matrices reflecting the desired control goal. The control law minimizing the cost (16) is

$$u _ { k } = - K z _ { k } = K \Psi ( x _ { k } ) \, \quad \quad \ ( 1 7 )$$

where the feedback gain K can be computed from the solution to the discrete-time algebraic Riccati equation. When the LQR is used for tracking, the control law changes to

$$u _ { k } = - K \left ( \Psi \left ( z _ { k } \right ) - \Psi \left ( z _ { r e f } \right ) \right ) \,. \quad \ \ ( 1 8 ) \, \stackrel { \mathfrak { s m } } { \mathfrak { B } } \,.$$

Remark 3: When using LLP within the LQR framework, the lifted states can serve not only for capturing the system's dynamics more accurately, but also can be directly penalized. The lifted states allow introducing penalization of arbitrary functions of state, extending the quadratic cost (16).

2) MPC: The use of LLP within the MPC is coined as Koopman MPC (KMPC) in [5]. Here, we only state the main formulation and omit the details as they can be found in the referenced literature. At every (discrete) time, the MPC solves the following optimization problem on the time horizon N p

$$\text{ded}, \quad \text{horizon} \, N _ { p } \, \begin{array} { c c c } \cdot \\ \text{tories} \, \\ \text{ving} \quad & \min _ { u _ { k }, z _ { k } } \, J \left ( \{ z _ { k } \} _ { k = 0 } ^ { N _ { p } } \,, \{ u _ { k } \} _ { k = 0 } ^ { N _ { p } } \right ) \,, \\ \text{subject to} \quad & z _ { k + 1 } = A z _ { k } + B u _ { k } \,, \quad k = 0, 1, \dots, N _ { p } - 1 \,, \\ ( 14 ) \end{array} \, \begin{array} { c c c } e _ { k } = r _ { k } - C z _ { k } \,, \\ e _ { k } = r _ { k } - C z _ { k } \,, \\ e _ { \min } \leq z _ { k } \leq z _ { \max } \,, \\ \cdot \, \text{The} \quad & u _ { \min } \leq u _ { k } \leq u _ { \max } \,, \\ \text{parameters} \quad & z _ { 0 } = \Psi ( x _ { t } ) \,, \\ ( 15 ) \end{array} \, \begin{array} { c c c } r _ { k } = \text{given} \,, \quad k = 0, 1, \dots, N _ { p } \,, \\ \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad & \text{and} \quad \\ \end{array}$$

where u min max / are bounds on inputs, z min max / are bound on lifted states, and r k is the reference signal. Only the first element of the optimal sequence u 0 is used, and the optimization problem is solved again in the next time step. The cost function J is

$$\text{era-} \text{This} \underset { \text{raw-} } { \text{era-} } J ( z, u ) = e _ { N _ { p } } ^ { \text{ } } Q _ { N } e _ { N _ { p } } + \sum _ { k = 0 } ^ { N _ { p } - 1 } \left ( e _ { k } ^ { \text{ } } Q e _ { k } + u _ { k } ^ { \text{ } } R u _ { k } \right ) \. \ \ ( 2 0 )$$

## III. PRACTICAL GUIDELINES

This section presents some key and less intuitive practical guidelines for identification of LLPs using the EDMD algorithm. We support the guidelines with several motivating examples in Sec. IV.

## A. Select Appropriate Metric to Assess Predictors Effectively

As for any data-driven method, it is important to evaluate the accuracy of the obtained model. In the following subsection, we define and discuss different metrics for assessing the performance of LLPs. Let D = ( x , x i + i , u i ) , i = 1 , . . . N d be a dataset of samples from evaluation trajectories, and let the LLP be given by the matrix triplet A,B,C and the lifting function Ψ . We argue that the type of error selected for evaluation, depends on the purpose of the LLP.

Probably the most natural option would be to evaluate the error

$$\intertext { m } \epsilon _ { \text{project} } = \frac { 1 } { N _ { d } } \sum _ { i = 1 } ^ { N _ { d } } \| x _ { i } ^ { + } - C ( A \Psi ( x _ { i } ) + B u _ { i } ) \| \,, \quad ( 2 1 )$$

where ∥ ∥ . is the 2-norm. The error (21) reflects how the LLP predicts time evolution of the system's original states, excluding the lifted states. However, note that the error (21) is not directly minimized by the EDMD algorithm (see Eq. (14)). In particular, the EDMD finds the LLP that minimizes the error in prediction of the full lifted state , that is

$$\mathbf r y \quad \epsilon _ { \text{lfd} } = \frac { 1 } { N _ { \mathrm d } } \sum _ { i = 1 } ^ { N _ { \mathrm d } } \| \Psi ( x _ { i } ^ { + } ) - \left ( A \Psi ( x _ { i } ) + B u _ { i } \right ) \| \,. \quad ( 2 2 )$$

Therefore, while adding more identification data or more observables should theoretically result in lower ϵ lifted , the error ϵ projected reflecting the prediction accuracy of relevant variables might be worse as the EDMD could prioritize capturing the lifted states. In other words, the EDMD does not explicitly guarantee minimization of the error (21) so also the error (22) should be taken into account in the identification process.

Lastly, for some control methods, especially the MPC, more important is to evaluate the LLP's ability to predict systems' trajectory on a certain time horizon with a length N p . Consider a trajectory with an initial state x 0 , the input sequence { u i } N p -1 0 , and corresponding output sequence { x k } N p 0 satisfying the relation (1). We define the prediction error as

$$\epsilon _ { \text{prediction} } = \frac { 1 } { N _ { d } } \sum _ { i = 0 } ^ { N _ { d } } \sum _ { k = 0 } ^ { N _ { p } - 1 } \| x _ { k + 1 } - C ( A \Psi ( x _ { k } ) + B u _ { k } ) \| ^ { 2 } \,. \quad \ D. \ I n s l \\ \text{Convariant the matrix can be used to collect the length of the } \text{$diff$}$$

Moreover, the metric can be used to select the length of the prediction horizon N p of the MPC.

Remark 4: An important step in assessing LLP's accuracy is taking into account different scales of state variables. For example, all states can be scaled into an interval ⟨-1 1 , ⟩ or the errors themselves otherwise normalized.

## B. Carefully Choose Lifting Functions

Following the EDMD algorithm, the first and the most challenging step in the identification process is selection of the observables ψ i . As explained in Sec. II-A, the aim is at approximating the Koopman operator on some finitedimensional function space. Typically, a basis of such space is selected.

In [15], the authors proposed using higher order derivatives of the underlying nonlinear dynamics, motivated by choice of lifting functions for polynomial systems. Delay embeddings are another option, allowing to reconstruct the system's state from the system's output, which can be useful when only sparse measurements are available [8]. The set of observables could also result from optimization problem, as proposed in [16], exploiting the system dynamics and the state-space geometry.

Generally, we should aim to choose observables that accurately represent the problem's dynamics, focusing on those that capture well the manifold on which the system evolves. Prioritizing few specific problem-related observables over a general function space basis can often yield superior results sometimes, less is more .

Another approach presented, e.g., in [17] is using a neural network as a lifting function. This approach is based on learning the eigenfunctions of the Koopman operator which then yield the LLP.

## C. Identify LLPs with Data Similar to Intended Closed-Loop Trajectories

The next step in identification is collecting the data. Generally, it is not feasible, nor desired to sample the data from the whole state space. In [6], authors illustrate the importance of the identification data for the Duffing Oscillator , a system with three equilibria. Based on the Koopman operator analysis of the system for controlled systems, it is important to choose representative both the control sequences and the system's trajectories. Thus, the data should be ideally sampled from the trajectories that represent the final closed-loop trajectories. Therefore, it is advantageous to identify an input that closely approximates the final closed-loop input and subsequently - as he samples should be independent and identically distributed (i.i.d.) -utilize a randomized signal that closely resembles it. Note that using only closed-loop data could cause problems, as the feedback creates correlation between unmeasurable noise (in system's output) and the system's input, see [18] for details.

## D. Inspect Identified Predictors

While the LLP can be perceived only as a black box , predicting system dynamics with adequate accuracy, its quality can be substantially enhanced through careful inspection and subsequent adjustment of the identification process. For example, as the EDMD algorithm is purely data-driven, the identification can result in a LLP that allows non-physical coupling between the states. Also, the stability of the system (or system's equilibria) might not be preserved. Finally, when the number of selected observables is significantly higher than the original system's order ( N ≫ n ), a low-dimensional approximation to the LLP can be created. Such an approximation may be necessary for certain control synthesis methods. Details on order reduction methods in context of EDMD can be found, e.g., in [19].

## IV. MOTIVATED EXAMPLES OF LLP IDENTIFICATION AND APPLICATION FOR CONTROL

In this section, we apply the method described in Sec. II to obtain LLP for several systems. The whole method consists of acquiring data, selection of observables, evaluation of the LLP, and lastly, control design with control evaluation. For the sake of brevity, we omit some details in control design as the main focus is on LLP identification, rather than the control synthesis. The details can be found in the provided code.

In all examples, the systems are numerically integrated using the 4th order Runge-Kutta algorithm with an integration step T s = 0 01 s . . We first present a correct solution, and then we introduce some pathologies into the process to highlight the importance of some aspects, motivating our guidelines. Note that our aim is not to present the best solution to the particular problem. Rather, the examples serve to show the intricacies in LLP identification.

## A. Swing-up of Inverted Pendulum

Consider a damped pendulum, driven by a torque u , and with the system's origin x e shifted into the unstable equilibrium - the upward position. Let φ and ω be pendulum's angle and the angular velocity, respectively. The system's model is

$$\dot { x } = \begin{bmatrix} \dot { \varphi } \\ \dot { \omega } \end{bmatrix} = \begin{bmatrix} \omega \\ \frac { q } { l } \sin ( \varphi ) - \frac { \gamma } { m l ^ { 2 } } \omega + \frac { 1 } { m l ^ { 2 } } u \end{bmatrix} \,, \quad ( 2 4 )$$

where g is the gravity, γ is the damping coefficient, and m l , are the pendulum's mass and length, respectively. Both states, φ and ω , are measured.

We aim to design controller that achieves the swing-up task, i.e., driving the system from a state x = [ π, 0] T (the downward position) into the state x e = [0 0] , T (the upward position). Since we do not consider limits on the input u , the task can be simply achieved by LQR with local linearization at x e . We wish to identify LLP to design a controller with better performance.

We gather the identification data from closed-loop trajectories, using a proportional control law u = -k φ p . To obtain rich dataset, each trajectory is initialized in a random state while also the gain k p is randomized. Additionally, the closed-loop input is perturbed by a random signal. In total, we collect 2100 trajectories from which we use 100 trajectories for evaluation only. Each trajectory was 0 5 s . in length. As the observables, we select the original states together with single additional function, so the lifting function is

$$\Psi ( x ) = \left [ \varphi, \omega, \sin \left ( \varphi \right ) \right ] ^ { \intercal }. \text{ \quad \ \ } \text{(2.5)}$$

This is an example of problem-specific lifting, motivated by the sine function's presence in system's dynamics (24).

Then, we devise an LQR controller using the LLP, and for comparison, another LQR controller based on local linearization around the system's origin, referred to as a local predictor . The Fig. 1 shows a phase-portrait with training trajectories together with LQR closed-loop trajectories using two linear models. We can see that the lifted predictor exhibits superior performance, even when the penalty matrices Q and R of both LQRs are the same.

1) Pathology #1: Collecting Identification Data: To collect identification data, an alternative option to the closedloop input might be using (pseudo) random signal. We also present three different choices of initial states for the data: initialization near the stable equilibrium, near the unstable equilibrium, and uniformly distributed in the interval φ 0 = ( -π, π ) . The phase portraits of the identification data are displayed in Fig. 2. In the bottom part of the figure, we then compare the closed-loop control. We can see, that only the first option of sampling results in a successful swingup (albeit worse than local linearization), while the other two options fail. The main challenge of this task is that the swing-up-achieving trajectory contains two equilibria. This is a problem, as a linear system cannot have two or more isolated equilibria.

While sampling the portion of the state space in an open loop may lead to a satisfactory behavior, the perturbed closed-loop data present more straightforward option.

2) Pathology #2: Choice of Lifting Functions: In the spirit of the Koopman operator, we can try to obtain better representation of the system's dynamics by introducing more

Fig. 1: The figure's right part displays the phase portrait of training trajectories for the swing-up task, together with comparison of closed-loop performances. On the left are time series.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-1712335b-2362-4f11-8167-afe5d96e89b4.jpg)

Fig. 2: Three examples of non-representative identification data for the swing-up task. In the figure's top part are the phase portraits of identification data, at the bottom are comparisons of closed-loop performances

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-f42a3469-dc13-4b78-9150-33adea2da52d.jpg)

lifting function, hence to better approximate the Koopman operator. We consider three additional options, differing in the basis functions: the polynomial basis, thin plate splines radial basis functions (TPS-RBF), and Gaussian RBF. For each option, the lifting function Ψ( ) x consists of the original states φ and ω , and then additional 100 observables

$$\psi _ { i } ^ { \text{TPS} } & = \| \varphi - a _ { i } \| ^ { 2 } \log \| \varphi - a _ { i } \| \, \\ \psi _ { i } ^ { \text{pol} } & = \varphi ^ { ( i - 1 ) } \, \\ \psi _ { i } ^ { \text{gauss} } & = \exp \left ( - ( \varphi - b _ { i } ) ^ { 2 } / ( 2 c _ { i } ^ { 2 } ) \right ) \, \\ \.$$

where the parameters a , b , c i i i , i = 1 , . . . , 100 were sampled randomly.

The comparison of the predictors in shown in Fig. 3. To assess the accuracy of the predictors, we first compare (in logarithmic scale) all the metrics introduced in Sec. III-A. We also show a comparison of predictors' ability to capture

Fig. 3: Comparison of different lifting functions. The figure, from top to bottom, shows the comparison of evaluated errors (in the logarithmic scale), prediction on a finite horizon, and the time series of the closed-loop control

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-2dc938a3-cafd-4876-b5b7-b9e98bb99586.jpg)

Fig. 4: Wheeled Balancing Robot

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-16a6b736-d407-4684-b12e-a3455932a8da.jpg)

a single trajectory, given its initial state and the sequence of inputs. Lastly, we show the closed-loop performance.

An interesting observation is that while the projected errors ϵ projected of the predictors with many observables are better than the error of the local or the sine predictors, the resulting control is significantly worse. We found that when using LLP for designing LQR, the most relevant metric appears to be the ϵ lifted since the feedback law (17) generally uses values of all lifted states z , even though the lifted states are not directly penalized.

## B. Two-wheeled Inverted Pendulum Balancing Robot

We consider a system depicted in Fig. 4, a two-wheeled balancing robot moving on a flat surface with three degrees of freedom: the traveled distance s , tilt angle φ , and yaw angle χ . Let q = [ s, φ, χ ] T be the vector of generalized coordinates, and u = [ u , u 1 2 ] T be the system's input - torques applied on the wheels. The robot's dynamics (see [20] for

Fig. 5: Comparison of closed-loop performances of MPC based on a local predictor or on the identified LLP. The MPC with local predictor fails to stabilize the system around t = 7s

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-3d74f683-849c-42c8-8b42-c6aa61b67820.jpg)

full derivations) can be described by the equation

$$\dot { q } = M ( q ) ^ { - 1 } \left ( B u - C ( q, \dot { q } ) \dot { q } - D \dot { q } - G ( q ) \right ) \,, \quad ( 2 7 )$$

where M q ( ) , C q, q ( ˙) , D , G q ( ) , B are inertia, Coriolis, dissipation, gravity, and input matrices, respectively. The goal is maintaining the robot in the upward position while allowing to track a reference on the travel speed ˙ s ref and the yaw rate ˙ χ ref . To address the task, we identify the LLP and use the predictor within the MPC.

We gather the identification and verification data from closed-loop trajectories. To this end, we designed a LQR controller stabilizing the system to the equilibrium in the origin. The LQR design was based on a local linearization of the system (27) about the system's origin. In total, we gathered 2000 trajectories, where the half was used for identification, and the rest for validation. Each trajectory was initialized with randomized coordinates q . We selected the references s ref and χ ref to be sinusoidal with randomized amplitude.

Let the system's state be x = [ ˙ q, q ] T . We select the lifting function for LLP as

$$\Psi ( x ) = \left [ \dot { s }, \dot { \varphi }, \dot { \chi }, \varphi, \sin ( \varphi ) \right ] ^ { \intercal }. \text{ \quad \ \ } ( 2 8 )$$

That is, we omit the states s and χ as they should not, by the assumption, affect the system's dynamics, i.e., the dynamics should be invariant w.r.t the travelled distance s and the yaw χ . Also, if needed, both states can be numerically recovered from their derivatives. We add the observable ψ x ( ) = sin( φ ) to capture the pendulum-like motion of the robot.

We designed two MPC controllers, one based on local linearization, and one based on identified LLP. The Fig. 5 shows a comparison of the closed-loop performances. The MPC with LLP exhibits better performance as the Local linearization fails to stabilize the system. Even with only

Fig. 6: Demonstration of how non-physical coupling between the states affect the control performance. Shown are two trajectories, initialized in different distance s 0

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-4dcf0544-fc0c-48e0-a298-bd81c3ae297a.jpg)

Fig. 7: Heatmaps of the system's matrices A local and A LLP showing non-physical coupling between the states for lifted predictor

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01116v1-figure-f007b16f-1a0a-4ff2-ae0d-da4854056903.jpg)

one extra lifting function, the prediction error (23) of the LLP was better by ≈ 20 % than the local linearization.

- 1) Pathology #1: Non-physical State Coupling: Let us now identify a LLP for the system (27) with a lifting function that includes all the robot's states

$$\Psi ( x ) = [ \dot { s }, \dot { \varphi }, \dot { \chi }, s, \varphi, \chi, \sin \varphi ] ^ { T } \,. \quad \quad ( 2 9 ) \quad \ \ \ ]$$

We repeat the whole process. The Fig. 6 shows the closedloop performance of KMPC for the system initialized in two different initial states, differing in the initial distance s 0 .

When the system is initialized with s 0 = 0 , the performance is comparable to the previous case with the lifting function (28). However, when the system is initialized with s 0 = 100 , which should not influence the system, the controller fails to stabilize the system. To gain an insight into this behavior, let us examine the identified system matrix A LLP of the LLP and compare it with a system matrix A local obtained from local predictor, see Fig. 7.

As evident from the A LLP matrix, there exists significant coupling between s , χ , and the remaining states. As previously noted, the system's dynamics are expected to remain invariant with respect to both the traveled distance s and yaw rate χ . The LLP resulting from the EDMD is not imposing such constraints on the resulting model.

## V. CONCLUSION

This paper introduced practical guidelines for utilizing EDMD in the identification of control-oriented lifted linear predictors. We have demonstrated a range of challenges that may arise when employing EDMD for LLP identification, along with strategies to address them. Our future efforts will concentrate on expanding this set of guidelines to establish a comprehensive methodology for LLP identification.

## REFERENCES

- [1] Koopman BO. Hamiltonian Systems and Transformation in Hilbert Space. Proceedings of the National Academy of Sciences. 1931 May;17(5):315-318. Publisher: Proceedings of the National Academy of Sciences.
- [2] Koopman BO, Neumann Jv. Dynamical Systems of Continuous Spectra. Proceedings of the National Academy of Sciences. 1932 Mar;18(3):255-263. Publisher: Proceedings of the National Academy of Sciences.
- [3] Mezi´ c I, Banaszuk A. Comparison of systems with complex behavior. Physica D: Nonlinear Phenomena. 2004 Oct;197(1):101-133.
- [4] Mezi´ c I. Spectral Properties of Dynamical Systems, Model Reduction and Decompositions. Nonlinear Dynamics. 2005 Aug;41(1):309-325.
- [5] Korda M, Mezi´ c I. Linear predictors for nonlinear dynamical systems: Koopman operator meets model predictive control. Automatica. 2018 Jul;93:149-160.
- [6] Brunton SL, Budiˇ si´ c M, Kaiser E, Kutz JN. Modern Koopman Theory for Dynamical Systems. SIAM Review. 2022 May;64(2):229-340. Publisher: Society for Industrial and Applied Mathematics.
- [7] Williams MO, Hemati MS, Dawson STM, Kevrekidis IG, Rowley CW. Extending Data-Driven Koopman Analysis to Actuated Systems. IFAC-PapersOnLine. 2016 Jan;49(18):704-709.
- [8] Arbabi H, Korda M, Mezi´ c I. A Data-Driven Koopman Model Predictive Control Framework for Nonlinear Partial Differential Equations. In: 2018 IEEE Conference on Decision and Control (CDC); 2018. p. 6409-6414.
- [9] Korda M, Susuki Y, Mezi´ c I. Power grid transient stabilization using Koopman model predictive control. IFAC-PapersOnLine. 2018 Jan;51(28):297-302.
- [10] Do L, Korda M, Hur´ ak Z. Controlled synchronization of coupled pendulums by Koopman Model Predictive Control. Control Engineering Practice. 2023 Oct;139:105629.
- [11] Budiˇ si´ c M, Mohr RM, Mezi´ c I. Applied Koopmanism. Chaos: An Interdisciplinary Journal of Nonlinear Science. 2012 Dec;22(4):047510.
- [12] N¨ uske F, Peitz S, Philipp F, Schaller M, Worthmann K. Finite-Data Error Bounds for Koopman-Based Prediction and Control. Journal of Nonlinear Science. 2022 Nov;33(1):14.
- [13] Peitz S, Otto SE, Rowley CW. Data-Driven Model Predictive Control using Interpolated Koopman Generators. SIAM Journal on Applied Dynamical Systems. 2020 Jan;19(3):2162-2193. Publisher: Society for Industrial and Applied Mathematics.
- [14] Korda M, Mezi´ c I. On Convergence of Extended Dynamic Mode Decomposition to the Koopman Operator. Journal of Nonlinear Science. 2018 Apr;28(2):687-710.
- [15] Mamakoukas G, Castano M, Tan X, Murphey T. Local Koopman Operators for Data-Driven Control of Robotic Systems. Robotics: science and systems. 2019 Jun.
- [16] Korda M, Mezi´ c I. Optimal Construction of Koopman Eigenfunctions for Prediction and Control. IEEE Transactions on Automatic Control. 2020 Dec;65(12):5114-5129.
- [17] Lusch B, Kutz JN, Brunton SL. Deep learning for universal linear embeddings of nonlinear dynamics. Nature Communications. 2018 Nov;9(1):4950. Number: 1 Publisher: Nature Publishing Group.
- [18] Forssell U, Ljung L. Closed-loop identification revisited. Automatica. 1999 Jul;35(7):1215-1241.
- [19] Brunton SL, Kutz JN. Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control. Cambridge University Press; 2022. Google-Books-ID: rxNkEAAAQBAJ.
- [20] Kim S, Kwon S. Dynamic modeling of a two-wheeled inverted pendulum balancing mobile robot. International Journal of Control, Automation and Systems. 2015 Aug;13(4):926-933.
Loi Do Adam Uchytil Zdeněk Hurák
Practical Guidelines for Data-driven Identification of Lifted Linear Predictors for Control
Lifted linear predictor (LLP) is an artificial linear dynamical system
designed to predict trajectories of a generally nonlinear dynamical system
based on the current state (or measurements) and the input. The main benefit of
the LLP is its potential ability to capture the nonlinear system's dynamics
with precision superior to other linearization techniques, such as local
linearization about the operation point. The idea of lifting is supported by
the theory of Koopman Operators. For LLP identification, we focus on the
data-driven method based on the extended dynamic mode decomposition (EDMD)
algorithm. However, while the EDMD algorithm presents an extremely simple and
efficient way to obtain the LLP, it can also yield poor results. In this paper,
we present some less intuitive practical guidelines for data-driven
identification of the LLPs, aiming at improving usability of LLPs for designing
control. We support the guidelines with two motivating examples. The
implementation of the examples are shared on a public repository.