Dynamic time warping for JavaScript
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Latest commit d90bcd8 Jan 5, 2017
Permalink
Failed to load latest commit information.
dist 1.0.0 Jul 21, 2016
src init Jul 20, 2016
test init Jul 20, 2016
.coveralls.yml init Jul 20, 2016
.gitignore init Jul 20, 2016
.jscsrc init Jul 20, 2016
.jshintrc init Jul 20, 2016
.travis.yml init Jul 20, 2016
CHANGELOG.md init Jul 20, 2016
CONDUCT.md init Jul 20, 2016
CONTRIBUTING.md init Jul 20, 2016
Gruntfile.js 1.0.0 Jul 21, 2016
LICENSE.md init Jul 20, 2016
README.md Update README.md Jan 5, 2017
bower.json 1.0.0 Jul 21, 2016
package.json 1.0.0 Jul 21, 2016

README.md

dynamic-time-warping

Latest Version on npm Software License Build Status Coverage Status Total Downloads

Dynamic time warping for JavaScript. A simple usecase would be Touch signature identification with JavaScript for example.

Install

Several quick start options are available:

  • Download the latest release.
  • Clone the repo: git clone https://github.com/GordonLesti/dynamic-time-warping.git.
  • Install with npm: npm install dynamic-time-warping.
  • Install with Bower: bower install dynamic-time-warping.

Include script (unless you are packaging scripts somehow else):

<script src="/path/to/dynamic-time-warping.js"></script>

The plugin can also be loaded as AMD or Node module.

Usage

Initialization

DynamicTimeWarping needs two arrays containing objects of the the same type and function that calculates the distance between two objects and returns a float.

var ser1 = [ 9, 93, 15, 19, 24 ];
var ser2 = [ 31, 97, 81, 82, 39 ];
var distFunc = function( a, b ) {
    return Math.abs( a - b );
};

var dtw = new DynamicTimeWarping(ser1, ser2, distFunc);

getDistance

Will return the distance of the dynamic time warping as float.

// 108
var dist = dtw.getDistance();

getPath

Will return the path of the dynamic time warping as array of arrays with two integers.

// [ [ 0, 0 ], [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 4 ], [ 3, 4 ], [ 4, 4 ] ]
var dist = dtw.getPath();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ grunt

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email info@gordonlesti.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.