Piecewise Linear Time Warping
This repo contains research code for time warping multi-dimensional time series. This was developed as part of the following manuscript, which focuses on analysis of large-scale neural recordings (though this code can be also be applied to many other data types):
Discovering precise temporal patterns in large-scale neural recordings through robust and interpretable time warping.
Williams AH, Poole B, Maheswaranathan N, Dhawale AK, Fisher T, Wilson CD, Brann DH, Trautmann E, Ryu S, Shusterman R, Rinberg D, Ölveczky BP, Shenoy KV, Ganguli S (2020). Neuron. 105(2):246-259.e8
The code fits time warping models with either linear or piecewise linear warping functions. These models are more constrained than the classic Dynamic Time Warping (DTW) algorithm, and are thus less prone to overfit to data with high levels of noise. This is demonstrated below on synthethic data. Briefly, a 1-dimensional time series is measured over many repetitions (trials), and exhibits a similar temporal profile but with random jitter on each trial. Simply averaging across trials produces a poor description of the typical time series (red trace at bottom). A linear time warping model identifies a much better prototypical trace (labeled "template"), while accounting for the temporal translations on each trial with warping functions (blue to red linear functions at bottom). On the right, a nonlinear warping model based on DTW (called DBA) is shown for comparison. While DBA can work well on datasets with low noise, linear warping models can be easier to interpret and less likely to overfit.
Getting started
After installing (see below), check out the demos in the examples/ folder.
Either download or clone the repo:
git clone https://github.com/ahwillia/affinewarp/
Then navigate to the downloaded folder:
cd /path/to/affinewarp
Install the package and requirements:
pip install .
pip install -r requirements.txt
You will need to repeat these steps if we update the code.
Other references / resources
- tslearn - A Python package supporting a variety of time series models, including DTW-based methods.
Contact
alex.h.williams@nyu.edu (or open an issue here).
Metadata
Release files for affinewarp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| affinewarp-0.2.0.tar.gz | 37.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| affinewarp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.9 kB
Release files / affinewarp-0.2.0.tar.gz
| Download URL | affinewarp-0.2.0.tar.gz |
|---|---|
| Size | 37.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8211a3e8f65a2375b81e350528164dd8f883b56d03d730b2421a58d5d37d7880
|
|
BLAKE2b-256 checksum How to use checksums |
23d3ba9afa3bf53da7c1f8f42691b7d1baee6bc6311304f016d7b7714412eb37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.13
|
Release files / affinewarp-0.2.0-py3-none-any.whl
| Download URL | affinewarp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 37.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d03cfcd16822064f43e1810995d26dfef906802f3c3ac2450bef8df7f71413fd
|
|
BLAKE2b-256 checksum How to use checksums |
9eb06215126b6a7385052f2d6ab72dccf89332dee9d938375d81e7e346dfd790
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.13
|
Security for affinewarp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.