Home

Awesome

fastdtw

<a href="https://travis-ci.org/davidmoten/fastdtw"><img src="https://travis-ci.org/davidmoten/fastdtw.svg"/></a><br/> Maven Central

An enhancement of Stan Salvador and Philip Chan's FastDTW dynamic time warping implementation.

Status: released to Maven Central

Improvements sought for this massaging of the original project are

How to use

Add this dependency to your pom.xml:

<dependency>
  <groupId>com.github.davidmoten</groupId>
  <artifactId>fastdtw</artifactId>
  <version>0.1</version>
</dependency>

To calculate the distance between two TimeSeries:

Create the two TimeSeries objects using the builder:

TimeSeries ts1 = TimeSeriesBase.builder()
                   .add(0, 123.4)
                   .add(1, 125)
                   .add(2, 126.3)
                   .build();

Then calculate the distance:

import com.fastdtw.dtw.FastDTW;
import com.fastdtw.util.Distances;

double distance = FastDTW.compare(ts1, ts2, 10, Distances.EUCLIDEAN_DISTANCE))
                         .getDistance();

Benchmarks

To run benchmarks:

mvn clean install -P benchmark