Welcome to this exciting repository! ๐ This project aims to uncover the underlying dynamics of nonlinear harmonic oscillators using Conditional Variational Autoencoders (cVAE) to learn Koopman Operators. This topic is a treasure trove for anyone interested in leveraging machine learning for understanding nonlinear dynamical systems.
The repository is neatly organized with each file serving a specific purpose:
-
./data_generator.py
: Generates time-series data for the nonlinear harmonic oscillator, considering multiple initial conditions. -
./cVAE.py
: Houses thecVAE
class, the backbone of our machine learning approach to learning the low-rank approximation of the Koopman Operator. -
./learn.py
: Executes the training loop for our cVAE, optimized with hyperparameters through Bayesian Optimization. -
./test.py
: Evaluates the performance of the trained model and visualizes the predicted dynamics.
The cVAE.py
file contains the blueprint of our Conditional Variational Autoencoder, designed to capture the nonlinear dynamics in its latent space. By learning a Koopman Operator, the cVAE transforms complex, nonlinear dynamics into linear dynamics in the latent space, making future state predictions more tractable.
The data generator in data_generator.py
employs numerical methods to simulate the nonlinear harmonic oscillator, creating a rich dataset that considers a wide range of initial conditions.
Finally, test.py
allows you to see the learned dynamics in action, comparing predicted states with actual states to measure the model's performance.
To kickstart your journey, clone this repository:
git clone https://github.com/joseph-crowley/learned-koopman.git
cd learned-koopman
Ensure that you have Python 3.x:
python --version
Install the necessary Python packages:
pip install numpy torch matplotlib
Run the training script to train your very own cVAE:
python learn.py
Your contributions can make this project even better! Feel free to raise issues, propose new features, or contribute to the code/documentation through pull requests. Collaboration is the key to scientific discovery!