Skip to content

davidmoten/fastdtw

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastdtw


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

  • mavenize
  • add maven site plugins
  • add generic types
  • remove unused methods, classes
  • improve encapsulation
  • remove Abstract and Band DTW techniques (because FastDTW is better)
  • close resources properly
  • add junit tests (the project had no automated unit tests)
  • refactor package structure
  • deploy to Maven Central for the convenience of all
  • reformat whitespace
  • add javadocs
  • trim API to essentials
  • support non-file input data
  • decouple where appropriate
  • add immutability
  • add JMH benchmarks

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

About

O(n) approximate Dynamic Time Warping implementation in java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%