Skip to content

sandialabs/PyMATSE_multifidelity_timeseries

Repository files navigation

PyMATSE - Python Multi-Fidelity Assisted Time-Series Emulation

This repository contains code and data for creating multifidelity models for time-series data. The nonlinear mappings between fidelities are constructed based on the Nonlinear Auto-Regressive GP by Raissi and Perdikaris (2017). Taylor series approximations and automatic differentiation (using tf.GradientTape() and jax.jacobian()) are used extensively to avoid Monte Carlo sampling, allowing us to handle several fidelities at once.

Table of Contents

Project Overview

The main purpose of this project is to create multifidelity models for time-series data. We provide three options for constructing these models:

  1. Fully Auto-Regressive
  2. Basis Functions
  3. SINDy (Sparse Identification of Nonlinear Dynamics)

These options allow end-users to select the best model for their specific needs. The project relies on various Python packages, including TensorFlow, TensorFlow Probability, GPflow, JAX, Joblib, itertools, and PySINDy.

Installation

To get started, clone the repository and install the required dependencies.

git clone https://github.com/yourusername/multifidelity_timeseries.git
cd multifidelity_timeseries
conda create --name matse python=3.10 numpy=1.26.0
conda activate matse
pip install gpflow tensorflow~=2.10.0 tensorflow-probability~=0.18.0
pip install jax joblib pysindy

You may need to toggle tensorflow with tensorflow-cpu if you're on linux. Installing GPU compatible tensorflow is ok, but it's not required for MATSE.

Usage

Running the Notebooks You can explore the analysis by running the Jupyter notebooks provided in the notebooks directory. Ensure that your environment includes the required packages.

Single-Fidelity SINDy: Constructs SINDy-based time series emulation for the single-fidelity case, using the highest fidelity dataset alone.

jupyter notebook notebooks/singlefidelity-sindy-set2.ipynb

Multi-Fidelity Basis Representation: Constructs multifidelity models for the legendre basis coefficients, leveraging low-fidelity data to accelerate high-fidelity time-series outputs.

jupyter notebook notebooks/multifidelity-basis-set1.ipynb

Single-Fidelity Basis Representation: Constructs legendre-based time series emulation for the single-fidelity case, using the highest fidelity dataset alone.

jupyter notebook notebooks/singlefidelity-basis-set1.ipynb

Multi-Fidelity SINDy: Constructs multifidelity models for the SINDy coefficients, leveraging low-fidelity data to accelerate high-fidelity time-series outputs.

jupyter notebook notebooks/multifidelity-sindy-set2.ipynb

Using the Models and Utilities You can import and use the models and utility functions in your own scripts. Here is an example:

from multifidelity_timeseries.models import sindy_timeseries
from multifidelity_timeseries.utils import helper_functions

Directory Structure

multifidelity_timeseries/
├── __init__.py
├── utils/
│   ├── __init__.py
│   ├── misc.py
│   ├── helper_functions.py
│   ├── plot_coeff_parity.py
│   ├── gpflow_multifidelity_base.py
│   ├── special_interp.py
│   └── __pycache__/
├── models/
│   ├── __init__.py
│   ├── mf_sindy_timeseries.py
│   ├── basis_timeseries.py
│   ├── sindy_timeseries.py
│   ├── mf_basis_timeseries.py
│   └── __pycache__/
├── notebooks/
│   ├── singlefidelity-sindy-set2.ipynb
│   ├── multifidelity-sindy-set2.ipynb
│   ├── singlefidelity-basis-set1.ipynb
│   └── __init__.py
data/
├──set1/
│   ├── Model_1-data.mat
│   ├── Model_2-data.mat
│   ├── Model_3-data.mat
│   ├── Model_4-data.mat
├──set2/
│   ├── Model_1-data.mat
│   ├── Model_2-data.mat
├── README.md
└── .git/

Description of Directories

  • multifidelity_timeseries: Main package directory.
  • utils: Contains utility functions and scripts.
  • models: Contains different models for time series analysis.
  • notebooks: Jupyter notebooks for single-fidelity and multi-fidelity SINDy analysis.
  • data: Contains data files used in the analysis.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgments

This work was performed at Sandia National Laboratories.

Sandia National Laboratories is a multimission laboratory managed and operated by National Technology & Engineering Solutions of Sandia, LLC, a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-NA0003525

About

This repository contains code and data for creating multifidelity models for time-series data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published