Skip to main content

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

Metadata

Release files for tsme 0.0.81

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsme 0.0.81
File Size Uploaded
tsme-0.0.81.tar.gz 34.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tsme 0.0.81
File Interpreter ABI Platform
tsme-0.0.81-py3-none-any.whl Python 3 none any Details

Total release size: 70.2 kB

Release files / tsme-0.0.81.tar.gz

Download URL tsme-0.0.81.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f549f68dadd1510015733ee5122b36e3ad6a1033da73bd78e1c5cd5bb7160d8f
BLAKE2b-256 checksum
How to use checksums
447bf0f7aa5c09bac35ab7ab44b079b0cd1b7f4b9b4fad1c044732770bf77f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / tsme-0.0.81-py3-none-any.whl

Download URL tsme-0.0.81-py3-none-any.whl
Size 35.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9945d50797d6418529f4dfb098a9b7a2682d26f5fc2807774187998a4d3a5625
BLAKE2b-256 checksum
How to use checksums
a7c5b953a4a0d80ba444e3694283f7356378586264b5ab3797eda55dfc11e2d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.0.81 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page