Skip to main content

A package that provides estimation methods for differential equations of dynamical systems based on timeseries data.

Project description

TSME: Time Series Model Estimation

A project for estimating differential equations from time series data. Documentation available here.

Overview

This package houses a number of tools an methods to estimate (partial) differential equations given time series data. The methodology is based off of PySINDy, albeit with some noteable deviations and add-ons. With this package you can:

  • perform time simulations for various dynamical systems (wrapping SciPy's solve_ivp), this includes:
    • ordinary differntial equations
    • partial differential equations (for spatial derivatives either finite-differences or FFT can be used) in 1D or 2D (3D experimental)
    • time-delayed (partial) differential equations (wrapping a slighty modified version of ddeint)
    • integro-differential equations (experimental)
  • generate generic candidate functions
  • define custom candidate functions
  • use different methods to estimate best linear combination of candidate functions:
    • least-squares fit
    • sequential thresholding least-squares (STLSQ)
    • Hyperopt's TPE to optimize STLSQ and additional model parameters with respect to the Bayesian Information Criterion (BIC)
  • give user-defined regularization and constraints

Installation

The package can now be installed with

pip install tsme

Quickstart

For examples see either the 'notebooks' folder in this repository (or the corresponding documentation), more involved exampels can be found in this demo repository.

In a 2D case we assume some time series data are given in a numpy array of shape (# variables, # time steps , # first spatial dim, # second spatial dim) along with an array of time stamps of shape (# time steps, ). If the (equidistant) spatial steps are not by one unit we provide an array defining lower and upper bounds, in this case of shape (2, 2) (1D: (1, 2) or (2, )). A bare bones example would be:

from tsme.model_estimation import Model

estimated_model = Model(time_series_data, time_stamps, phys_domain=[[x_min, x_max], [y_min, y_max]])

estimated_model.init_library(ode_order=3, pde_order=2)

estimated_model.optimize_sigma()

The library of candidate terms can be viewed using estimated_model.print_library() and in this case would give for one variable:

|   Index | Term                          |   Value 0 |
|---------|-------------------------------|-----------|
|       0 | 1.0                           |         0 |
|       1 | u[0]                          |         0 |
|       2 | u[0]*u[0]                     |         0 |
|       3 | u[0]*u[0]*u[0]                |         0 |
|       4 | d_dx(u[0],1)                  |         0 |
|       5 | d_dy(u[0],1)                  |         0 |
|       6 | d_dx(u[0]*u[0],1)             |         0 |
|       7 | d_dy(u[0]*u[0],1)             |         0 |
|       8 | d_dx(u[0]*u[0]*u[0],1)        |         0 |
|       9 | d_dy(u[0]*u[0]*u[0],1)        |         0 |
|      10 | d_dx(u[0],2)                  |         0 |
|      11 | d_dy(u[0],2)                  |         0 |
|      12 | dd_dxdy(u[0],(1,1))           |         0 |
|      13 | d_dx(u[0]*u[0],2)             |         0 |
|      14 | d_dy(u[0]*u[0],2)             |         0 |
|      15 | dd_dxdy(u[0]*u[0],(1,1))      |         0 |
|      16 | d_dx(u[0]*u[0]*u[0],2)        |         0 |
|      17 | d_dy(u[0]*u[0]*u[0],2)        |         0 |
|      18 | dd_dxdy(u[0]*u[0]*u[0],(1,1)) |         0 |

The library should then after optimization (hopefully) hold non-zero entries.

Citation

If you use this code please cite

Mai, O., Kroll, T. W., Thiele, U., & Kamps, O. (2025). Hyperparameter Optimization in the Estimation of PDE and Delay-PDE models from data. arXiv. https://doi.org/10.48550/ARXIV.2508.12715

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsme-0.0.81.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsme-0.0.81-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file tsme-0.0.81.tar.gz.

File metadata

  • Download URL: tsme-0.0.81.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsme-0.0.81.tar.gz
Algorithm Hash digest
SHA256 f549f68dadd1510015733ee5122b36e3ad6a1033da73bd78e1c5cd5bb7160d8f
MD5 95c98aa47af1cb1a1c7b8474597355ae
BLAKE2b-256 447bf0f7aa5c09bac35ab7ab44b079b0cd1b7f4b9b4fad1c044732770bf77f46

See more details on using hashes here.

File details

Details for the file tsme-0.0.81-py3-none-any.whl.

File metadata

  • Download URL: tsme-0.0.81-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsme-0.0.81-py3-none-any.whl
Algorithm Hash digest
SHA256 9945d50797d6418529f4dfb098a9b7a2682d26f5fc2807774187998a4d3a5625
MD5 b7ea8f9815ae47023945b49790d3029e
BLAKE2b-256 a7c5b953a4a0d80ba444e3694283f7356378586264b5ab3797eda55dfc11e2d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page