Giter VIP home page Giter VIP logo

affinewarp's Introduction

Piecewise Linear Time Warping

This repo contains research code for time warping multi-dimensional time series, with a focus on neural data. The core functions are stable, but still under development. Click here to see the poster on Piecewise Time Warping presented at SfN 2018.

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.

screen shot 2018-11-05 at 2 03 55 pm

Getting started

After installing (see below), check out the demos in the examples/ folder.

  • Shift.ipynb - demonstrates the essential ideas on a very simple, synthethic dataset containing only one neuron.
  • OFC-2.ipynb - shows a more complete analysis on real data. The tutorial uses a publicly available dataset from crcns.org, which can be found here. See OFC-2-wrangle-data.ipynb for instructions on downloading and organizing the dataset.

The code is fairly well-documented but the tutorials can still be improved, so let us know if you run into trouble.

Installing

This package isn't registered yet, so you need to install manually. 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

  • tw-pca - Time-Warping Principal Components Analysis, also supports linear and shift-only warping functions. Does not support piecewise linear warping functions and assumes that time series are low-dimensional. Nonlinear warping methods are also supported. See our conference abstract and poster.

  • tslearn - A Python package supporting a variety of time series models, including DTW-based methods.

Contact

[email protected] (or open an issue here).

affinewarp's People

Contributors

ahwillia avatar poolio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.