{'fraction_non_alphanumeric': 0.02093950808774651, 'fraction_numerical': 0.0042100598271659646, 'mean_word_length': 4.72202852614897, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learned Lifted Linearization Applied to Unstable Dynamic Systems Enabled by Koopman Direct Encoding

This paper presents a Koopman lifting linearization method that is applicable to nonlinear dynamical systems having both stable and unstable regions. It is known that DMD and other standard data-driven methods face a fundamental difficulty in constructing a Koopman model when applied to unstable systems. Here we solve the problem by incorporating knowledge about a nonlinear state equation with a learning method for finding an effective set of observables. In a lifted space, stable and unstable regions are separated into independent subspaces. Based on this property, we propose to find effective observables through neural net training where training data are separated into stable and unstable trajectories. The resultant learned observables are used for constructing a linear state transition matrix using method known as Direct Encoding, which transforms the nonlinear state equation to a state transition matrix through inner product computations with the observables. The proposed method shows a dramatic improvement over existing DMD and data-driven methods.


I. INTRODUCTION
Lifting linearization methods, such as those based on the Koopman Operator, have been used to transform nonlinear systems to linear models that predict the underlying model with high accuracy. The theoretical basis for the Koopman Operator is a guarantee of accuracy in modeling a nonlinear system as a linear model as the order of the lifted linear model approaches infinity, though some nonlinear systems have finite order linear representations in lifted space [1], [2]. The Koopman Operator models are generally constructed through data-driven methods such as Extended Dynamic Mode Decomposition (EDMD) [3].
A key component necessary to constructing a Koopman Operator-based linear model is selection of the augmented state space, through observable functions. Prior work has studied the use of various function families as observables, such as polynomial basis functions, radial basis functions and time delays [4]- [6] . There have also been formulas created for algorithmically determining useful observables based on the dataset [7], [8]. Modern machine learning techniques have also been applied to learn observable functions [9]- [11].
However, it can be difficult to formulate accurate approximations of the Koopman Operator for nonlinear systems This material is based upon work supported by National Science Foundation Grant NSF-CMMI 2021625. 1  that produce both stable and unstable trajectories. When concerned with only the stable regions of a nonlinear system, methods have been developed to construct stable Koopman models [12]- [15]. These works provide methods to construct stable Koopman models from a Koopman model with unstable poles for a system that is known to be stable. However, these methods are undesirable when needing to predict stable trajectories while in the presence of an unstable region. A key difficulty is the nature of capturing a representative dataset for such a system. Because of the nature of unstable trajectories, a bias towards the unstable modes can often occur when creating the Koopman model. Prior work discusses the potential for Koopman Operator models to describe unstable subspaces [1]. The authors hypothesize that if a Koopman Operator model can be found for a nonlinear system possessing both stable and unstable subspaces, then the subspaces can be learned separately and superimposed to generate an accurate model. In addition to this improved accuracy, the emergence of a boundary between these subspaces may form when analyzing the Koopman Operator Model using modal decomposition, which can be difficult to do for Koopman Operator Models that are composed of the standard independent basis functions mentioned prior.
The paper will be structured as follows. In Section II, we describe the fundamentals of creating a linear model based on Koopman Operator theory. Afterwards, we propose and describe an approach for training neural networks to generate observables aimed at the specific problem of modeling specific modes in Section III. Section IV outlines the details of experiments conducted and visualizations of results. Afterwards, Section V provides remarks and commentary on the results of the prior section. We give concluding thoughts in section VI.

II. KOOPMAN DIRECT ENCODING OF NONLINEAR DYNAMICS
In this section, we give a brief overview of the Koopman Operator and introduce the direct encoding method for obtaining a Koopman operator directly from nonlinear dynamics.
Consider a discrete-time dynamical system, given by where x ∈ R n is the independent state variable vector representing the system, f is a nonlinear function f : R n → R n , and k is the current time step. Also consider a real-valued observable function of the state variables g : R n → R. The Koopman Operator is an infinite-dimensional linear operator acting on the observable function g : where the Koopman operator K is linear, even though the dynamic system is nonlinear. Although the original Koopman Operator is infinite dimensional, effective methods have been established for approximating the operator [16]- [18].
Our prior work has demonstrated the ability to directly encode the Koopman Operator from the system of equations that govern the dynamic system. An abbreviated formulation is written here, while the full proof can be found in [19].
Beginning with a discrete-time autonomous dynamical system given by equation 1 we can easily demonstrate In the formulation of the Koopman Operator, the observable function g exist in a Hilbert space on X ⊂ R n , H.
There is a set of orthonormal basis functions [φ 1 , φ 2 , φ 3 , ...] that span H. Because the function g is part of a Hilbert space and there is a set of basis functions that span H, we can then describe g • f as an inner product on the domain of X.
where κ : X × X → C is a kernel that can be written as Given this representation of individual observable functions as a linear combination of orthonormal basis functions, it can be shown that if then there also exists a state transition matrix A that maps the lifted state from one time step to the next. That is where The state transition A is given by inner products of the observable functions, orthonormal basis functions, and compositions of the orthonormal basis functions with the time transition functions. Specifically However, it is not necessary to rely on orthonormal basis functions so long as g i belong to a complete an independent set of functions that exist in H and the composition of g i with f (x) also form an independent set of functions that exist in H. If this holds, then the state transition can instead be given as Notably, these inner products can be approximated by discretizing the domain of the state space and calculating a finite summation rather than analytically evaluating the integral for the entire domain.

III. SUBSPACE TRAINING METHOD
While Direct Encoding method described above can provide the exact linear model with matrix A from a nonlinear state equation, it requires a significantly large number of independent observables to obtain an accurate model. This manifests the need for finding a more effective set of observables that can produce a lower order approximation.
The current work uses neural networks to find an effective set of observables, and applies the Direct Encoding method with them. This method is underpinned by a basic property of the Koopman Operator theory. If a Koopman Operator model can be constructed for a nonlinear system, then the system can be represented by where χ is a state vector in a lifted space. This linear system can be separated into its individual modes using eigendecomposition where V, D, and W are the eigendecomposition of A, and the subscripts u, m, and s represent unstable, marginally stable, and stable subspaces and χ represents the lifted state vector. However, when represented in the state space of the original nonlinear system, these subspaces may be not as simple to find the boundaries in between.
While prior art addresses the circumstances where it is known that the underlying nonlinear system is stable, either in the sense of Lyapunov or otherwise, this circumstance is not general. The current work is based on linear system theory that allows for the separation of a system's domain into different subspaces. The training method, summarized in Fig 1, assumes that while the underlying system has unknown characteristics, the trajectory data obtained from the system can be separated into two categories: stable/marginally stable, and unstable. Specifically, an aggregate dataset is comprised of initial states X k and the states at one time step ahead X k+1 . This can then be organized into for both X k and X k+1 . These subsets of data are used to train corresponding neural networks G u (x i ; θ i ) and G s (x i ; θ i ) and the weights of linear output layers A s and A u . The function of the neural networks is to produce observables of a given state, that is and where * can be replaced with s or u, representing the specific subset of data, and χ is the lifted state represented by The loss function utilized in training all models is After the training of these networks is completed with the trajectory dataset, the weights for the neural networks G u and G s no longer are updated. We then utilize the Direct Encoding method to produce a new estimation for the output layer. This new regression is computed by creating a new lifted state through concatenating the observable functions of each network with the state vector The observable functions produced by these networks are then concatenated as shown in Fig. 2. This new regression is done utilizing the Direct Encoding method. Let g i (x; θ i ) be the i-th observable in the form of a neural network with parameters θ i . The inner product comprising the matrix R is give by Similarly, Note that simulation data are used only for finding effective observables and not for obtaining the state transition A matrix. The A matrix is obtained from the Direct Encoding method by using the neural net observables as shown in the above equation. Algorithm 1 summarizes this procedure, referred to in latter sections as the Joint Model, as it joins together two neural network models constructed from separate datasets.
Algorithm 1: Training scheme for the prediction models. Notation is explained in Table I. Input: Parameters: (weight variables); Output: G u : g u ; G s : g s ; G joint : g joint F u :ẑ u k+1 ; F s :ẑ s k+1 ; F j :ẑ j k+1 for number of epochs do Sample x * from X * Generate observable function vector g * Append state vector to observable vector z * = x * ⊕ g * Estimate augmented output through linear activation F * (z * k ) Forward pass through MSE Loss function L(z,ẑ); Backward pass: update parameters for observable functions (W u , W s ); end then Calculate augmented input g u k and g s k for x k DE X DE for all X DE Append augmented inputs z k DE = x k DE ⊕ g u k ⊕ g s k Calculate augmented output g u k+1 and g s k+1 for

IV. EXPERIMENTS
The models are created using Pytorch. The computer creating these models has a AMD Ryzen 7 3700X 8-Core Processor 3.60 GHz, and a NVIDIA GeForce GTX 1060 3GB Graphics Card. Each neural network model has 16 units in the hidden layer. In the case of 40 observables, the Joint Model has 20 observables for both stable and unstable regions. In the case of 80 observables, the division is done similarly. In addition to these observable functions, the original state variables are included as part of the model as well. Hyperparameters were equivalent between models. EDMD models are constructed to be of equivalent order to the Joint Model and Aggregate Model. The EDMD model's observables are radial basis functions that are uniformly distributed for individual states between minimum and maximum value for that state in the dataset. These radial basis functions are of the form where α is a parameter that was set to equal 1 for all state variables and x i is the ith state variable, and x ia is the center of the radial basis function. We introduce a second order nonlinear system: This system has effectively two regions, a stable region and an unstable region, visualized with a collection of trajectories in Fig. 3.

A. Prediction Error
The prediction error for this system is calculated separately for stable and unstable region time series trajectories with initial conditions not included for either Direct Encoding nor the aggregate trajectory dataset. The equation used for prediction error is sum of squared error for the state variables, not including observables of the system. That is  where i is the ith state variable for a given time step. The estimated state variable,x, is the prediction from the model, where the ground truth is denoted as x. This prediction error is not of the total lifted state, but of the state variables belonging to the original nonlinear system which are shared between all models. The prediction error is visualized in the set of figures, Fig. 4(a) and (b). The two figures compare the Joint Model with Direct Encoding with other learned models. Further comparisons are outlined in Table II. The best performing result of the labeled order for each subspace is in bold.

B. Subspace Boundary Formation
Finding the boundary between stable and unstable regions is important for analyzing nonlinear dynamics. Here we compare each modeling method in terms of the accuracy in finding the boundary. Consider the following quotient: where If χ is in a stable region and the matrix W u spanning the unstable region is accurate, then the quotient ξ must be 0. On the other hand, if W u is inaccurate, then some fraction of the component will enter the stable region with non-zero ξ. Fig  3 shows the plots of this quotient indicating how accurately the true boundary is recreated.

V. DISCUSSION
When the observables from the two separate networks are concatenated into the proposed architecture, there is a significant difference in the prediction error over multiple time steps as shown in Fig. 4. Specifically, the stable region is predicted most accurately utilizing the Joint Model with Direct Encoding. The one step prediction error is comparable if not outperforming the Aggregate Model with Direct Encoding, as observed from Table II. However, this model is also demonstrably worse at calculating the unstable region for longer prediction horizons when compared to the Aggregate Model with Direct Encoding.
When observing Table II, it is notable that the prediction error does not necessarily improve with increases in order of the system. This can be explained as the tabulated results are prediction errors of the state variables, which are shared across all models. As the order of the systems increase, a least squares estimation would weight the prediction error of the state variables similarly to the observable functions used. Considering this, the additional observables may detract from the desire to accurately predict the state variables for a significant time horizon.
The Direct Encoding method drastically lowers the prediction error of the models. The nature of the method is that it removes any biases from over-or undersampling of a region, and thus it is expected to have a pronounced effect when compared to a Koopman model learned on a trajectory dataset which naturally has unbalanced proportions of data. In the cases shown, the Direct Encoding method lowers the prediction error by several orders of magnitude, both in Fig.  4 and Table II. From the table results, the Direct Encoding method is demonstrated to have a significant impact even with increases in order of the system. This result clearly demonstrates the usefulness of possessing knowledge of the underlying nonlinear model when creating a Koopman model as it allows these deep learning methods to be viable in producing the Koopman model.
Because the prediction models used are finite order approximations of the Koopman operator, we expect inaccuracies to arise when using these models to locate boundaries between regions. For that reason, the instability quotient is introduced. Assuming complete separation of dynamic modes, the ratio of unstable projection to state vector (instability quotient) should be 0 for the stable region, and 1 for the unstable region, as shown in plot (a) of Fig. 5. However, due to the approximation of the system as a linear system, this discrete switch becomes blurred, depending on the accuracy of the model which is shown in the other plots. The Joint Model with Direct Encoding demonstrates that the instability quotient increases significantly in the unstable region. This does not occur for the other models. This indicates that the observables learned for the Joint Model are effective for their specific subspaces, though this result is not strictly enforced in the training of the system. The Direct Encoding method is also key in this result as it demonstrates a drastic change in the dynamic model.

VI. CONCLUSION
In this paper, we presented a method for learning the lifted model of nonlinear dynamic systems that utilizes neural networks to learn subspaces of a dynamic system and update the model in an unbiased fashion with the aid of the dynamic system. This method was shown to improve accuracy given certain conditions. Separately, the method was demonstrated to have the potential to be used as an analysis tool for finding borders between regions analytically regardless of the nature of the models as approximations for the true underlying system. The work has a clear direction for improvement; the current network structure and training does not enable the subspaces to be fully separated as the observable functions learned are not zero outside of their respective regions. This would be a notable direction to explore in the future to further improve results.