New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dynamic-time-warping-ts

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-time-warping-ts

Dynamic time warping for TypeScript.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

dynamic-time-warping-2

This is a typed version of the github.com/GordonLesti/dynamic-time-warping package, initially forked by fheyen.

Install

npm install dynamic-time-warping-ts

Usage

Importing the package

import DynamicTimeWarping from "dynamic-time-warping-ts";

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.

const ser1 = [ 9, 93, 15, 19, 24 ];
const ser2 = [ 31, 97, 81, 82, 39 ];
const distFunc = ( a, b )=>  Math.abs( a - b );

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

getDistance

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

// 108
const 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 ] ]
const dist = dtw.getPath();

Credits

License

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

Keywords

FAQs

Package last updated on 16 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc