This directory contains implementations of various Dynamic Mode Decomposition (DMD) methods for learning the Koopman operator for CTF-for-Science.
Dynamic Mode Decomposition is a data-driven technique used to extract dynamic information from time-series data. This algorithm was developed by Schmid 2010 [1] to identify spatial and temporal coherent structures from high-dimensional data for fluid-dynamics applications. This algorithm provides a modal decomposition where each mode consists of spatially correlated structures with the same linear behavior in time (e.g., oscillations at a given frequency with growth or decay); thus, DMD finds the linear coordinate system that best fits the starting dataset. By ranking the importance of the modes through the singular values of the data matrix, which offer a measure of the 'information content' of the associated modes, DMD can build a low-dimensional surrogate linear model that can simulate the temporal evolution of these spatial modes [2].
More in detail, let
where
Different variants of DMD have been proposed to improve the performance of the original algorithm, such as:
- Classic DMD: The original DMD algorithm, which uses the snapshot matrix to compute the DMD modes and eigenvalues.
- Hankel Preprocessing: A preprocessing step that uses Hankel matrices to improve the DMD results by capturing the temporal correlations in the data.
- Bagging Optimised DMD: A variant of DMD that uses bagging techniques to improve the robustness and accuracy of the DMD results by combining multiple DMD models trained on different subsets of the data.
dmd.py: Contains the implementation of the DMD classes designed to work within CTF-for-Science, based on the model logic of pyDMD [3].run.py: Batch runner script to create the DMD model across multiple sub-dataset within the CTF-for-Science framework.config/: Directory containing configuration files for different datasets and DMD variants.
The configuration files specify the hyperparameters for the DMD methods, including the dataset to be used, the pair ID, and the specific DMD variant to be applied. The configuration files are in YAML format and can be easily modified to suit different datasets or DMD variants:
dataset:
name: <dataset_name> # name of the dataset (either 'ODE_Lorenz' or 'PDE_KS')
pair_id: 'all' # or a specific pair ID as [1,2,3,4]
model:
name: DMD
method: <dmd_method> # classic, hankel, highorder, bagging
rank: <rank> # number of modes to keep
parametric: <parametric_mode> # Mode to use to extend DMD to parametric systems (either `monolithic` or `partitioned`)In the CTF-for-Science root directory, run the following command to install the package:
python models/DMDvariants/run.py models/DMDvariants/config/config_<dataset_name>_<method>.yamlThis repository rely on packages in the main requirements.txt:
- pyyaml
- numpy
- pydmd
- ezyrb
The packages can be installed using pip:
pip install -r requirements.txt- P. J. Schmid, “Dynamic Mode Decomposition of numerical and experimental data,” Journal of Fluid Mechanics, 656, 5 (2010); 10.1017/S0022112010001217, URL https://doi.org/10.1017/S0022112010001217, publisher: Cambridge University Press.
- J. Nathan Kutz, Steven L. Brunton, Bingni W. Brunton, and Joshua L. Proctor, “Dynamic Mode Decomposition: Data-Driven Modeling of Complex Systems” SIAM-Society for Industrial and Applied Mathematics; 10.1137/1.9781611974508, URL https://epubs.siam.org/doi/abs/10.1137/1. 9781611974508.
- S. M. Ichinaga, F. Andreuzzi, N. Demo, M. Tezzele, K. Lapo, G. Rozza, S. L. Brunton, and J. N. Kutz, “PyDMD: A Python package for robust dynamic mode decomposition,” (2024) URL https://arxiv.org/abs/ 2402.07463.
