The package implements the data-driven extended dynamic mode decomposition (EDMD) with trainable dictionary [1] and data-driven parametric Koopman decompositions [2]. For non-parametric problems in [1], this is a generalization of the classical EDMD and is most effective for high dimensional or highly nonlinear problems where a priori choice of dictionary functions are difficult. This package implements iterative algorithms to perform Koopman operator analysis, such as computing eigenfunctions, eigenvalues and modes, using a deep neural network based parameterization of the Koopman dictionary functions. Furthermore, for parametric cases in [2], both the projected Koopman operator and dictionaries are trained simultaneously. Compared to some existing algorithms, it provides enhanced performance in handling Koopman with control for forward predictions and optimal control challenges.
This project uses python 3.8
. Set up the project for development using the following steps:
-
In your chosen folder, create a virtual environment
$python3 -m venv koopman_env
-
Activate the environment
$source koopman_env/bin/activate
-
Install requirements
$pip install -r requirements.txt
-
Perform editable install for development
$pip install .
-
Add this virtual environment to Jupyter by typing
$python -m ipykernel install --user --name=koopman
We use Duffing equation, Van der Pol Mathieu oscillator, FitzHugh-Nagumo partial differential equation and Korteweg-De Vries equation as examples to show how to use this package. Please enter the following commands in the terminal.
$cd examples/ParametricKoopman
$cd duffing
-
Generate data
$python generate_data_duffing.py config_duffing.json
-
Train models
$python train_model_duffing.py config_duffing.json
-
Evaluate models in
$cd vdpm
-
Generate data
$python generate_data_vdpm.py config_vdpm.json
-
Train models
$python train_model_vdpm.py config_vdpm.json
-
Evaluate models in
$cd fhn/fhn_dim_10
-
Generate data
$python generate_data_fhn.py config_fhn.json
-
Train models
$python train_model_fhn.py config_fhn.json
-
Evaluate models in
-
Generate data
$python generate_data_fhn_high_dim_u.py config_fhn.json
-
Train models
$python train_model_fhn_high_dim_u.py config_fhn.json
-
Evaluate models in
$cd kdv/nonlinear_case
-
Generate data
$python generate_data_kdv.py config_kdv.json
-
Train models
$python sin_train_model_kdv.py config_kdv.json
-
Collect the predictions and tracking results
$python sin_results_tau_10.py config_kdv.json
-
Check controllability
$python train_model_kdv_Klayer.py config_kdv_K_layer.json
Download the training data and the trained weights through this link or run
$curl -L -o PKNN_results.zip 'https://www.dropbox.com/scl/fi/91an423jmdy7n918y60l8/PKNN_results.zip?rlkey=xfzl33dr3xbbamu2czxifd0ho&dl=1'
Please assign the experimental results to their respective folders.