This page contains tutorials and code snippets to showcase datafold's API. All tutorials can be viewed online. If you want to execute the notebooks in Jupyter, please follow the instructions below in section "Run notebooks with Jupyter".
Download all tutorials in a zipped file.
.. toctree::
:hidden:
tutorial_01_datastructures
tutorial_02_pcm_subsampling
tutorial_03_dmap_scurve
tutorial_04_dmap_digitclustering
tutorial_05_roseland_scurve_digits
tutorial_06_dmap_mahalanobis_kernel
tutorial_07_jsf_common_eigensystem
tutorial_08_gh_oos
tutorial_09_dmd_mixed_spatial_signals
tutorial_10_edmd_limitcycle
tutorial_11_dmd_control
tutorial_12_edmd_control
tutorial_13_EDMD_with_dictionary_learning
tutorial_14_kmpc_flowcontrol
tutorial_15_kmpc_motor_engine
tutorial_16_online_dmd
02_pcm_subsampling.ipynb(download, doc)We show how the
PCManifolddata structure can be used to subsample a manifold point cloud uniformly.- Warning
The tutorial generates a large dataset with 10 Mio. samples. This number may have to be reduced when running locally, depending on the available computer memory.
03_dmap_scurve.ipynb(download, doc)We use the
DiffusionMapsmodel to compute lower dimensional embeddings of an S-curved point cloud manifold. We also select the best combination of intrinsic parameters automatically with an optimization routine.References: scikit-learn tutorial :octicon:`link-external`
04_dmap_digitclustering.ipynb(download, doc)We use the
DiffusionMapsmodel to cluster data from handwritten digits and highlight its out-of-sample capabilities. This example is taken from the scikit-learn package, so the the method can be compared against other common manifold learning algorithms.References: scikit-learn tutorial :octicon:`link-external`
05_roseland_scurve_digits.ipynb(download, doc)We use a
Roselandmodel to compute lower dimensional embeddings of an S-curved point cloud manifold and to cluster data from handwritten digit.References: scikit-learn tutorial 1 :octicon:`link-external` | scikit-learn tutorial 2 :octicon:`link-external`
06_dmap_mahalanobis_kernel.ipynb(download, doc)We highlight how to use the Mahalanobis kernel within
DiffusionMaps. The key feature of this kernel is that it can yield embeddings that are invariant to the observation function.- Warning
The implementation of Mahalanobis kernel in datafold is still experimental and should be used with care. Contributions (mainly testing / documentation) are welcome!
09_dmd_mixed_spatial_signals.ipynb(download, doc)We utilize dynamic mode decomposition (DMD) on a linear spatiotemporal system. This system is formed by combining two mixed spatiotemporal signals. The example is from the DMD book by Kutz et al.
References: pykoopman tutorial :octicon:`link-external` | :cite:t:`kutz-2016`
11_dmd_control.ipynb(download, doc)We introduce the dynamic mode decomposition with control. In this tutorial origins from the PyDMD package. Here we use it to compare the interface and highlight that the results are identical.
References: Original PyDMD tutorial :octicon:`link-external`
12_edmd_control.ipynb(download, doc)This tutorial demonstrates how to use extended dynamic mode decomposition (EDMD) and a linear quadratic regulator (LQR) for controlling the Van der Pol oscillator in a closed-loop. The goal is to show how EDMD can be an effective alternative for modeling and controlling non-linear dynamic systems.
References: Templated tutorial :octicon:`link-external`
13_EDMD_with_dictionary_learning.ipynb(download, doc)We demonstrate the EDMD-DL method, with which it is possible to learn the dictionary (i.e. set of observable functions) from the data. In the tutorial we use an feedforward artificial network and demonstrate the method for the Duffing system.
- Warning
The implementation of EDMD-DL is still experimental and should be used with care. Contributions (testing / documentation / enhanced functionality) are welcome! The notebook also requires the Python package torch to be installed separately to the datafold's dependencies
References: :cite:t:`li-2017`
14_kmpc_flowcontrol.ipynb(download, doc)We take the 1D Burger equation with periodic boundary conditions as an example to showcase how the Koopman operator can be utilized for model predictive control (MPC) in flow systems.
References: Original code (Matlab) :octicon:`link-external` | :cite:t:`arbabi-2018`
15_kmpc_motor_engine.ipynb(download, doc)This tutorial will demonstrate how to utilize the Extended Dynamic Mode Decomposition (EDMD) to estimate the Koopman operator in controlled dynamical systems. The nonlinear behavior of a motor engine model will be transformed into a higher dimensional space, which will result in an approximately linear evolution. This will allow the use of EDMD as a linearly controlled dynamical system within the Koopman Model Predictive Control (KMPC) framework.
References: Original code (Matlab) :octicon:`link-external` | :cite:t:`korda-2018` (Sect. 8.2)
16_online_dmd.ipynb(download, doc)This tutorial showcases the online dynamic mode decomposition (
OnlineDMD) at the example of a simple 2D time-varying system. The performance of the online DMD is compared with batch DMD and the analytical solution of the system. Following the online update scheme the model is updated once new data becomes available, which is particularly useful in time-varying systems.References: Original demo :octicon:`link-external` | :cite:t:`zhang-2019`
If datafold was installed from PyPI, ...
... the tutorials are not included in the package. Download the tutorials separately from the list.
If the datafold repository was downloaded, ...
... then the tutorials are located
path/to/repo/tutorials/. Before executing the tutorials, please make sure that datafold is either installedpython -m pip install .or that
path/to/datafold/is included in thePYTHONPATHenvironment variableexport PYTHONPATH=$PYTHONPATH:/path/to/datafold/repository/
All tutorials are Jupyter notebooks (.ipynb file ending). The Jupyter environment and its
dependencies install with
python -m pip install jupyterFor further information visit the Jupyter homepage. To open a Jupyter notebook in a web browser, run
jupyter notebook path/to/datafold/tutorial_folderor use the target in the Makefile (if the repository was downloaded):
make tutorial