Package: autokoopman
AutoKoopmanOverviewAutoKoopman is a high-level system identification tool that automatically optimizes all hyper-parameters to estimate accurate system models with globally linearized representations. Implemented as a python library under shared class interfaces, AutoKoopman uses a collection of Koopman-based algorithms centered on conventional dynamic mode decomposition and deep learning. Koopman theory relies on embedding system states toobservables; AutoKoopman provides major types of static observables.The library supportsDiscrete-Time and Continuous-Time System IdentificationExtended Dynamic Mode Decomposition (EDMD)[Williams et al.]Deep Koopman[Li et al.]SINDy[Brunton et al.]Static ObservablesRandom Fourier Features[Bak et al.]PolynomialNeural Network[Li et al.]System Identification with Input and ControlKoopman with Input and Control (KIC)[Proctor et al.]Online (Streaming) System IdentificationOnline DMD[Zhang et al.]Hyperparameter OptimizationRandom SearchGrid SearchBayesian OptimizationUse CasesThe library is intended for a systems engineer / researcher who wishes to leverage data-driven dynamical systems techniques. The user may have measurements of their system with no prior model.Prediction:Predict the evolution of a system over long time horizonsControl:Synthesize control signals that achieve desired closed-loop behaviors and are optimal with respect to some objective.Verification:Prove or falsify the safety requirements of a system.InstallationThe module is published onPyPI. It requires python 3.8 or higher. With pip installed, runpipinstallautokoopmanat the repo root. Runpython-c"import autokoopman"to ensure that the module can be imported.ExamplesA Complete ExampleAutoKoopman has a convenience functionauto_koopmanthat can learn dynamical systems from data in one call, given
training data of trajectories (list of arrays),importmatplotlib.pyplotaspltimportnumpyasnp# this is the convenience functionfromautokoopmanimportauto_koopmannp.random.seed(20)# for a complete example, let's create an example dataset using an included benchmark systemimportautokoopman.benchmark.fhnasfhnfhn=fhn.FitzHughNagumo()training_data=fhn.solve_ivps(initial_states=np.random.uniform(low=-2.0,high=2.0,size=(10,2)),tspan=[0.0,10.0],sampling_period=0.1)# learn model from dataexperiment_results=auto_koopman(training_data,# list of trajectoriessampling_period=0.1,# sampling period of trajectory snapshotsobs_type="rff",# use Random Fourier Features Observablesopt="grid",# grid search to find best hyperparametersn_obs=200,# maximum number of observables to trymax_opt_iter=200,# maximum number of optimization iterationsgrid_param_slices=5,# for grid search, number of slices for each parametern_splits=5,# k-folds validation for tuning, helps stabilize the scoringrank=(1,200,40)# rank range (start, stop, step) DMD hyperparameter)# get the model from the experiment resultsmodel=experiment_results['tuned_model']# simulate using the learned modeliv=[0.5,0.1]trajectory=model.solve_ivp(initial_state=iv,tspan=(0.0,10.0),sampling_period=0.1)# simulate the ground truth for comparisontrue_trajectory=fhn.solve_ivp(initial_state=iv,tspan=(0.0,10.0),sampling_period=0.1)# plot the resultsplt.plot(*trajectory.states.T)plt.plot(*true_trajectory.states.T)ArchitectureThe library architecture has a modular design, allowing users to implement custom modules and plug them into the learning pipeline with ease.AutoKoopman Class Structure in the Training Pipeline. A user can implement any of the classes to extend AutoKoopman (e.g., custom observables, a custom tuner, a new system id estimator).DocumentationSee theAutoKoopman Documentation.References[1]Williams, M. O., Kevrekidis, I. G., & Rowley, C. W. (2015). A data–driven approximation of the koopman operator: Extending dynamic mode decomposition. Journal of Nonlinear Science, 25, 1307-1346.[2]Li, Y., He, H., Wu, J., Katabi, D., & Torralba, A. (2019). Learning compositional koopman operators for model-based control. arXiv preprint arXiv:1910.08264.[3]Brunton, S. L., Proctor, J. L., & Kutz, J. N. (2016). Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the national academy of sciences, 113(15), 3932-3937.[4]Bak, S., Bogomolov, S., Hencey, B., Kochdumper, N., Lew, E., & Potomkin, K. (2022, August). Reachability of Koopman linearized systems using random fourier feature observables and polynomial zonotope refinement. In Computer Aided Verification: 34th International Conference, CAV 2022, Haifa, Israel, August 7–10, 2022, Proceedings, Part I (pp. 490-510). Cham: Springer International Publishing.[5]Proctor, J. L., Brunton, S. L., & Kutz, J. N. (2018). Generalizing Koopman theory to allow for inputs and control. SIAM Journal on Applied Dynamical Systems, 17(1), 909-930.[6]Zhang, H., Rowley, C. W., Deem, E. A., & Cattafesta, L. N. (2019). Online dynamic mode decomposition for time-varying systems. SIAM Journal on Applied Dynamical Systems, 18(3), 1586-1609.